If you're wondering, the program I wrote is a simple little webpage with two
buttons so my wife can play music off my Linux box (with good speakers) from
her laptop (with bad speakers), so I don't really need this to be a very
stable setup, it's mostly for curiosity's sake.
Michael
在 Aug 25, 2006 12:54 AM 時,Michael Snoyman 寫到:
> I was thinking of rewriting a little webserver program I wrote in
> Perl 5
> using Pugs. I was wondering what the equivilent (if any) of
> IO::Socket is.
> I suppose I could use an external webserver and use CGI to get this
> working
> with IO, but my preference would be a pure Perl 6 approach.
See examples/network/http-server.pl in the Pugs tree. :-)
Cheers,
Audrey
Thanks,
Michael
> Thanks Audrey. I actually found that after writing that post.
> What I had wanted to do was write a threaded server, implemented in
> Perl 6 only (ie, including Perl 6 regexs). I got that working
> almost entirely, when I couldn't find any thread implementation. I
> tried using fork() to get a same effect, but it seems that fork
> also isn't available. Was I missing something, or are these just
> features that I need to wait for?
async{} creates a thread:
my $thr = async { ... };
You can use the usual .join, .detach, .yield methods on it.
Thanks,
Audrey