From frank at wiles.org Tue Apr 1 10:00:16 2008 From: frank at wiles.org (Frank Wiles) Date: Tue, 1 Apr 2008 12:00:16 -0500 Subject: [Kc] RegExes In-Reply-To: <38feac7e0803311834l5acd834ue5f2b892942d6959@mail.gmail.com> References: <38feac7e0803311829v6ee3cbb2we8cc914547a996d@mail.gmail.com> <38feac7e0803311834l5acd834ue5f2b892942d6959@mail.gmail.com> Message-ID: <20080401120016.2c209bf8.frank@wiles.org> On Mon, 31 Mar 2008 20:34:58 -0500 "Emmanuel Mejias" wrote: > I think I figured it out. How's that look, better? > > #!/usr/bin/perl -w > > @input = `cat /etc/syslog.conf`; > > foreach $line (@input) { > if ($line =~* /\var\/log/*){ > print $line; > } > } > The asterisks there aren't correct. It should be like this: if( $line =~ /\/var\/log\// ) { print $line; } ------------------------------------------------------- Frank Wiles, Revolution Systems, LLC. Personal : frank at wiles.org http://www.wiles.org Work : frank at revsys.com http://www.revsys.com From djgoku at gmail.com Tue Apr 1 10:16:49 2008 From: djgoku at gmail.com (Jonathan Otsuka) Date: Tue, 1 Apr 2008 12:16:49 -0500 Subject: [Kc] RegExes In-Reply-To: <20080401120016.2c209bf8.frank@wiles.org> References: <38feac7e0803311829v6ee3cbb2we8cc914547a996d@mail.gmail.com> <38feac7e0803311834l5acd834ue5f2b892942d6959@mail.gmail.com> <20080401120016.2c209bf8.frank@wiles.org> Message-ID: <4B0D64EA-4161-4BF6-96D5-E56B8139F8AF@gmail.com> On Apr 1, 2008, at 12:00 PM, Frank Wiles wrote: > On Mon, 31 Mar 2008 20:34:58 -0500 > "Emmanuel Mejias" wrote: > >> I think I figured it out. How's that look, better? >> >> #!/usr/bin/perl -w >> >> @input = `cat /etc/syslog.conf`; >> >> foreach $line (@input) { >> if ($line =~* /\var\/log/*){ >> print $line; >> } >> } >> > > The asterisks there aren't correct. It should be like this: > > if( $line =~ /\/var\/log\// ) { > print $line; > } I was thinking since one of the lines in syslog.conf had a -prepended. So: if($line =~ /.*\/var\/log\//) { print $line; } From sterling at hanenkamp.com Tue Apr 1 12:19:59 2008 From: sterling at hanenkamp.com (Andrew Hanenkamp) Date: Tue, 1 Apr 2008 14:19:59 -0500 Subject: [Kc] RegExes In-Reply-To: <38feac7e0803311834l5acd834ue5f2b892942d6959@mail.gmail.com> References: <38feac7e0803311829v6ee3cbb2we8cc914547a996d@mail.gmail.com> <38feac7e0803311834l5acd834ue5f2b892942d6959@mail.gmail.com> Message-ID: Someday I'll remember the Reply to All button... for public consumption, I'm resending this to the list... ;) On Mon, Mar 31, 2008 at 8:34 PM, Emmanuel Mejias wrote: > if ($line =~* /\var\/log/*){ > I think that'd do it. You can also use a different set of separators to make it a little more readable and avoid the extra escapes: if ($line =~ m{/var/log}) { By using the "m" keyword, you can use virtually any symbol you want as the delimiter for your regex. For example, m[/var/log] m"/var/log" m'/var/log' m|/var/log| Cheers, Andrew -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/kc/attachments/20080401/3eba30e0/attachment.html From emmanuel.mejias at gmail.com Wed Apr 2 13:10:20 2008 From: emmanuel.mejias at gmail.com (Emmanuel Mejias) Date: Wed, 2 Apr 2008 15:10:20 -0500 Subject: [Kc] Shuffling a deck of cards... Message-ID: <38feac7e0804021310x117bbc81hb2bd2817c4131009@mail.gmail.com> My instructor has asked me to use the pop, shift, and push functions to write a script that sufficiently "shuffles" a simulated deck of cards before printing the top five cards. I haven't quite got it down, but I was wondering, did I need to add the highlighted line in my code or something along those lines to indicate $element = pop (@deck) or is that what I'm using "push" for? Now it does pop A H to the bottom of the deck. So what exactly is it that I'm doing wrong? #!/usr/bin/perl -w @deck = ("A H","2 H","3 H","4 H","5 H","6 H","7 H","8 H", "9 H","10 H","J H","Q H","K H", "A D","2 D","3 D","4 D","5 D","6 D","7 D","8 D", "9 D","10 D","J D","Q D","K D", "A C","2 C","3 C","4 C","5 C","6 C","7 C","8 C", "9 C","10 C","J C","Q C","K C", "A S","2 S","3 S","4 S","5 S","6 S","7 S","8 S", "9 S","10 S","J S","Q S","K S"); *$cards = pop (@deck); *push (@deck, pop(@deck)); push (@deck, shift(@deck)); foreach my $card (@deck){ print "Cards: $card\n" } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/kc/attachments/20080402/6db73721/attachment.html From emmanuel.mejias at gmail.com Wed Apr 2 13:14:52 2008 From: emmanuel.mejias at gmail.com (Emmanuel Mejias) Date: Wed, 2 Apr 2008 15:14:52 -0500 Subject: [Kc] Shuffling a deck of cards... In-Reply-To: <38feac7e0804021310x117bbc81hb2bd2817c4131009@mail.gmail.com> References: <38feac7e0804021310x117bbc81hb2bd2817c4131009@mail.gmail.com> Message-ID: <38feac7e0804021314y548fee66h4ee13c3735c5b413@mail.gmail.com> I made the following changes.... On Wed, Apr 2, 2008 at 3:10 PM, Emmanuel Mejias wrote: > My instructor has asked me to use the pop, shift, and push functions to > write a script that sufficiently "shuffles" a simulated deck of cards before > printing the top five cards. I haven't quite got it down, but I was > wondering, did I need to add the highlighted line in my code or something > along those lines to indicate $element = pop (@deck) or is that what > I'm using "push" for? Now it does pop A H to the bottom of the deck. So what > exactly is it that I'm doing wrong? > > #!/usr/bin/perl -w > @deck = ("A H","2 H","3 H","4 H","5 H","6 H","7 H","8 H", > "9 H","10 H","J H","Q H","K H", > "A D","2 D","3 D","4 D","5 D","6 D","7 D","8 D", > "9 D","10 D","J D","Q D","K D", > "A C","2 C","3 C","4 C","5 C","6 C","7 C","8 C", > "9 C","10 C","J C","Q C","K C", > "A S","2 S","3 S","4 S","5 S","6 S","7 S","8 S", > "9 S","10 S","J S","Q S","K S"); > foreach my $card (@deck){ > chomp (@mydeck); push (@mydeck, pop(@mydeck)); push (@mydeck, shift(@mydeck)); print "Cards: $card\n" } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/kc/attachments/20080402/aad33b0a/attachment.html From davidnicol at gmail.com Wed Apr 2 13:45:04 2008 From: davidnicol at gmail.com (David Nicol) Date: Wed, 2 Apr 2008 15:45:04 -0500 Subject: [Kc] Shuffling a deck of cards... In-Reply-To: <38feac7e0804021310x117bbc81hb2bd2817c4131009@mail.gmail.com> References: <38feac7e0804021310x117bbc81hb2bd2817c4131009@mail.gmail.com> Message-ID: <934f64a20804021345r7209d54apc189b91711d4a858@mail.gmail.com> On Wed, Apr 2, 2008 at 3:10 PM, Emmanuel Mejias wrote: > My instructor has asked me Cool! perl in school! Do we have a list policy on homework? From emmanuel.mejias at gmail.com Wed Apr 2 16:24:03 2008 From: emmanuel.mejias at gmail.com (Emmanuel Mejias) Date: Wed, 2 Apr 2008 18:24:03 -0500 Subject: [Kc] Shuffling a deck of cards... In-Reply-To: <38feac7e0804021314y548fee66h4ee13c3735c5b413@mail.gmail.com> References: <38feac7e0804021310x117bbc81hb2bd2817c4131009@mail.gmail.com> <38feac7e0804021314y548fee66h4ee13c3735c5b413@mail.gmail.com> Message-ID: <38feac7e0804021624u402db66ay3c7a803e9ad64a9d@mail.gmail.com> okay...tweaked s'more...couldn't get it to print out 5, so let's hope he's okay with six. #!/usr/bin/perl -w @mydeck = ("A H","2 H","3 H","4 H","5 H","6 H","7 H","8 H", "9 H","10 H","J H","Q H","K H", "A D","2 D","3 D","4 D","5 D","6 D","7 D","8 D", "9 D","10 D","J D","Q D","K D", "A C","2 C","3 C","4 C","5 C","6 C","7 C","8 C", "9 C","10 C","J C","Q C","K C", "A S","2 S","3 S","4 S","5 S","6 S","7 S","8 S", "9 S","10 S","J S","Q S","K S"); @top5 = (); my $x = 0; while ($x <= 2){ push (@top5, shift(@mydeck)); push (@top5, pop(@mydeck)); $x++; } foreach $card (@top5){ print "$card\n"; } On Wed, Apr 2, 2008 at 3:14 PM, Emmanuel Mejias wrote: > I made the following changes.... > > On Wed, Apr 2, 2008 at 3:10 PM, Emmanuel Mejias > wrote: > > > My instructor has asked me to use the pop, shift, and push functions to > > write a script that sufficiently "shuffles" a simulated deck of cards before > > printing the top five cards. I haven't quite got it down, but I was > > wondering, did I need to add the highlighted line in my code or something > > along those lines to indicate $element = pop (@deck) or is that what > > I'm using "push" for? Now it does pop A H to the bottom of the deck. So what > > exactly is it that I'm doing wrong? > > > > #!/usr/bin/perl -w > > @deck = ("A H","2 H","3 H","4 H","5 H","6 H","7 H","8 H", > > "9 H","10 H","J H","Q H","K H", > > "A D","2 D","3 D","4 D","5 D","6 D","7 D","8 D", > > "9 D","10 D","J D","Q D","K D", > > "A C","2 C","3 C","4 C","5 C","6 C","7 C","8 C", > > "9 C","10 C","J C","Q C","K C", > > "A S","2 S","3 S","4 S","5 S","6 S","7 S","8 S", > > "9 S","10 S","J S","Q S","K S"); > > foreach my $card (@deck){ > > > chomp (@mydeck); > push (@mydeck, pop(@mydeck)); > push (@mydeck, shift(@mydeck)); > print "Cards: $card\n" > } > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/kc/attachments/20080402/7e00465e/attachment.html From emmanuel.mejias at gmail.com Wed Apr 2 17:20:31 2008 From: emmanuel.mejias at gmail.com (Emmanuel Mejias) Date: Wed, 2 Apr 2008 19:20:31 -0500 Subject: [Kc] Shuffling a deck of cards... In-Reply-To: <38feac7e0804021624u402db66ay3c7a803e9ad64a9d@mail.gmail.com> References: <38feac7e0804021310x117bbc81hb2bd2817c4131009@mail.gmail.com> <38feac7e0804021314y548fee66h4ee13c3735c5b413@mail.gmail.com> <38feac7e0804021624u402db66ay3c7a803e9ad64a9d@mail.gmail.com> Message-ID: <38feac7e0804021720o252dd687p9e3f9a2a2e7b1100@mail.gmail.com> And so I continue tweaking....but it's not returning any cards now. I can get 5 now, but no out put. not exactly sure what i'm missing now. On Wed, Apr 2, 2008 at 6:24 PM, Emmanuel Mejias wrote: > okay...tweaked s'more...couldn't get it to print out 5, so let's hope he's > okay with six. > > #!/usr/bin/perl -w > > @mydeck = ("A H","2 H","3 H","4 H","5 H","6 H","7 H","8 H", > "9 H","10 H","J H","Q H","K H", > "A D","2 D","3 D","4 D","5 D","6 D","7 D","8 D", > "9 D","10 D","J D","Q D","K D", > "A C","2 C","3 C","4 C","5 C","6 C","7 C","8 C", > "9 C","10 C","J C","Q C","K C", > "A S","2 S","3 S","4 S","5 S","6 S","7 S","8 S", > "9 S","10 S","J S","Q S","K S"); > > my $top5 = 0; > > foreach $card (@mydeck){ > push (@top5, shift(@mydeck)); > push (@top5, pop(@mydeck)); > } > while ($top5 <= 4) { > print "$card\n"; > $top5++; > } > > > > > On Wed, Apr 2, 2008 at 3:14 PM, Emmanuel Mejias > wrote: > > > I made the following changes.... > > > > On Wed, Apr 2, 2008 at 3:10 PM, Emmanuel Mejias < > > emmanuel.mejias at gmail.com> wrote: > > > > > My instructor has asked me to use the pop, shift, and push functions > > > to write a script that sufficiently "shuffles" a simulated deck of cards > > > before printing the top five cards. I haven't quite got it down, but I was > > > wondering, did I need to add the highlighted line in my code or something > > > along those lines to indicate $element = pop (@deck) or is that what > > > I'm using "push" for? Now it does pop A H to the bottom of the deck. So what > > > exactly is it that I'm doing wrong? > > > > > > #!/usr/bin/perl -w > > > @deck = ("A H","2 H","3 H","4 H","5 H","6 H","7 H","8 H", > > > "9 H","10 H","J H","Q H","K H", > > > "A D","2 D","3 D","4 D","5 D","6 D","7 D","8 D", > > > "9 D","10 D","J D","Q D","K D", > > > "A C","2 C","3 C","4 C","5 C","6 C","7 C","8 C", > > > "9 C","10 C","J C","Q C","K C", > > > "A S","2 S","3 S","4 S","5 S","6 S","7 S","8 S", > > > "9 S","10 S","J S","Q S","K S"); > > > foreach my $card (@deck){ > > > > > chomp (@mydeck); > > push (@mydeck, pop(@mydeck)); > > push (@mydeck, shift(@mydeck)); > > print "Cards: $card\n" > > } > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/kc/attachments/20080402/733de129/attachment-0001.html From davidnicol at gmail.com Wed Apr 2 18:57:56 2008 From: davidnicol at gmail.com (David Nicol) Date: Wed, 2 Apr 2008 20:57:56 -0500 Subject: [Kc] Shuffling a deck of cards... In-Reply-To: <38feac7e0804021720o252dd687p9e3f9a2a2e7b1100@mail.gmail.com> References: <38feac7e0804021310x117bbc81hb2bd2817c4131009@mail.gmail.com> <38feac7e0804021314y548fee66h4ee13c3735c5b413@mail.gmail.com> <38feac7e0804021624u402db66ay3c7a803e9ad64a9d@mail.gmail.com> <38feac7e0804021720o252dd687p9e3f9a2a2e7b1100@mail.gmail.com> Message-ID: <934f64a20804021857o4e4913c3u9b42aa221e9ca2d5@mail.gmail.com> > > > > My instructor has asked me to use the pop, shift, and push functions > to write a script that sufficiently "shuffles" a simulated deck of cards > before printing the top five cards. Here's a model of shuffling, like, err, shuffling. use strict; my @deck = qw/a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z/; my @right; my @left; SHUFFLE: unshift @left, pop @deck for 1..26; @right = @deck; @deck = (); while(@left or @right){ if (rand() < 0.5){ @left and push @deck, shift @left }else{ @right and push @deck, shift @right } }; # shuffle again? rand() < 0.9 and goto SHUFFLE; print "the top five cards are @deck[0..4]\n"; __END__ # shuffle again? rand() < 0.9 and goto SHUFFLE; print "the top five cards are @deck[0..4]\n"; __END__ From popefelix at gmail.com Thu Apr 3 09:15:59 2008 From: popefelix at gmail.com (Kit Peters) Date: Thu, 3 Apr 2008 11:15:59 -0500 Subject: [Kc] empty column_info in Catalyst auto-generated DBIC stuff? Message-ID: So I'm doing this project in Catalyst, per someone on this list's suggestion. And so far, I'm impressed. I dig Catalyst very much. But. I auto generated a model using the provided Catalyst tools, and it autogenerated a schema for me based on my database structure (which is ice hot, btw). I'm trying to do some nifty trickery based on the column_info method of DBIx::Class::ResultSource, but column_info is an empty hash. What gives? Is there something I can do to populate that hash? KP -- GPG public key fingerpint: 1A12 04B6 0C80 306A B292 14FD 2C7A 1037 F666 46A7 From davidnicol at gmail.com Thu Apr 3 11:44:32 2008 From: davidnicol at gmail.com (David Nicol) Date: Thu, 3 Apr 2008 13:44:32 -0500 Subject: [Kc] week of perl training plus possible perly employment opportunities (in Boston) Message-ID: <934f64a20804031144x1cc2783dga3d3e41ad562789e@mail.gmail.com> The non-Damian Conway track is free of charge, but you have to hitchhike across the adirondacks to get there or something Monday, April 28 through Friday, May 2, 2008. LinkedIn Uri Guttman has sent you a message. Date: 4/02/2008 Subject: Perl Training and Job Placement I am using LinkedIn to announce a new venture, The Perl College. The Perl College is a merger of a training program and a job fair. It offers a week of free intermediate level Perl training to junior Perl developers. It is sponsored by companies looking to hire these new trained developers. The classes are taught by Damian Conway, one of the foremost Perl trainers on the planet. There are also open seats that can be purchased for those who wish to take a week of Perl training taught by Damian Conway. These seats are $3,000 for the full week. My objective in writing this is to spread the word about The Perl College so please forward this onto anyone (linkedin contacts or otherwise) who would be interested in being a hiring sponsor or a student. If you know of any places to post the info or would like to post it yourself (e.g. on a blog) feel free to do so or contact me at uri AT perlhunter.com. You can get all the info about the perl college at: http://perlhunter.com/college.html Uri, Dean of The Perl College. -- bringing useful insights from Computer Science to the larger world From developer at peelle.org Thu Apr 3 12:35:35 2008 From: developer at peelle.org (developer at peelle.org) Date: Thu, 03 Apr 2008 15:35:35 -0400 Subject: [Kc] DBIx::Class or Class::DBI Message-ID: <6296866.613661207251335114.JavaMail.servlet@perfora> Hello all, Thanks in advance for your responces. My boss is doing the whole standardize thing. Luckily I have pretty well sealed the deal for us keeping Perl, and even using Catalyst. But What I was curious about was Which is better? DBIx::Class or Class::DBI. I read each one's description on cpan. and couln't pick out a clear advantage between them. Any advice would be a great help. Thanks, James Carman From popefelix at gmail.com Thu Apr 3 12:41:43 2008 From: popefelix at gmail.com (Kit Peters) Date: Thu, 3 Apr 2008 14:41:43 -0500 Subject: [Kc] DBIx::Class or Class::DBI In-Reply-To: <6296866.613661207251335114.JavaMail.servlet@perfora> References: <6296866.613661207251335114.JavaMail.servlet@perfora> Message-ID: I am personally enamoured with DBIC, and most of the Catalyst documentation that I'm seeing assumes DBIC. If I had to choose, I'd go with DBIC right now. KP On Thu, Apr 3, 2008 at 2:35 PM, wrote: > Hello all, > > > Thanks in advance for your responces. My boss is doing the whole standardize thing. Luckily I have pretty well sealed the deal for us keeping Perl, and even using Catalyst. But What I was curious about was Which is better? DBIx::Class or Class::DBI. I read each one's description on cpan. and couln't pick out a clear advantage between them. > > Any advice would be a great help. > > Thanks, > > James Carman > _______________________________________________ > kc mailing list > kc at pm.org > http://mail.pm.org/mailman/listinfo/kc > -- GPG public key fingerpint: 1A12 04B6 0C80 306A B292 14FD 2C7A 1037 F666 46A7 From sterling at hanenkamp.com Thu Apr 3 12:53:02 2008 From: sterling at hanenkamp.com (Andrew Hanenkamp) Date: Thu, 3 Apr 2008 14:53:02 -0500 Subject: [Kc] DBIx::Class or Class::DBI In-Reply-To: References: <6296866.613661207251335114.JavaMail.servlet@perfora> Message-ID: To quote the folks on #perl @ irc.freenode.net: 14:46:25 < zostay> can somebody summarize the diff between Classs::DBI and DBIx::Class? i want to make sure i remember correctly before answer a PM list message 14:49:28 < mst> zostay: DBIx::Class obsoletes Class::DBI 14:49:48 < cfedde> DBIx::Class works better. 14:50:03 < zostay> then my memory serves... :) 14:50:27 < mst> zostay: DBIx::Class also provides a full compatibility layer for Class::DBI, which in 08100 is better tested than Class::DBI and being maintained by Scgwern himself 14:51:35 < cfedde> s/cg/ch/ Cheers, Sterling (aka zostay) On Thu, Apr 3, 2008 at 2:41 PM, Kit Peters wrote: > I am personally enamoured with DBIC, and most of the Catalyst > documentation that I'm seeing assumes DBIC. If I had to choose, I'd > go with DBIC right now. > > KP > > On Thu, Apr 3, 2008 at 2:35 PM, wrote: > > Hello all, > > > > > > Thanks in advance for your responces. My boss is doing the whole > standardize thing. Luckily I have pretty well sealed the deal for us keeping > Perl, and even using Catalyst. But What I was curious about was Which is > better? DBIx::Class or Class::DBI. I read each one's description on cpan. > and couln't pick out a clear advantage between them. > > > > Any advice would be a great help. > > > > Thanks, > > > > James Carman > > _______________________________________________ > > kc mailing list > > kc at pm.org > > http://mail.pm.org/mailman/listinfo/kc > > > > > > -- > GPG public key fingerpint: 1A12 04B6 0C80 306A B292 14FD 2C7A 1037 F666 > 46A7 > _______________________________________________ > kc mailing list > kc at pm.org > http://mail.pm.org/mailman/listinfo/kc > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/kc/attachments/20080403/c618d2a3/attachment.html From developer at peelle.org Thu Apr 3 13:20:19 2008 From: developer at peelle.org (James Carman) Date: Thu, 03 Apr 2008 16:20:19 -0400 Subject: [Kc] DBIx::Class or Class::DBI Message-ID: <2011972.623671207254019823.JavaMail.servlet@perfora> Thanks! You all helped a lot. I think the boss is gonna pick DBIx::Class. ? To quote the folks on #perl @ irc.freenode.net: 14:46:25< zostay> can somebody summarize the diff between Classs::DBI andDBIx::Class? i want to make sure i remember correctly before answer aPM list message 14:49:28 < mst> zostay: DBIx::Class obsoletes Class::DBI 14:49:48 < cfedde> DBIx::Class works better. 14:50:03 < zostay> then my memory serves... :) 14:50:27< mst> zostay: DBIx::Class also provides a full compatibilitylayer for Class::DBI, which in 08100 is better tested than Class::DBIand being maintained ??????????????? by Scgwern himself 14:51:35 < cfedde> s/cg/ch/ Cheers, Sterling (aka zostay) On Thu, Apr 3, 2008 at 2:41 PM, Kit Peters wrote: I am personally enamoured with DBIC, and most of the Catalyst documentation that I'm seeing assumes DBIC. ?If I had to choose, I'd go with DBIC right now. KP On Thu, Apr 3, 2008 at 2:35 PM, ? wrote: > Hello all, > > > ? ? Thanks in advance for your responces. My boss is doing the whole standardize thing. Luckily I have pretty well sealed the deal for us keeping Perl, and even using Catalyst. But What I was curious about was Which is better? DBIx::Class or Class::DBI. I read each one's description on cpan. and couln't pick out a clear advantage between them. > > ?Any advice would be a great help. > > ?Thanks, > > ?James Carman > ?_______________________________________________ > ?kc mailing list > ?kc at pm.org > ?http://mail.pm.org/mailman/listinfo/kc > -- GPG public key fingerpint: 1A12 04B6 0C80 306A B292 ?14FD 2C7A 1037 F666 46A7 _______________________________________________ kc mailing list kc at pm.org http://mail.pm.org/mailman/listinfo/kc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/kc/attachments/20080403/fbf7da35/attachment.html From frank at wiles.org Fri Apr 4 14:40:32 2008 From: frank at wiles.org (Frank Wiles) Date: Fri, 4 Apr 2008 16:40:32 -0500 Subject: [Kc] DBIx::Class or Class::DBI In-Reply-To: <2011972.623671207254019823.JavaMail.servlet@perfora> References: <2011972.623671207254019823.JavaMail.servlet@perfora> Message-ID: <20080404164032.0278a99c.frank@wiles.org> On Thu, 03 Apr 2008 16:20:19 -0400 James Carman wrote: > Thanks! You all helped a lot. I think the boss is gonna pick > DBIx::Class. Just to echo everyone else, Class::DBI has some major issues with it in many different areas ( usability, useless error messages that increase debugging time 10x, performance, etc. ) The only reason to use Class::DBI at this point is legacy code, everyone is pretty much in agreement that DBIx::Class is the way to go these days. ------------------------------------------------------- Frank Wiles, Revolution Systems, LLC. Personal : frank at wiles.org http://www.wiles.org Work : frank at revsys.com http://www.revsys.com From sterling at hanenkamp.com Mon Apr 7 10:14:03 2008 From: sterling at hanenkamp.com (Andrew Hanenkamp) Date: Mon, 7 Apr 2008 12:14:03 -0500 Subject: [Kc] Andy Lester has offered to visit Message-ID: Hey guys, I was chatting with Andy Lester, main contributor to PerlBuzz.com and author of WWW::Mechanize, ack, Module::Starter, and others you've probably heard of or used. He's given talks at YAPC and OSCON as well. He's interested in coming down and possibly giving a presentation to KC.pm. He'd be willing to come for free since he's only 8-10 hours of driving away. I was just curious what others would think, especially such a proposal coming from a JAPH that's never attended a physical meeting. I'd probably use this as an opportunity to become involved, despite the long distance relationship (I live in Manhattan). If the group is interested, I think he'd want a place to present slides, so I'm not sure if the usual venue would work or not. He'd be likely to talk on his latest interest, which is rethinking CPAN (though, I haven't asked). This is a budding project intended at trying to redesign CPAN to more readily answer questions like the recent DBIx::Class versus Class::DBI question discussed last week on this list. Cheers, Sterling -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/kc/attachments/20080407/881c69bb/attachment.html From andy at petdance.com Mon Apr 7 10:16:45 2008 From: andy at petdance.com (Andy Lester) Date: Mon, 7 Apr 2008 12:16:45 -0500 Subject: [Kc] Andy Lester has offered to visit In-Reply-To: References: Message-ID: <5F2D9932-70C8-4B43-95F0-445F5E684E99@petdance.com> On Apr 7, 2008, at 12:14 PM, Andrew Hanenkamp wrote: > He'd be likely to talk on his latest interest, which is rethinking > CPAN (though, I haven't asked). More likely, he'd want to talk about whatever interested the group. I've talked about dozens of things, so would be glad to do whatever the group wanted (if it's in my area of expertise). xoxo, Andy -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From popefelix at gmail.com Mon Apr 7 10:59:51 2008 From: popefelix at gmail.com (Kit Peters) Date: Mon, 7 Apr 2008 12:59:51 -0500 Subject: [Kc] Andy Lester has offered to visit In-Reply-To: <5F2D9932-70C8-4B43-95F0-445F5E684E99@petdance.com> References: <5F2D9932-70C8-4B43-95F0-445F5E684E99@petdance.com> Message-ID: But would he be talking about himself in the third person all the time? 'Cos Kit Peters tells you, that shit gets old. At least in his opinion it does. KP On Mon, Apr 7, 2008 at 12:16 PM, Andy Lester wrote: > More likely, he'd want to talk about whatever interested the group. -- GPG public key fingerpint: 1A12 04B6 0C80 306A B292 14FD 2C7A 1037 F666 46A7 From randall.munden at gmail.com Mon Apr 7 11:07:16 2008 From: randall.munden at gmail.com (Randall Munden) Date: Mon, 7 Apr 2008 13:07:16 -0500 Subject: [Kc] Andy Lester has offered to visit In-Reply-To: <5F2D9932-70C8-4B43-95F0-445F5E684E99@petdance.com> References: <5F2D9932-70C8-4B43-95F0-445F5E684E99@petdance.com> Message-ID: <1467780a0804071107n2ff91d20t58b1f4506da5a055@mail.gmail.com> I had the pleasure of conversing with Andy on a couple of evenings when I was at YAPC NA Buffalo several years ago. Although, I picked up a few tricks at the conference, speaking with Andy is the experience that sticks out most in my mind (along with that of the London pmers in the hotel bar). He is an excellent speaker (and thinker) and can converse well on many subjects. I would be delighted to lend a hand to help kc.pm host him. On Mon, Apr 7, 2008 at 12:16 PM, Andy Lester wrote: > > On Apr 7, 2008, at 12:14 PM, Andrew Hanenkamp wrote: > > He'd be likely to talk on his latest interest, which is rethinking > > CPAN (though, I haven't asked). > > > More likely, he'd want to talk about whatever interested the group. > I've talked about dozens of things, so would be glad to do whatever > the group wanted (if it's in my area of expertise). > > xoxo, > Andy > > -- > Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance > > > > > _______________________________________________ > kc mailing list > kc at pm.org > http://mail.pm.org/mailman/listinfo/kc > --rjm-- -- Any sufficiently advanced incompetence is indistinguishable from malice. http://www.librarything.com/profile/blather From paul.millard at gmail.com Mon Apr 7 14:11:53 2008 From: paul.millard at gmail.com (Paul Millard) Date: Mon, 7 Apr 2008 16:11:53 -0500 Subject: [Kc] kc Digest, Vol 54, Issue 7 In-Reply-To: References: Message-ID: <521c89c20804071411s71305fd5o56c766b7b8994572@mail.gmail.com> Eric Dillon and myself had the opportunity to sit and talk with him on many occasions at OSCON 03, and 04, he has very no nonsense way of discussing technical Perl issues to discussing hubris, laziness, arrogance, work ethic, etc. as he hires/interviews quite a few folks as we were discussing the changing Perl job market. I'd love the opportunity to help in hosting him and be a part of it. I realize we don't have a budget, but we could discuss with Barleys or a smaller location, the ability to use a meeting room and find someone with a project. Paul Millard On Mon, Apr 7, 2008 at 2:00 PM, wrote: > Send kc mailing list submissions to > kc at pm.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.pm.org/mailman/listinfo/kc > or, via email, send a message with subject or body 'help' to > kc-request at pm.org > > You can reach the person managing the list at > kc-owner at pm.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of kc digest..." > > > Today's Topics: > > 1. Andy Lester has offered to visit (Andrew Hanenkamp) > 2. Re: Andy Lester has offered to visit (Andy Lester) > 3. Re: Andy Lester has offered to visit (Kit Peters) > 4. Re: Andy Lester has offered to visit (Randall Munden) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Mon, 7 Apr 2008 12:14:03 -0500 > From: "Andrew Hanenkamp" > Subject: [Kc] Andy Lester has offered to visit > To: kc > Message-ID: > > Content-Type: text/plain; charset="iso-8859-1" > > Hey guys, > > I was chatting with Andy Lester, main contributor to PerlBuzz.com and > author > of WWW::Mechanize, ack, Module::Starter, and others you've probably heard > of > or used. He's given talks at YAPC and OSCON as well. He's interested in > coming down and possibly giving a presentation to KC.pm. He'd be willing > to > come for free since he's only 8-10 hours of driving away. > > I was just curious what others would think, especially such a proposal > coming from a JAPH that's never attended a physical meeting. I'd probably > use this as an opportunity to become involved, despite the long distance > relationship (I live in Manhattan). > > If the group is interested, I think he'd want a place to present slides, > so > I'm not sure if the usual venue would work or not. He'd be likely to talk > on > his latest interest, which is rethinking CPAN (though, I haven't asked). > This is a budding project intended at trying to redesign CPAN to more > readily answer questions like the recent DBIx::Class versus Class::DBI > question discussed last week on this list. > > Cheers, > Sterling > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: > http://mail.pm.org/pipermail/kc/attachments/20080407/881c69bb/attachment-0001.html > > ------------------------------ > > Message: 2 > Date: Mon, 7 Apr 2008 12:16:45 -0500 > From: Andy Lester > Subject: Re: [Kc] Andy Lester has offered to visit > To: "Andrew Hanenkamp" > Cc: kc > Message-ID: <5F2D9932-70C8-4B43-95F0-445F5E684E99 at petdance.com> > Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes > > > On Apr 7, 2008, at 12:14 PM, Andrew Hanenkamp wrote: > > He'd be likely to talk on his latest interest, which is rethinking > > CPAN (though, I haven't asked). > > > More likely, he'd want to talk about whatever interested the group. > I've talked about dozens of things, so would be glad to do whatever > the group wanted (if it's in my area of expertise). > > xoxo, > Andy > > -- > Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance > > > > > > > ------------------------------ > > Message: 3 > Date: Mon, 7 Apr 2008 12:59:51 -0500 > From: "Kit Peters" > Subject: Re: [Kc] Andy Lester has offered to visit > To: "Andy Lester" > Cc: kc > Message-ID: > > Content-Type: text/plain; charset=UTF-8 > > But would he be talking about himself in the third person all the > time? 'Cos Kit Peters tells you, that shit gets old. At least in his > opinion it does. > > KP > > On Mon, Apr 7, 2008 at 12:16 PM, Andy Lester wrote: > > > More likely, he'd want to talk about whatever interested the group. > > -- > GPG public key fingerpint: 1A12 04B6 0C80 306A B292 14FD 2C7A 1037 F666 > 46A7 > > > ------------------------------ > > Message: 4 > Date: Mon, 7 Apr 2008 13:07:16 -0500 > From: "Randall Munden" > Subject: Re: [Kc] Andy Lester has offered to visit > To: kc > Message-ID: > <1467780a0804071107n2ff91d20t58b1f4506da5a055 at mail.gmail.com> > Content-Type: text/plain; charset=ISO-8859-1 > > I had the pleasure of conversing with Andy on a couple of evenings > when I was at YAPC NA Buffalo several years ago. Although, I picked > up a few tricks at the conference, speaking with Andy is the > experience that sticks out most in my mind (along with that of the > London pmers in the hotel bar). > > He is an excellent speaker (and thinker) and can converse well on many > subjects. I would be delighted to lend a hand to help kc.pm host him. > > On Mon, Apr 7, 2008 at 12:16 PM, Andy Lester wrote: > > > > On Apr 7, 2008, at 12:14 PM, Andrew Hanenkamp wrote: > > > He'd be likely to talk on his latest interest, which is rethinking > > > CPAN (though, I haven't asked). > > > > > > More likely, he'd want to talk about whatever interested the group. > > I've talked about dozens of things, so would be glad to do whatever > > the group wanted (if it's in my area of expertise). > > > > xoxo, > > Andy > > > > -- > > Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance > > > > > > > > > > _______________________________________________ > > kc mailing list > > kc at pm.org > > http://mail.pm.org/mailman/listinfo/kc > > > > --rjm-- > -- Any sufficiently advanced incompetence is indistinguishable from > malice. > > http://www.librarything.com/profile/blather > > > ------------------------------ > > _______________________________________________ > kc mailing list > kc at pm.org > http://mail.pm.org/mailman/listinfo/kc > > End of kc Digest, Vol 54, Issue 7 > ********************************* > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/kc/attachments/20080407/981540c2/attachment.html From andy at petdance.com Mon Apr 7 14:14:56 2008 From: andy at petdance.com (Andy Lester) Date: Mon, 7 Apr 2008 16:14:56 -0500 Subject: [Kc] kc Digest, Vol 54, Issue 7 In-Reply-To: <521c89c20804071411s71305fd5o56c766b7b8994572@mail.gmail.com> References: <521c89c20804071411s71305fd5o56c766b7b8994572@mail.gmail.com> Message-ID: <86434848-F3C2-416E-B8D0-13FCD5AC388C@petdance.com> On Apr 7, 2008, at 4:11 PM, Paul Millard wrote: > Eric Dillon and myself had the opportunity to sit and talk with him > on many occasions at OSCON 03, and 04, he has very no nonsense way > of discussing technical Perl issues to discussing hubris, laziness, > arrogance, work ethic, etc. as he hires/interviews quite a few folks > as we were discussing the changing Perl job market. Thanks for the kind words. I'm also working on a book for tech people on how to get hired, based on a lot of the talks I've given over the years. -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From djgoku at gmail.com Mon Apr 7 14:28:46 2008 From: djgoku at gmail.com (djgoku) Date: Mon, 7 Apr 2008 16:28:46 -0500 Subject: [Kc] Andy Lester has offered to visit In-Reply-To: References: Message-ID: <99dd19c90804071428m57d7ad88rd82358e32f070e4e@mail.gmail.com> On Mon, Apr 7, 2008 at 12:14 PM, Andrew Hanenkamp wrote: > Hey guys, > > I was chatting with Andy Lester, main contributor to PerlBuzz.com and author > of WWW::Mechanize, ack, Module::Starter, and others you've probably heard of > or used. He's given talks at YAPC and OSCON as well. He's interested in > coming down and possibly giving a presentation to KC.pm. He'd be willing to > come for free since he's only 8-10 hours of driving away. > > I was just curious what others would think, especially such a proposal > coming from a JAPH that's never attended a physical meeting. I'd probably > use this as an opportunity to become involved, despite the long distance > relationship (I live in Manhattan). > > If the group is interested, I think he'd want a place to present slides, so > I'm not sure if the usual venue would work or not. He'd be likely to talk on > his latest interest, which is rethinking CPAN (though, I haven't asked). > This is a budding project intended at trying to redesign CPAN to more > readily answer questions like the recent DBIx::Class versus Class::DBI > question discussed last week on this list. I would be up for a presenter. The Kansas City Public Library (Downtown) has very nice executive style chairs (seating for ~10-15) and a projector to use. It wouldn't be to hard to book one of those rooms for an event. Jonathan From developer at peelle.org Mon Apr 7 20:48:42 2008 From: developer at peelle.org (James Carman) Date: Mon, 07 Apr 2008 23:48:42 -0400 Subject: [Kc] Andy Lester has offered to visit Message-ID: <12634484.6512901207626522826.JavaMail.servlet@perfora> Hey guys, I know I am new to the list(so new I haven't been to a meeting), but I am interested. James J. Carman From stephenclouse at gmail.com Tue Apr 8 10:52:51 2008 From: stephenclouse at gmail.com (Stephen Clouse) Date: Tue, 8 Apr 2008 12:52:51 -0500 Subject: [Kc] Meeting tonight? Message-ID: <5d0ee2170804081052m1f02a6d6r3b5e56e580f97202@mail.gmail.com> That's what my calendar says. Still at Barley's in Shawnee? -- Stephen Clouse -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/kc/attachments/20080408/ce257ba4/attachment-0001.html From djgoku at gmail.com Tue Apr 8 12:49:10 2008 From: djgoku at gmail.com (djgoku) Date: Tue, 8 Apr 2008 14:49:10 -0500 Subject: [Kc] Meeting tonight? In-Reply-To: <5d0ee2170804081052m1f02a6d6r3b5e56e580f97202@mail.gmail.com> References: <5d0ee2170804081052m1f02a6d6r3b5e56e580f97202@mail.gmail.com> Message-ID: <99dd19c90804081249p60ef3fd4lf1750da155527f9a@mail.gmail.com> On Tue, Apr 8, 2008 at 12:52 PM, Stephen Clouse wrote: > That's what my calendar says. Still at Barley's in Shawnee? I think Barley's is the current default meeting place. I won't be there though. Jonathan From amoore at mooresystems.com Tue Apr 8 14:25:07 2008 From: amoore at mooresystems.com (Andrew Moore) Date: Tue, 8 Apr 2008 16:25:07 -0500 Subject: [Kc] Meeting tonight? In-Reply-To: <5d0ee2170804081052m1f02a6d6r3b5e56e580f97202@mail.gmail.com> References: <5d0ee2170804081052m1f02a6d6r3b5e56e580f97202@mail.gmail.com> Message-ID: <20080408212507.GA1469@mooresystems.com> Hi Stephen - I unfortunately just got back in town last night from a long trip. I had in my mind that it was next week, and I'm not going to be able to make it. Anyone else planning on heading out? -Andy On Tue, Apr 08, 2008 at 12:52:51PM -0500, Stephen Clouse wrote: > That's what my calendar says. Still at Barley's in Shawnee? > From stephenclouse at gmail.com Tue Apr 8 14:19:30 2008 From: stephenclouse at gmail.com (Stephen Clouse) Date: Tue, 8 Apr 2008 16:19:30 -0500 Subject: [Kc] Meeting tonight? In-Reply-To: <20080408212507.GA1469@mooresystems.com> References: <5d0ee2170804081052m1f02a6d6r3b5e56e580f97202@mail.gmail.com> <20080408212507.GA1469@mooresystems.com> Message-ID: <5d0ee2170804081419q4f410ed3q13d05337b1fc6065@mail.gmail.com> Well, I can't say this sounds too promising. I guess I'll pass on tonight -- I have a friend that wants to do something. -- Stephen Clouse -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/kc/attachments/20080408/cb0524c8/attachment.html From randall.munden at gmail.com Tue Apr 8 15:54:25 2008 From: randall.munden at gmail.com (Randall Munden) Date: Tue, 8 Apr 2008 17:54:25 -0500 Subject: [Kc] Meeting tonight? In-Reply-To: <5d0ee2170804081419q4f410ed3q13d05337b1fc6065@mail.gmail.com> References: <5d0ee2170804081052m1f02a6d6r3b5e56e580f97202@mail.gmail.com> <20080408212507.GA1469@mooresystems.com> <5d0ee2170804081419q4f410ed3q13d05337b1fc6065@mail.gmail.com> Message-ID: <1467780a0804081554o476445e2tcb01c3f559f50a7b@mail.gmail.com> I guess that's that. See everyone next month? On Tue, Apr 8, 2008 at 4:19 PM, Stephen Clouse wrote: > Well, I can't say this sounds too promising. I guess I'll pass on tonight > -- I have a friend that wants to do something. > > > > -- > Stephen Clouse > _______________________________________________ > kc mailing list > kc at pm.org > http://mail.pm.org/mailman/listinfo/kc > --rjm-- -- Any sufficiently advanced incompetence is indistinguishable from malice. http://www.librarything.com/profile/blather From developer at peelle.org Wed Apr 9 10:14:33 2008 From: developer at peelle.org (James Carman) Date: Wed, 09 Apr 2008 13:14:33 -0400 Subject: [Kc] subroutine parameter list Message-ID: <26576192.71001207761273280.JavaMail.servlet@perfora> Hey all, Is it possible to do something like: ¶m_test("somestring", "another_string" $arrayref); sub param_test($tom; $george; @$array) { print $tom; ....; } ################# I am wanting to Specifiy how many arguments to take. Also I want to specify the name of the arguments. And also if possible the type of the arguments. Thanks! James J. Carman From frank at wiles.org Wed Apr 9 10:38:34 2008 From: frank at wiles.org (Frank Wiles) Date: Wed, 9 Apr 2008 12:38:34 -0500 Subject: [Kc] subroutine parameter list In-Reply-To: <26576192.71001207761273280.JavaMail.servlet@perfora> References: <26576192.71001207761273280.JavaMail.servlet@perfora> Message-ID: <20080409123834.7e99745b.frank@wiles.org> On Wed, 09 Apr 2008 13:14:33 -0400 James Carman wrote: > Hey all, > > Is it possible to do something like: > > > ¶m_test("somestring", "another_string" $arrayref); > > sub param_test($tom; $george; @$array) { > print $tom; > ....; > } Hi James, You can do: sub param_test ($$$) { my ( $tom, $george, $array_ref ) = @_; } That will ensure that three scalars are passed in. However, using subroutine parameter checking like this isn't considered a best practice. Check out the Prototypes section of 'man perlsub' if you want more info on it. ------------------------------------------------------- Frank Wiles, Revolution Systems, LLC. Personal : frank at wiles.org http://www.wiles.org Work : frank at revsys.com http://www.revsys.com From davidnicol at gmail.com Wed Apr 9 11:03:13 2008 From: davidnicol at gmail.com (David Nicol) Date: Wed, 9 Apr 2008 13:03:13 -0500 Subject: [Kc] subroutine parameter list In-Reply-To: <20080409123834.7e99745b.frank@wiles.org> References: <26576192.71001207761273280.JavaMail.servlet@perfora> <20080409123834.7e99745b.frank@wiles.org> Message-ID: <934f64a20804091103x9d568a5raa9431258c9cf152@mail.gmail.com> if you're really adventurous you could write a Macrame macro, but at this point that would probably be counterproductive (as you would lose all line number information) -- bringing useful insights from Computer Science to the larger world From andy at petdance.com Wed Apr 9 11:39:30 2008 From: andy at petdance.com (Andy Lester) Date: Wed, 9 Apr 2008 13:39:30 -0500 Subject: [Kc] subroutine parameter list In-Reply-To: <26576192.71001207761273280.JavaMail.servlet@perfora> References: <26576192.71001207761273280.JavaMail.servlet@perfora> Message-ID: On Apr 9, 2008, at 12:14 PM, James Carman wrote: > Hey all, > > Is it possible to do something like: > > > ¶m_test("somestring", "another_string" $arrayref); > > sub param_test($tom; $george; @$array) { > print $tom; > ....; > } Probably the "standard"ish way to do it is with Params::Validate. It's a runtime check, though, not a compile-time check. -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From sterling at hanenkamp.com Wed Apr 9 12:29:56 2008 From: sterling at hanenkamp.com (Andrew Hanenkamp) Date: Wed, 9 Apr 2008 14:29:56 -0500 Subject: [Kc] subroutine parameter list In-Reply-To: <26576192.71001207761273280.JavaMail.servlet@perfora> References: <26576192.71001207761273280.JavaMail.servlet@perfora> Message-ID: On Wed, Apr 9, 2008 at 12:14 PM, James Carman wrote: > Hey all, > > Is it possible to do something like: > > > ¶m_test("somestring", "another_string" $arrayref); > > sub param_test($tom; $george; @$array) { > print $tom; > ....; > } > > > ################# > I am wanting to Specifiy how many arguments to take. Also I want to > specify the name of the arguments. And also if possible the type of the > arguments. Perl's concept of a subroutine prototype is unusual and there are some purists who will tell you to never use them. I think they are helpful when used carefully. In this case, this is about the best you can do: sub param_test($$\@) { my ($tom, $george, $array_param) = @_; ... } You would then call the subroutine (make sure you *don't* use ¶m_test() or Perl will ignore the prototype): param_test("somestring", "otherstring", @array); The other alternative would be to declare param_test() like this: sub param_test($$@) { my ($tom, $george, @array_param) = @_; ... } This could be called exactly the same way as before. The significant difference between the two is that in the first one, the $array_param variable is actually a references to the \@array passed, which means you can modify it in place. In the second case, you don't have a direct reference to the @array value to modify. The good thing is that if you call param_test() this way, it will warn you during compile that something isn't right when you try to use it without three parameters, specifically two scalars followed by an array. That's about it for compile time checking. For more details, you can see the "Prototypes" section of perlsub ( http://search.cpan.org/search?query=perlsub&mode=all). If you want robust runtime checking, I second Andy's recommendation of Param::Validate. Cheers, Andrew -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/kc/attachments/20080409/699bcb05/attachment.html From popefelix at gmail.com Wed Apr 9 12:39:34 2008 From: popefelix at gmail.com (Kit Peters) Date: Wed, 9 Apr 2008 14:39:34 -0500 Subject: [Kc] subroutine parameter list In-Reply-To: References: <26576192.71001207761273280.JavaMail.servlet@perfora> Message-ID: Is there some compelling reason you can't just pass your parameters as a hashref? param_test({tom => "somestring", george => "anotherstring", ref => \@array}); sub param_test { my $args = shift; croak "Usage: param_test($hashref)" unless ref $args eq 'HASH'; .... } On Wed, Apr 9, 2008 at 2:29 PM, Andrew Hanenkamp wrote: > On Wed, Apr 9, 2008 at 12:14 PM, James Carman wrote: > > > Hey all, > > > > Is it possible to do something like: > > > > > > ¶m_test("somestring", "another_string" $arrayref); > > > > sub param_test($tom; $george; @$array) { > > print $tom; > > ....; > > } > > > > > > ################# > > I am wanting to Specifiy how many arguments to take. Also I want to > specify the name of the arguments. And also if possible the type of the > arguments. > > Perl's concept of a subroutine prototype is unusual and there are some > purists who will tell you to never use them. I think they are helpful when > used carefully. In this case, this is about the best you can do: > > sub param_test($$\@) { > my ($tom, $george, $array_param) = @_; > ... > } > > You would then call the subroutine (make sure you *don't* use ¶m_test() > or Perl will ignore the prototype): > > param_test("somestring", "otherstring", @array); > > The other alternative would be to declare param_test() like this: > > sub param_test($$@) { > my ($tom, $george, @array_param) = @_; > ... > } > > This could be called exactly the same way as before. The significant > difference between the two is that in the first one, the $array_param > variable is actually a references to the \@array passed, which means you can > modify it in place. In the second case, you don't have a direct reference to > the @array value to modify. > > The good thing is that if you call param_test() this way, it will warn you > during compile that something isn't right when you try to use it without > three parameters, specifically two scalars followed by an array. > > That's about it for compile time checking. For more details, you can see the > "Prototypes" section of perlsub > (http://search.cpan.org/search?query=perlsub&mode=all). If you want robust > runtime checking, I second Andy's recommendation of Param::Validate. > > Cheers, > Andrew > > _______________________________________________ > kc mailing list > kc at pm.org > http://mail.pm.org/mailman/listinfo/kc > -- GPG public key fingerpint: 1A12 04B6 0C80 306A B292 14FD 2C7A 1037 F666 46A7 From developer at peelle.org Wed Apr 9 13:04:54 2008 From: developer at peelle.org (James Carman) Date: Wed, 09 Apr 2008 16:04:54 -0400 Subject: [Kc] subroutine parameter list Message-ID: <1333099.106951207771494125.JavaMail.servlet@perfora> > Is there some compelling reason you can't just pass your parameters as > a hashref? A good reason? No. I am just attempting to learn about Perl(limitations and features) and appease certain other developers who can't seem to get past what they are used to. Thanks everyone for your responses. They did help. James J. Carman From davidnicol at gmail.com Wed Apr 9 14:14:11 2008 From: davidnicol at gmail.com (David Nicol) Date: Wed, 9 Apr 2008 16:14:11 -0500 Subject: [Kc] subroutine parameter list In-Reply-To: References: <26576192.71001207761273280.JavaMail.servlet@perfora> Message-ID: <934f64a20804091414v514897c7v766053be10839044@mail.gmail.com> On Wed, Apr 9, 2008 at 2:39 PM, Kit Peters wrote: > Is there some compelling reason you can't just pass your parameters as > a hashref? > > param_test({tom => "somestring", george => "anotherstring", ref => \@array}); > > sub param_test { > my $args = shift; > croak "Usage: param_test($hashref)" unless ref $args eq 'HASH'; > .... > > > } as I understand it the best practice for readability is param_test(tom => "somestring", george => "anotherstring", ref => \@array); sub param_test { my %args = @_; croak < References: <26576192.71001207761273280.JavaMail.servlet@perfora> <934f64a20804091414v514897c7v766053be10839044@mail.gmail.com> Message-ID: <2FBD81BD-89A6-4E7C-B127-BA4E651DE849@petdance.com> On Apr 9, 2008, at 4:14 PM, David Nicol wrote: > as I understand it the best practice for readability is > > param_test(tom => "somestring", george => "anotherstring", ref => > \@array); > > sub param_test { > my %args = @_; > croak < george ref/; > please refer to thread on KCLUG mailing list > INSTRUCTIONS > ... Roughly, yes, but Params::Validate encapsulates all that. -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From scratchcomputing at gmail.com Wed Apr 9 16:38:30 2008 From: scratchcomputing at gmail.com (Eric Wilhelm) Date: Wed, 9 Apr 2008 16:38:30 -0700 Subject: [Kc] subroutine parameter list In-Reply-To: <26576192.71001207761273280.JavaMail.servlet@perfora> References: <26576192.71001207761273280.JavaMail.servlet@perfora> Message-ID: <200804091638.30668.ewilhelm@cpan.org> # from James Carman # on Wednesday 09 April 2008 10:14: >Is it possible to do something like: > ¶m_test("somestring", "another_string" $arrayref); Ironically, prefixing the call with '&' bypasses what little prototyping support Perl has. I'm curious, where did you get the habit of writing your calls that way? In general, where does anybody get that habit? If it is a book, please do us all a favor and take that book to your local recycling center at your earliest convenience. :-D --Eric -- The reasonable man adapts himself to the world; the unreasonable man persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man. --George Bernard Shaw --------------------------------------------------- http://scratchcomputing.com --------------------------------------------------- From developer at peelle.org Thu Apr 10 09:49:46 2008 From: developer at peelle.org (James Carman) Date: Thu, 10 Apr 2008 12:49:46 -0400 Subject: [Kc] subroutine parameter list Message-ID: <3410367.36781207846186485.JavaMail.servlet@perfora> > Ironically, prefixing the call with '&' bypasses what little prototyping > support Perl has. I did not know that. Thanks for the info. Sounds like we need to add some good practice rules around here. > I'm curious, where did you get the habit of writing your calls that way? > In general, where does anybody get that habit? If it is a book, please > do us all a favor and take that book to your local recycling center at > your earliest convenience. :-D Actually Yes. The subroutine chapter of Learning Perl(The O'reilly one.) uses '&' in front of all of it's called subroutines. :-D Do you think someone should e-mail Phoenix, or Schwartz about that for future editions? Thanks, James J. Carman From andy at petdance.com Thu Apr 10 09:52:24 2008 From: andy at petdance.com (Andy Lester) Date: Thu, 10 Apr 2008 11:52:24 -0500 Subject: [Kc] subroutine parameter list In-Reply-To: <3410367.36781207846186485.JavaMail.servlet@perfora> References: <3410367.36781207846186485.JavaMail.servlet@perfora> Message-ID: <953EE3F7-D12D-489F-A807-A36432947073@petdance.com> On Apr 10, 2008, at 11:49 AM, James Carman wrote: >> Ironically, prefixing the call with '&' bypasses what little >> prototyping >> support Perl has. > > I did not know that. Thanks for the info. Sounds like we need to add > some good practice rules around here. Plus, calling any subroutine as a method call bypasses the prototyping as well. -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From popefelix at gmail.com Wed Apr 16 13:05:49 2008 From: popefelix at gmail.com (Kit Peters) Date: Wed, 16 Apr 2008 15:05:49 -0500 Subject: [Kc] Anybody need a job? Message-ID: The outfit I'm contracting for, Virtumundo, is looking for a Perl/PHP programmer. If you're interested, email me your resume at popefelix at gmail.com, with "Virtumundo job" in the subject line. I'd give you my VM email address, but the mailer seems to be blocking it even when it's in the message body. :( KP -- GPG public key fingerpint: 1A12 04B6 0C80 306A B292 14FD 2C7A 1037 F666 46A7 From sterling at hanenkamp.com Wed Apr 16 13:11:48 2008 From: sterling at hanenkamp.com (Andrew Hanenkamp) Date: Wed, 16 Apr 2008 15:11:48 -0500 Subject: [Kc] Anybody need a job? In-Reply-To: References: Message-ID: "Perl/PHP programmer": That's a pretty broad category What would this person do? On 4/16/08, Kit Peters wrote: > > The outfit I'm contracting for, Virtumundo, is looking for a Perl/PHP > programmer. If you're interested, email me your resume at > popefelix at gmail.com, with "Virtumundo job" in the subject line. I'd > give you my VM email address, but the mailer seems to be blocking it > even when it's in the message body. :( > > KP > > > -- > GPG public key fingerpint: 1A12 04B6 0C80 306A B292 14FD 2C7A 1037 F666 > 46A7 > _______________________________________________ > kc mailing list > kc at pm.org > http://mail.pm.org/mailman/listinfo/kc > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/kc/attachments/20080416/479fd596/attachment.html From popefelix at gmail.com Thu Apr 17 06:46:10 2008 From: popefelix at gmail.com (Kit Peters) Date: Thu, 17 Apr 2008 08:46:10 -0500 Subject: [Kc] Anybody need a job? In-Reply-To: References: Message-ID: On Wed, Apr 16, 2008 at 3:11 PM, Andrew Hanenkamp wrote: > "Perl/PHP programmer": That's a pretty broad category What would this person > do? Write Perl and PHP. :) Seriously, that's all I know right now. KP -- GPG public key fingerpint: 1A12 04B6 0C80 306A B292 14FD 2C7A 1037 F666 46A7