Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

IO::Socket, or any IO

28 views
Skip to first unread message

Michael Snoyman

unread,
Aug 24, 2006, 12:54:21 PM8/24/06
to perl6...@perl.org
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.

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

Audrey Tang

unread,
Sep 8, 2006, 5:41:14 AM9/8/06
to Michael Snoyman, perl6...@perl.org

在 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

Michael Snoyman

unread,
Sep 8, 2006, 10:33:23 AM9/8/06
to Audrey Tang, perl6...@perl.org
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?

Thanks,
Michael

Audrey Tang

unread,
Sep 9, 2006, 7:21:13 AM9/9/06
to Michael Snoyman, perl6...@perl.org

在 Sep 8, 2006 10:33 PM 時,Michael Snoyman 寫到:

> 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


0 new messages