Same-named arguments
Hi, I'm just starting with Perl 6. I was reading through "Perl 6 and Parrot Essentials" (finally arrived yesterday from Amazon; very happy) and I was wondering what would happen if you had a parameter list that included variables of a different type but the same name (ie, $foo, @foo). I wrote a little test script and ran it through pugs. Here's what I got: Script: use v6; sub mysub($foo, @foo, %foo) { say "Starting mysub"; say "Printing scalar"; say $foo; say "Printing array"; say @foo; say "Printing hash"; say %foo; say "Leaving mysub\n"; } my $foo = 'foo'; my @foo = qw|foo bar|; my %foo = ( foo => 'bar', foo2 => 'bar2' ); mysub($foo, @foo, %foo); mysub(:foo($foo), :foo(@foo), :foo(%foo)); Output: Starting mysub Printing scalar foo Printing array foobar Printing hash foo barfoo2 bar2 Leaving mysub Starting mysub Printing scalar foo Printing array Printing hash Leaving mysub Just wondering if the language is meant to work that way, or if it's a pugs "feature." Thanks, Michael
IO::Socket, or any IO
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
Writing modules
Hi, I wanted to start working on a module (mainly to learn Perl 6, I doubt anyone would ever want to use it). I want to do this "properly," whatever that means. I was wondering if someone could explain to me: 1) How to construct the Makefile.pl 2) How exactly to set up and run tests I realize that there are lots of modules to look at in the Pugs distribution, but as far as I can tell they are meant to be built from within the Pugs source tree, and since my code clearly won't be living there I'd rather not write it there either. Thanks, Michael
Re: IO::Socket, or any IO
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 On 9/8/06, Audrey Tang <[EMAIL PROTECTED]> wrote: 在 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
CGI Session management (was Re: the CGI.pm in Perl 6)
If Perl6 CGI.pm is intended to be the successor of the P5 CGI.pm (the quasi-standard for Perl web programming) is should really get a modern design. I agree completely. In that vein, I think that one thing a lot of web developers would like to have available more easily would be session management. In PHP it's as simple as $_SESSION['key'] = 'value'. I understand that CGI.pm is a fundemantally different concept from PHP and that this can't be completely taken care of by the module. Still, if something could be written in, I think it would make many people's lives simpler. Perhaps a method like CGI->get_session_key, which would return a unique ID and handle all this via cookies without the developer needing to notice anything. It would then be a lot easier to keep a (flat file|dbm|sql database) of information tied to that ID. On the other hand, that might be the kind of feature that needs to be done in a seperate module. In any case, I'd be happy to help out with writing it; I'm just not entirely certain of how it should work. Michael
Re: HTTP::Request/Response (was Re: the CGI.pm in Perl 6)
On 9/14/06, Darren Duncan <[EMAIL PROTECTED]> wrote: Having had some prior experience in tackling this problem (eg, CGI::Portable), I will endeavour to work on / help with the Perl 6 analogy to HTTP::Request/Response, so to replace the use of corresponding aspects of CGI.pm. I really like this idea. I was actually working on a threaded HTTP server in Perl that used that exact approach. The idea was that you could write a HTTP::Server::Threaded::Handler implementation; this could easily work for CGI as well. I can't test my code, since my Pugs installation is currently broken (I've been working on it from work, and I'm trying to get everything working in Cygwin right now). However, I've posted my code at this URL: http://oss.snoyman.com/HTTP-Server-Threaded.tar.gz As a note to Audrey: This is what I was asking about threads for; I added the async statement, but haven't tested it. Michael
Re: Perl6 "style-guide"
On 9/20/06, jerry gay <[EMAIL PROTECTED]> wrote: don't "just leave this to the community." take part! take advantage of the perl 6 wiki (http://rakudo.org/perl6/index.cgi) and create a page describing the task. write some code yourself. ask folks to contribute, and fix the existing code or add their own. create an outline of what you'd like to see there... and have fun! be the community. ~jerry Would a plausible idea be to have a section on the wiki devoted to "free coding?" All developers, including those brand new to Perl 6, could start writing random test code, which the more experienced in the Perl 6 world could then tweak so that eventually, we should have a very broad sample of code that the community has decided looks right. Michael