From schwern at pobox.com Fri Dec 5 18:52:53 2003 From: schwern at pobox.com (Michael G Schwern) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Good, Cheap T1 Fwd: [dougw@pdx.net: Geeklist -- T1 Service Anyone?] Message-ID: <20031206005252.GA9622@windhund.schwern.org> Thought folks here mind find this drool-worthy. $300/month (+ local loop) T1 from a good ISP. Reply to Doug Westervelt ----- Forwarded message from Doug Westervelt ----- From: Doug Westervelt Date: Fri, 05 Dec 2003 16:46:19 -0800 To: geeklist@geekhouse.org Subject: Geeklist -- T1 Service Anyone? Gang, This may border on advertisement, but we need to pump up some revenues so I'm going out on a limb. We're about to add capacity (thanks, ELI!) to provide very inexpensive Internet Access T1 service. By inexpensive, I mean $299/mo plus local loop for a full T1 of Internet Access. How much does a local loop cost? Well, if you're in an ELI-lit building downtown, as little as about $50/mo. If you're on Hawthorne and we use Qwest, then more like $180/mo. If you're in Gresham on Verizon, then like $362/mo. But considering that it's a full T1 at between $349/mo and $661/mo depending on your geography, that's still a screaming deal. Help us add new T1 customers. If you're in the position of recommending network services, we'll figure out a sweet referral bonus if you're interested... Sorry if I've crossed the line here. Must add customers! doug . ==================================================================== = GEekList -- GeEk oF thE WorLd UniTed -- Techie forum = ==================================================================== . ----- End forwarded message ----- -- Michael G Schwern schwern@pobox.com http://www.pobox.com/~schwern/ Is there an airport nearby or is that just my tae-kwon-do taking off? From kyle at cepaso.com Fri Dec 5 19:28:42 2003 From: kyle at cepaso.com (Kyle Dawkins) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Perl Job in Hood River Message-ID: <8714D115-278B-11D8-A8AA-000393A6C1D2@cepaso.com> Hi guys Thought I'd drop this on the list. Action without Borders, a New York-based nonprofit, is looking to hire a perl programmer to work full time in Hood River. It's a junior/intermediate position, so they're looking for someone who is smart and ready to learn rather than a perl guru. It's not a contract position, so only applicants for full time work will be looked at. Also, it must be in Hood River, and telecommuting is not an option. There are good reasons for this. The work will focus primarily on their fairly expansive website, http://www.idealist.org Most of you will (probably!) be overqualified and beyond their price range, but if you know of anyone who fits the bill, let me know! Cheers Kyle kyle@cepaso.com Here's their posting: ===================================== We are looking for a new programmer to work on Idealist, and we would like him or her to work in Hood River, Oregon. So - do you know anyone in the area who: * Has done some complex Web programming (Idealist is written in mod_perl, but if someone has worked in Perl, Java, or C, we'd be happy to look at their resume.) * Is both smart and nice, and is willing to learn fast. * Would be happy to work in Hood River. From jkeroes at eli.net Mon Dec 8 13:54:18 2003 From: jkeroes at eli.net (Joshua Keroes) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Dec meeting - This Wednesday Message-ID: <20031208195418.GB18374@eli.net> The next Portland Perl Mongers meeting is here. It's at my house. It will be warm and cozy. It's WIFI-enabled. BYOB. It will be about modules. If you've written a module and would like to talk about it, this meeting is for you. I will talk about Resource::Loader and possibly more, depending on turnout. What: Your modules When: This Weds, Dec 10 6:30 - 8:30 or whenever. Where: Maps and directions are at http://keroes.com/pdxpm/ . Use this directions, none other! Mapquest, et al are *wrong*. See you there, Joshua From cfeskens at willamette.edu Mon Dec 8 16:18:13 2003 From: cfeskens at willamette.edu (Casey J Feskens) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Dec meeting - This Wednesday In-Reply-To: <20031208195418.GB18374@eli.net> Message-ID: On Mon, 8 Dec 2003, Joshua Keroes wrote: > The next Portland Perl Mongers meeting is here. > > It's at my house. It will be warm and cozy. It's WIFI-enabled. BYOB. > > It will be about modules. If you've written a module and would like to > talk about it, this meeting is for you. I will talk about > Resource::Loader and possibly more, depending on turnout. > > > What: Your modules > When: This Weds, Dec 10 6:30 - 8:30 or whenever. > Where: Maps and directions are at http://keroes.com/pdxpm/ . Use this > directions, none other! Mapquest, et al are *wrong*. > Joshua, Do the directions differ if you are taking I-5 Northbound? Some of us country bumpkins might want to attend. --------------------------------------------- Casey Feskens System Administrator/Network Svcs. Consultant Willamette University, Salem, OR --------------------------------------------- From schwern at pobox.com Mon Dec 8 16:24:52 2003 From: schwern at pobox.com (Michael G Schwern) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Dec meeting - This Wednesday In-Reply-To: <20031208195418.GB18374@eli.net> References: <20031208195418.GB18374@eli.net> Message-ID: <20031208222452.GB8255@windhund.schwern.org> On Mon, Dec 08, 2003 at 11:54:18AM -0800, Joshua Keroes wrote: > The next Portland Perl Mongers meeting is here. > > It's at my house. It will be warm and cozy. It's WIFI-enabled. BYOB. Brandy? Bourbon? Budvar? > It will be about modules. If you've written a module and would like to > talk about it, this meeting is for you. I will talk about > Resource::Loader and possibly more, depending on turnout. > > What: Your modules > When: This Weds, Dec 10 6:30 - 8:30 or whenever. > Where: Maps and directions are at http://keroes.com/pdxpm/ . Use this > directions, none other! Mapquest, et al are *wrong*. I'd like to ramble about my 0.0x modules. Neat ideas I coded up prototypes for and threw onto CPAN but never finished. Dunce, Tie::VecArray, UNIVERSAL::require, Exporter::Lite, foundation, AnyLoader, etc... Not spend more than a few minutes on each. -- Michael G Schwern schwern@pobox.com http://www.pobox.com/~schwern/ It's Miller time! From jkeroes at eli.net Mon Dec 8 16:53:19 2003 From: jkeroes at eli.net (Joshua Keroes) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Dec meeting - This Wednesday In-Reply-To: References: <20031208195418.GB18374@eli.net> Message-ID: <20031208225319.GF18935@eli.net> On (Mon, Dec 08 14:18), Casey J Feskens wrote: > On Mon, 8 Dec 2003, Joshua Keroes wrote: > > What: Your modules > > When: This Weds, Dec 10 6:30 - 8:30 or whenever. > > Where: Maps and directions are at http://keroes.com/pdxpm/ . Use these > > directions, none other! Mapquest, et al are *wrong*. > > > > Do the directions differ if you are taking I-5 Northbound? Some > of us country bumpkins might want to attend. Excellent question. There is no Capitol Hwy exit off I5-N. I've updated the webpage at http://keroes.com/pdxpm/ to include directions from the Deep South. :-) Thanks, J From sechrest at peak.org Mon Dec 8 16:54:39 2003 From: sechrest at peak.org (John Sechrest) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Dec meeting - This Wednesday In-Reply-To: Your message of Mon, 08 Dec 2003 14:53:19 PST. <20031208225319.GF18935@eli.net> Message-ID: <200312082254.hB8MsdU19752@jas.peak.org> Joshua Keroes writes: % > Do the directions differ if you are taking I-5 Northbound? Some % > of us country bumpkins might want to attend. % Excellent question. There is no Capitol Hwy exit off I5-N. I've updated % the webpage at http://keroes.com/pdxpm/ to include directions from the % Deep South. :-) Thank you very much. I truely appreciate it. I am sure the 95% of the state that is south of the capital exit will appreciate it too. ----- John Sechrest . Helping people use . computers and the Internet . more effectively . . Internet: sechrest@peak.org . . http://www.peak.org/~sechrest From merlyn at stonehenge.com Mon Dec 8 17:50:17 2003 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Dec meeting - This Wednesday In-Reply-To: <20031208222452.GB8255@windhund.schwern.org> References: <20031208195418.GB18374@eli.net> <20031208222452.GB8255@windhund.schwern.org> Message-ID: <868ylmoond.fsf@blue.stonehenge.com> >>>>> "Michael" == Michael G Schwern writes: Michael> I'd like to ramble about my 0.0x modules. Neat ideas I coded up prototypes Michael> for and threw onto CPAN but never finished. Dunce, Tie::VecArray, Michael> UNIVERSAL::require, Exporter::Lite, foundation, AnyLoader, etc... Class::Object ? :) I just wrote a column for LinuxMag about Class::Prototyped, and re-stumbled across your Class::Object. Too bad I won't be there wednesday... I'll be freezing my hiney off in Buffalo, NY. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! From schwern at pobox.com Mon Dec 8 18:13:41 2003 From: schwern at pobox.com (Michael G Schwern) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Dec meeting - This Wednesday In-Reply-To: <868ylmoond.fsf@blue.stonehenge.com> References: <20031208195418.GB18374@eli.net> <20031208222452.GB8255@windhund.schwern.org> <868ylmoond.fsf@blue.stonehenge.com> Message-ID: <20031209001341.GC9290@windhund.schwern.org> On Mon, Dec 08, 2003 at 03:50:14PM -0800, Randal L. Schwartz wrote: > >>>>> "Michael" == Michael G Schwern writes: > > Michael> I'd like to ramble about my 0.0x modules. Neat ideas I coded up prototypes > Michael> for and threw onto CPAN but never finished. Dunce, Tie::VecArray, > Michael> UNIVERSAL::require, Exporter::Lite, foundation, AnyLoader, etc... > > Class::Object ? :) > > I just wrote a column for LinuxMag about Class::Prototyped, and > re-stumbled across your Class::Object. Yeah, Class::Prototyped and Class::Object were both developed at about the same time to address the same purpose. Big Perl 6 Language discussion about prototyped inheritence so we decided to implement it in Perl 5. Difference is, Toby actually understands prototyped inheritence whereas I was just fucking around. There's also Class::Classless. -- Michael G Schwern schwern@pobox.com http://www.pobox.com/~schwern/ Don't worry, baby, my wrath can be pretty groovy. http://www.goats.com/archive/980804.html From merlyn at stonehenge.com Mon Dec 8 18:17:02 2003 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Dec meeting - This Wednesday In-Reply-To: <20031209001341.GC9290@windhund.schwern.org> References: <20031208195418.GB18374@eli.net> <20031208222452.GB8255@windhund.schwern.org> <868ylmoond.fsf@blue.stonehenge.com> <20031209001341.GC9290@windhund.schwern.org> Message-ID: <86brqin8ub.fsf@blue.stonehenge.com> >>>>> "Michael" == Michael G Schwern writes: Michael> Yeah, Class::Prototyped and Class::Object were both developed at about Michael> the same time to address the same purpose. Big Perl 6 Language discussion Michael> about prototyped inheritence so we decided to implement it in Perl 5. Michael> Difference is, Toby actually understands prototyped inheritence whereas I Michael> was just fucking around. Now for an entirely different question that is somewhat related, to a person who can possibly answer it *best*... why does the Makefile.PL for Class::Prototyped end up with a manpage named "Class::Class::Prototyped"? What logic is it using? Of course, an answer is to move the Class dir under lib/, but how does it get the *wrong* answer? What's it thinking? -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! From schwern at pobox.com Mon Dec 8 19:16:57 2003 From: schwern at pobox.com (Michael G Schwern) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Dec meeting - This Wednesday In-Reply-To: <86brqin8ub.fsf@blue.stonehenge.com> References: <20031208195418.GB18374@eli.net> <20031208222452.GB8255@windhund.schwern.org> <868ylmoond.fsf@blue.stonehenge.com> <20031209001341.GC9290@windhund.schwern.org> <86brqin8ub.fsf@blue.stonehenge.com> Message-ID: <20031209011657.GA9771@windhund.schwern.org> On Mon, Dec 08, 2003 at 04:17:00PM -0800, Randal L. Schwartz wrote: > Now for an entirely different question that is somewhat related, to a person > who can possibly answer it *best*... > > why does the Makefile.PL for Class::Prototyped end up with a manpage > named "Class::Class::Prototyped"? What logic is it using? > > Of course, an answer is to move the Class dir under lib/, but how does > it get the *wrong* answer? What's it thinking? Its thinking that Class::Prototyped's Makefile.PL manually sets PM and gets it somewhat wrong. Class::Prototyped wants to use Class/ but that's not how it works. It can use Prototyped/, not Class. The *second* part of the module name is where MakeMaker looks, not the first. So to work around this the author set their own PM to force it to see the modules. To avoid all this complexity, just use lib/. -- Michael G Schwern schwern@pobox.com http://www.pobox.com/~schwern/ Hey Schwern! honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk, honk! From jeff at vpservices.com Mon Dec 8 19:27:40 2003 From: jeff at vpservices.com (Jeff Zucker) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Dec meeting - This Wednesday In-Reply-To: <20031209001341.GC9290@windhund.schwern.org> References: <20031208195418.GB18374@eli.net> <20031208222452.GB8255@windhund.schwern.org> <868ylmoond.fsf@blue.stonehenge.com> <20031209001341.GC9290@windhund.schwern.org> Message-ID: <3FD5250C.7090708@vpservices.com> Michael G Schwern wrote: >There's also Class::Classless. > Finally! Marxist Perl has arrived. No longer will we be bound by outdated idioms such as my $skater = Class::WhiteTrash->new('Tonya'); my $cop = Class::None->new('Kroeker'); Long live the Class::Classless::Society! -- Jeff From schwern at pobox.com Mon Dec 8 19:36:29 2003 From: schwern at pobox.com (Michael G Schwern) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Dec meeting - This Wednesday In-Reply-To: <3FD5250C.7090708@vpservices.com> References: <20031208195418.GB18374@eli.net> <20031208222452.GB8255@windhund.schwern.org> <868ylmoond.fsf@blue.stonehenge.com> <20031209001341.GC9290@windhund.schwern.org> <3FD5250C.7090708@vpservices.com> Message-ID: <20031209013629.GC9771@windhund.schwern.org> On Mon, Dec 08, 2003 at 05:27:40PM -0800, Jeff Zucker wrote: > Finally! Marxist Perl has arrived. No longer will we be bound by > outdated idioms such as > > my $skater = Class::WhiteTrash->new('Tonya'); > my $cop = Class::None->new('Kroeker'); > > Long live the Class::Classless::Society! If only we could stop people from: my $obj = Woman->new; -- Michael G Schwern schwern@pobox.com http://www.pobox.com/~schwern/ We don't know. But if we did, we wouldn't tell you. From merlyn at stonehenge.com Tue Dec 9 06:35:13 2003 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Dec meeting - This Wednesday In-Reply-To: <20031209013629.GC9771@windhund.schwern.org> References: <20031208195418.GB18374@eli.net> <20031208222452.GB8255@windhund.schwern.org> <868ylmoond.fsf@blue.stonehenge.com> <20031209001341.GC9290@windhund.schwern.org> <3FD5250C.7090708@vpservices.com> <20031209013629.GC9771@windhund.schwern.org> Message-ID: <86iskqkw3k.fsf@blue.stonehenge.com> >>>>> "Michael" == Michael G Schwern writes: Michael> If only we could stop people from: my $obj = Woman->new; On the contrary, if we could do that on demand, specifying member variables.... {grin} -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! From chromatic at wgz.org Tue Dec 9 11:26:07 2003 From: chromatic at wgz.org (chromatic) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Dec meeting - This Wednesday In-Reply-To: <20031209013629.GC9771@windhund.schwern.org> References: <20031208195418.GB18374@eli.net> <20031208222452.GB8255@windhund.schwern.org> <868ylmoond.fsf@blue.stonehenge.com> <20031209001341.GC9290@windhund.schwern.org> <3FD5250C.7090708@vpservices.com> <20031209013629.GC9771@windhund.schwern.org> Message-ID: <1070934344.2142.47.camel@localhost> On Mon, 2003-12-08 at 17:36, Michael G Schwern wrote: > If only we could stop people from: my $obj = Woman->new; At least they're not using the indirect object syntax. -- c From kellert at ohsu.edu Tue Dec 9 11:42:42 2003 From: kellert at ohsu.edu (Thomas Keller) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Dec meeting - This Wednesday In-Reply-To: <1070934344.2142.47.camel@localhost> References: <20031208195418.GB18374@eli.net> <20031208222452.GB8255@windhund.schwern.org> <868ylmoond.fsf@blue.stonehenge.com> <20031209001341.GC9290@windhund.schwern.org> <3FD5250C.7090708@vpservices.com> <20031209013629.GC9771@windhund.schwern.org> <1070934344.2142.47.camel@localhost> Message-ID: <1750F464-2A6F-11D8-949E-0003930405E2@ohsu.edu> Now you've lost me. But, I'm an old fashioned sort. Tom K On Dec 9, 2003, at 9:26 AM, chromatic wrote: > On Mon, 2003-12-08 at 17:36, Michael G Schwern wrote: > >> If only we could stop people from: my $obj = Woman->new; > > At least they're not using the indirect object syntax. > > -- c > > _______________________________________________ > Pdx-pm-list mailing list > Pdx-pm-list@mail.pm.org > http://mail.pm.org/mailman/listinfo/pdx-pm-list > From curtis_ovid_poe at yahoo.com Tue Dec 9 11:50:23 2003 From: curtis_ovid_poe at yahoo.com (Ovid) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Dec meeting - This Wednesday In-Reply-To: <1750F464-2A6F-11D8-949E-0003930405E2@ohsu.edu> Message-ID: <20031209175023.79594.qmail@web60808.mail.yahoo.com> --- Thomas Keller wrote: > Now you've lost me. But, I'm an old fashioned sort. > Tom K Indirect object syntax: my $object = new Woman; There are plenty of levels on which to object to that one. Cheers, Ovid ===== Silence is Evil http://users.easystreet.com/ovid/philosophy/indexdecency.htm Ovid http://www.perlmonks.org/index.pl?node_id=17000 Web Programming with Perl http://users.easystreet.com/ovid/cgi_course/ From jeff at vpservices.com Tue Dec 9 12:21:32 2003 From: jeff at vpservices.com (Jeff Zucker) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Dec meeting - This Wednesday In-Reply-To: <1750F464-2A6F-11D8-949E-0003930405E2@ohsu.edu> References: <20031208195418.GB18374@eli.net> <20031208222452.GB8255@windhund.schwern.org> <868ylmoond.fsf@blue.stonehenge.com> <20031209001341.GC9290@windhund.schwern.org> <3FD5250C.7090708@vpservices.com> <20031209013629.GC9771@windhund.schwern.org> <1070934344.2142.47.camel@localhost> <1750F464-2A6F-11D8-949E-0003930405E2@ohsu.edu> Message-ID: <3FD612AC.8010309@vpservices.com> Thomas Keller wrote: > Now you've lost me. But, I'm an old fashioned sort. Then the syntax for you is probably: use constant SPOUSE => 'insert_name_here'; -- Jeff From jkeroes at eli.net Tue Dec 9 12:29:31 2003 From: jkeroes at eli.net (Joshua Keroes) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Dec meeting - This Wednesday In-Reply-To: <1070934344.2142.47.camel@localhost> References: <20031208195418.GB18374@eli.net> <20031208222452.GB8255@windhund.schwern.org> <868ylmoond.fsf@blue.stonehenge.com> <20031209001341.GC9290@windhund.schwern.org> <3FD5250C.7090708@vpservices.com> <20031209013629.GC9771@windhund.schwern.org> <1070934344.2142.47.camel@localhost> Message-ID: > On Mon, 2003-12-08 at 17:36, Michael G Schwern wrote: >> If only we could stop people from: my $obj = Woman->new; On Dec 9, 2003, at 9:26 AM, chromatic wrote: > At least they're not using the indirect object syntax. Nobody seems to have touched on chained methods yet... my $obj = Woman->new->fetish( style => 'bondage' )->etc->etc->etc; Ha! J PS Reminder: meeting tomorrow. See http://pdx.pm.org/ for details. From markymoon at mac.com Tue Dec 9 21:28:00 2003 From: markymoon at mac.com (MarkyMoon) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Dec meeting - This Wednesday In-Reply-To: Message-ID: On Tuesday, December 9, 2003, at 01:29 PM, Joshua Keroes wrote: > > Nobody seems to have touched on chained methods yet... > > my $obj = Woman->new->fetish( style => 'bondage' )->etc->etc->etc; > > Ha! > J Would that be an instance of using "Strict"? That Mark Smith guy -- @a = ("a".."z"," ","-","\n");foreach $b ( 12,0,17,10,24,12,14,14,13,26,8,18,26,0,26, 22,0,13,13,0,27,1,4,26,15,4,17,11,26,7,0, 2,10,4,17) {print $a[$b]};print $a[28]; -- From kellert at ohsu.edu Wed Dec 10 12:37:06 2003 From: kellert at ohsu.edu (Thomas Keller) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] for vs foreach question Message-ID: Hi all, I thought the "foreach" keyword was a synonym for the "for" keyword. So I'm perplexed why the following loops don't give the same output: ############# code snippet ############ my $aref = [ ['Tom', 'Pattie', 'Dave', 'Dan', 'John'], ['Lee', 'Mike', 'Anita','Kathryn', 'Cecelia'], ['Cybele','Tomas','BenJoaquin','Anna'], ['Nick','Sam','Kate'],['Kim','Mike'], ['Brian','Marissa'], ['null'] ]; #print 2-D array - this works fine for (my $i = 0; $i < scalar @$aref; ++$i) { for (my $j = 0; $j < scalar @{$aref->[$i]}; ++$j) { print $aref->[$i][$j], " "; } print "\n"; } #print 2-D array - ?? - doesn't work foreach my $i (@$aref) { foreach my $j (@{$aref->[$i]}) { print $aref->[$i][$j], " "; } print "\n"; } ########### Thanks for any help understanding this. Tom K. From jeff at zeroclue.com Wed Dec 10 12:45:29 2003 From: jeff at zeroclue.com (Jeff Lavallee) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] for vs foreach question In-Reply-To: References: Message-ID: In a foreach loop $i and $j don't get set to the indicies of the array, they are the actual elements of the array. I think you want something like this: foreach my $i (@$aref) { foreach my $j (@$i) { print $j, " "; } print "\n"; } I haven't been very verbose or perhaps even clear in my explanation, so if it doesn't make sense, holler... jeff On Wed, 10 Dec 2003, Thomas Keller wrote: > Hi all, > I thought the "foreach" keyword was a synonym for the "for" keyword. So > I'm perplexed why the following loops don't give the same output: > ############# code snippet ############ > my $aref = [ ['Tom', 'Pattie', 'Dave', 'Dan', 'John'], > ['Lee', 'Mike', 'Anita','Kathryn', 'Cecelia'], > ['Cybele','Tomas','BenJoaquin','Anna'], > ['Nick','Sam','Kate'],['Kim','Mike'], > ['Brian','Marissa'], > ['null'] ]; > > #print 2-D array - this works fine > for (my $i = 0; $i < scalar @$aref; ++$i) { > for (my $j = 0; $j < scalar @{$aref->[$i]}; ++$j) { > print $aref->[$i][$j], " "; > } > print "\n"; > } > > #print 2-D array - ?? - doesn't work > foreach my $i (@$aref) { > foreach my $j (@{$aref->[$i]}) { > print $aref->[$i][$j], " "; > } > print "\n"; > } > > ########### > Thanks for any help understanding this. > Tom K. > > _______________________________________________ > Pdx-pm-list mailing list > Pdx-pm-list@mail.pm.org > http://mail.pm.org/mailman/listinfo/pdx-pm-list > From chromatic at wgz.org Wed Dec 10 12:49:53 2003 From: chromatic at wgz.org (chromatic) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] for vs foreach question In-Reply-To: References: Message-ID: <1071082193.1340.48.camel@localhost> On Wed, 2003-12-10 at 10:37, Thomas Keller wrote: > I thought the "foreach" keyword was a synonym for the "for" keyword. So > I'm perplexed why the following loops don't give the same output: They're different loops altogether! > #print 2-D array - this works fine > for (my $i = 0; $i < scalar @$aref; ++$i) { This loops through array indices. You could also write it as: foreach (my $i = 0; $i < scalar @$aref; ++$i) { > foreach my $i (@$aref) { This loops through array elements. You could also write it as: for my $i (@$aref) { The synonymity only applies to the keyword itself. It doesn't rewrite loop conditions. -- c From rootbeer at redcat.com Wed Dec 10 12:55:29 2003 From: rootbeer at redcat.com (Tom Phoenix) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] for vs foreach question In-Reply-To: References: Message-ID: On Wed, 10 Dec 2003, Thomas Keller wrote: > I thought the "foreach" keyword was a synonym for the "for" keyword. Yes, but the loops are distinct. A foreach loop is not a for loop: for (1..10) { print "$_\n" } # a foreach loop, in disguise foreach (1..10) { print "$_\n" } # the same for ($_=1; $_<=10; $_++) { print "$_\n" } # a true for loop foreach ($_=1; $_<=10; $_++) { print "$_\n" } # the same The difference is the semicolons inside the parens: If you've got two semicolons, you've got a true for loop. No semicolons, it's a foreach. > for (my $i = 0; $i < scalar @$aref; ++$i) { > for (my $j = 0; $j < scalar @{$aref->[$i]}; ++$j) { Here, $i and $j are index numbers which count from 0 up to the maximum needed. > foreach my $i (@$aref) { > foreach my $j (@{$aref->[$i]}) { But here, $i is an element of the array @$aref, so it's not a number. That breaks the second loop's list expression, too. I think you want something like this for those last two lines: foreach my $i (0..$#$aref) { foreach my $j (0..$#{$aref->[$i]}) { Those use the same upper bound as the true for loop above. Does that fix things for you? Good luck with it! --Tom Phoenix From curtis_ovid_poe at yahoo.com Wed Dec 10 12:53:01 2003 From: curtis_ovid_poe at yahoo.com (Ovid) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] for vs foreach question In-Reply-To: Message-ID: <20031210185301.30119.qmail@web60804.mail.yahoo.com> Thomas, As Jeff pointed out, your foreach loop is not doing the same thing as the for loop. When you do this: my @in_list = qw( big bad snuffleupagus ); foreach my $foo (@in_list) { $foo is getting set to each item in @in_list, not the indices. In other words, the second time through the loop, $foo will be set to 'bad', not to '1'. Cheers, Ovid --- Thomas Keller wrote: > Hi all, > I thought the "foreach" keyword was a synonym for the "for" keyword. > So > I'm perplexed why the following loops don't give the same output: > ############# code snippet ############ > my $aref = [ ['Tom', 'Pattie', 'Dave', 'Dan', 'John'], > ['Lee', 'Mike', 'Anita','Kathryn', 'Cecelia'], > ['Cybele','Tomas','BenJoaquin','Anna'], > ['Nick','Sam','Kate'],['Kim','Mike'], > ['Brian','Marissa'], > ['null'] ]; > > #print 2-D array - this works fine > for (my $i = 0; $i < scalar @$aref; ++$i) { > for (my $j = 0; $j < scalar @{$aref->[$i]}; ++$j) { > print $aref->[$i][$j], " "; > } > print "\n"; > } > > #print 2-D array - ?? - doesn't work > foreach my $i (@$aref) { > foreach my $j (@{$aref->[$i]}) { > print $aref->[$i][$j], " "; > } > print "\n"; > } > > ########### > Thanks for any help understanding this. > Tom K. > > _______________________________________________ > Pdx-pm-list mailing list > Pdx-pm-list@mail.pm.org > http://mail.pm.org/mailman/listinfo/pdx-pm-list ===== Silence is Evil http://users.easystreet.com/ovid/philosophy/indexdecency.htm Ovid http://www.perlmonks.org/index.pl?node_id=17000 Web Programming with Perl http://users.easystreet.com/ovid/cgi_course/ From jeff at vpservices.com Wed Dec 10 13:00:30 2003 From: jeff at vpservices.com (Jeff Zucker) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] for vs foreach question In-Reply-To: References: Message-ID: <3FD76D39.2090901@vpservices.com> Thomas Keller wrote: > Hi all, > I thought the "foreach" keyword was a synonym for the "for" keyword. > So I'm perplexed why the following loops don't give the same output: First, I think if you add "each" to the "for" in the first loop, it will continue to work and if you take off "each" from the second loop, it will continue to not work. The use of "for" or "foreach" is not relevant to your problem. Here is the second loop written correctly with more legible variable names so you can see what's going on: my $table = $aref; for my $row (@$table) { foreach my $column (@$row) { print $column, " "; } print "\n"; } Write back if that doesn't clarify things for you. -- Jeff From kellert at ohsu.edu Wed Dec 10 13:04:20 2003 From: kellert at ohsu.edu (Thomas Keller) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] for vs foreach question In-Reply-To: References: Message-ID: Yup, I get it now. Thanks On Dec 10, 2003, at 10:55 AM, Tom Phoenix wrote: > On Wed, 10 Dec 2003, Thomas Keller wrote: > >> I thought the "foreach" keyword was a synonym for the "for" keyword. > > Yes, but the loops are distinct. A foreach loop is not a for loop: > > for (1..10) { print "$_\n" } # a foreach loop, in disguise > foreach (1..10) { print "$_\n" } # the same > > for ($_=1; $_<=10; $_++) { print "$_\n" } # a true for loop > foreach ($_=1; $_<=10; $_++) { print "$_\n" } # the same > > The difference is the semicolons inside the parens: If you've got two > semicolons, you've got a true for loop. No semicolons, it's a foreach. > >> for (my $i = 0; $i < scalar @$aref; ++$i) { >> for (my $j = 0; $j < scalar @{$aref->[$i]}; ++$j) { > > Here, $i and $j are index numbers which count from 0 up to the maximum > needed. > >> foreach my $i (@$aref) { >> foreach my $j (@{$aref->[$i]}) { > > But here, $i is an element of the array @$aref, so it's not a number. > That > breaks the second loop's list expression, too. > > I think you want something like this for those last two lines: > > foreach my $i (0..$#$aref) { > foreach my $j (0..$#{$aref->[$i]}) { > > Those use the same upper bound as the true for loop above. > > Does that fix things for you? Good luck with it! > > --Tom Phoenix > From rootbeer at redcat.com Wed Dec 10 13:05:04 2003 From: rootbeer at redcat.com (Tom Phoenix) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] for vs foreach question In-Reply-To: References: Message-ID: On Wed, 10 Dec 2003, Tom Phoenix wrote: > But here, $i is an element of the array @$aref, so it's not a number. Oops. Well, I meant to say, not _necessarily_ a number. In particular, it's not useful in general for indexing into the array, which seems to be what you are trying to do. --Tom Phoenix From kellert at ohsu.edu Wed Dec 10 13:17:53 2003 From: kellert at ohsu.edu (Thomas Keller) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] for vs foreach question In-Reply-To: <3FD76D39.2090901@vpservices.com> References: <3FD76D39.2090901@vpservices.com> Message-ID: <8D7BCCE2-2B45-11D8-A7CB-0003930405E2@ohsu.edu> Basically, it is a matter of understanding what is $_ in the foreach loop. I forgot that it would be the actual element of my arrays rather than the index; whereas in the for loop I defined the indices explicitly. Sigh. But it doesn't hurt to rethink about the basics now and then. Thanks all. Tom On Dec 10, 2003, at 11:00 AM, Jeff Zucker wrote: > Thomas Keller wrote: > >> Hi all, >> I thought the "foreach" keyword was a synonym for the "for" keyword. >> So I'm perplexed why the following loops don't give the same output: > > > First, I think if you add "each" to the "for" in the first loop, it > will continue to work and if you take off "each" from the second loop, > it will continue to not work. The use of "for" or "foreach" is not > relevant to your problem. > > Here is the second loop written correctly with more legible variable > names so you can see what's going on: > > my $table = $aref; > for my $row (@$table) { > foreach my $column (@$row) { > print $column, " "; > } > print "\n"; > } > > Write back if that doesn't clarify things for you. > > -- > Jeff > > From curtis_ovid_poe at yahoo.com Wed Dec 10 14:14:35 2003 From: curtis_ovid_poe at yahoo.com (Ovid) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Dec meeting - This Wednesday In-Reply-To: <20031208195418.GB18374@eli.net> Message-ID: <20031210201436.95409.qmail@web60810.mail.yahoo.com> Out of curiosity, will we be able to do a small presentation? I actually have two modules I would like to talk about and I have still have the lightning talk slides for one of them online, but have nothing for the other. Cheers, Ovid ===== Silence is Evil http://users.easystreet.com/ovid/philosophy/indexdecency.htm Ovid http://www.perlmonks.org/index.pl?node_id=17000 Web Programming with Perl http://users.easystreet.com/ovid/cgi_course/ From jkeroes at eli.net Wed Dec 10 15:44:42 2003 From: jkeroes at eli.net (Joshua Keroes) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Dec meeting - This Wednesday In-Reply-To: <20031210201436.95409.qmail@web60810.mail.yahoo.com> References: <20031210201436.95409.qmail@web60810.mail.yahoo.com> Message-ID: <0FF9A360-2B5A-11D8-BE25-000A95C466EC@eli.net> On Dec 10, 2003, at 12:14 PM, Ovid wrote: > Out of curiosity, will we be able to do a small presentation? I > actually have two modules I would like to talk about and I have still > have the lightning talk slides for one of them online, but have nothing > for the other. Meeting clarification: *anybody* can talk about *any* modules they've written; whether they're on CPAN or not. Meeting info: http://pdx.pm.org/ -J From jkeroes at eli.net Wed Dec 10 15:48:47 2003 From: jkeroes at eli.net (Joshua Keroes) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Dec meeting - *TONIGHT* In-Reply-To: <20031208195418.GB18374@eli.net> References: <20031208195418.GB18374@eli.net> Message-ID: Reminder: this is *tonight*! See you here. :-) On Dec 8, 2003, at 11:54 AM, Joshua Keroes wrote: > The next Portland Perl Mongers meeting is here. > > It's at my house. It will be warm and cozy. It's WIFI-enabled. BYOB. > > It will be about modules. If you've written a module and would like to > talk about it, this meeting is for you. I will talk about > Resource::Loader and possibly more, depending on turnout. > > > What: Your modules > When: This Weds, Dec 10 6:30 - 8:30 or whenever. > Where: Maps and directions are at http://keroes.com/pdxpm/ . Use this > directions, none other! Mapquest, et al are *wrong*. Anyone can speak about any modules they've written. Sounds like we have Schwern, Curtis Poe, and I so far. -Joshua PS Info is on http://pdx.pm.org as well. From schwern at pobox.com Wed Dec 10 18:55:57 2003 From: schwern at pobox.com (Michael G Schwern) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Need a ride to the meeting. Message-ID: <20031211005557.GA17107@windhund.schwern.org> If anyone's going to Joshua's tonite and happens to be near the Fireside Cafe on Powell and SE 14th, I could use a ride. Drop me an email or just swing by. I figure I'll wait around until about 6pm before taking the bus. -- Michael G Schwern schwern@pobox.com http://www.pobox.com/~schwern/ Milk is timeless. From curtis_ovid_poe at yahoo.com Thu Dec 11 11:12:29 2003 From: curtis_ovid_poe at yahoo.com (Ovid) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Module downloads and brainstorming request Message-ID: <20031211171229.11406.qmail@web60803.mail.yahoo.com> As promised, here's where you can download the two modules that I discussed at the meeting: http://users.easystreet.com/ovid/cgi_course/downloads/AI-NeuralNet-Simple-.01.tar.gz http://users.easystreet.com/ovid/cgi_course/downloads/Sub-Attributes-0.02.tar.gz The first module, AI::NeuralNet::Simple, will probably go to the CPAN as soon as I provide methods for a couple of its hard-coded properties. It's still usable though, and has a nifty example where you tell your little AI character how healthy it is, what weapons it has, how many enemies it sees and it will tell you what its response is (currently limited to attack, run, hide, and wander). It's called "simple" because it's a basic neural network with docs aimed at people who have never used a neural network before. (note: it requires Inline::C) The second module, Sub::Attributes, will be renamed at some point. Suggestions welcome. It allows you to assign attributes to subroutines that alter their behavior depending upon the context in which they are called. All subroutines are expected to return an array or list, but if you call them in scalar or void context, their behavior alters. For example, if you want to return an array, but return an array ref in scalar context and die if called in void context, you might add the following to the end of your subroutine: if (wantarray) { return @results; } elsif (defined wantarray) { return \@results; } die "Do not call me in void context!"; That's a lot of unecessary typing and it would be annoying to code that for every subroutine. With Sub::Attributes, you can just type this: sub do_stuph : Arrayref(NOVOID) { ... } What if you wanted to create a param() method that functions like CGI::param? (i.e., in scalar context it only returns the first item in the array) sub param : First { ... } You can also make that fatal if you specify NOVOID (I'll also add a "WARN_VOID" function so that you get a "Useless use of *** in void context" warning. There are other attributes available for this, but I think you get the idea. Currently, there are a couple of things that I need before I publish this to the CPAN. If you have attributes that you would like added (throwing exceptions if called in scalar context?), let me know. I also need a better name. Attribute::Context or List::Context are two ideas. I've also wondered if I should expand this to affect contexts outside of subroutines. The attribute would explain what happens when accessed in list context and the argument to the attribute would be the behavior when accessed in scalar context. my @array = qw(foo bar baz); my $arrayref : Expand(Count) = \@array; print $arrayref->[1]; # prints 'bar' my @new_array = $arrayref; # @new_array = qw(foo bar baz) my $count = $arrayref; # $count == 3 I think this is a phenomenally bad idea, but I do wonder if there is something interesting to be discovered here. Cheers, Ovid ===== Silence is Evil http://users.easystreet.com/ovid/philosophy/indexdecency.htm Ovid http://www.perlmonks.org/index.pl?node_id=17000 Web Programming with Perl http://users.easystreet.com/ovid/cgi_course/ From wickman at halfangle.com Fri Dec 12 15:17:11 2003 From: wickman at halfangle.com (wickman) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] mechanize - javascript form fields Message-ID: I'm ramping up on mechanize and am having trouble with the etrade login page. I set values for USER, PASSWORD, & TARGET on the 3rd form on the login page. The TARGET is dynamically set via javascript which references the cookie for the last start page preference, if it exists. Mechanize fails to identify the TARGET field and errors out. Anyone dealt with this situation? --Steve -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/pdx-pm-list/attachments/20031212/488abed1/attachment.htm From raanders at acm.org Fri Dec 12 19:37:45 2003 From: raanders at acm.org (Roderick A. Anderson) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Sorry CGI question Message-ID: I used to hate to see these type of questions on the the other perl lists. Every new perl user was doing it for CGI and thought that was the only use for perl... Oh well here goes. I have a CGI script that does it all: from initial screen through all the options to final completion. It uses CGI.pm to pull form variables with one being 'action'. The problem is if a user clicks reload the last action (tries to) execute again. I haven't figured out where my logic falls apart so it only half works on a reload. What I'm trying to do it is kludge a temporary fix. Is there a way to end a CGI script with dynamic content (username, connection info, etc.) so that a reload/refresh won't rerun the CGI script? TIA, Rod -- "Open Source Software - You usually get more than you pay for..." "Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL" From rootbeer at redcat.com Sat Dec 13 00:32:15 2003 From: rootbeer at redcat.com (Tom Phoenix) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Sorry CGI question In-Reply-To: References: Message-ID: On Fri, 12 Dec 2003, Roderick A. Anderson wrote: > Is there a way to end a CGI script with dynamic content (username, > connection info, etc.) so that a reload/refresh won't rerun the CGI > script? Isn't there a module on CPAN for this? I couldn't find it, but my sleepy brain probably didn't think of the right search term. If you're using a form, browsers are not supposed to blindly re-use a POST action without asking the user. Not that you can completely rely upon that happening... :-) Of course, GET requests, such as clicking on link text, may be reused without any problem. So it sounds like this is a job for a POST, for one thing. I think you want to do something like this: Include something that makes each request unique, so that you'll know if the "same" form is used twice. For example, each time you generate the form, include some random data item, such as 'random_id=12345987'. (Or the equivalent as a form element, or whatever.) Now, on each submission, check to see whether that same ID number has been used in the past, say, 100 seconds. If it has, you have several options. One is to just dump out a page scolding the user for multiple impatient clicks. Another would be to try to re-create the request page that they were requesting, perhaps with a little scolding included. (That is, you try to give them the page they would have gotten from doing the request just once.) But if it's hard or impossible to give them the true page, you could keep a page cache and give out the page from the cache. A page cache sounds hard, but it's easy if you combine it with the ID number idea: Keep a small directory for your cache. Each file is named with the random ID number used on its form. When the ID number is new (that is, on the first click) save the HTML to the file and output it to the browser. If there's a file with the needed ID number, and if that file's mtime is within the past 100 seconds, your program simply dumps out the contents of that file. (Well, but see below.) Odds and ends: How do you keep the cache clean? Each time your program runs, it deletes any cache files older than 100 seconds. (Does that sound inefficient? It's okay in this case; unless several people have submitted the form in the previous few minutes, there should be few cache files in the directory.) Why make the ID numbers random? Because that was the first idea in my head; unless security is an issue, it's probably simpler to make them sequential. (Well, security is always an issue with CGI programs. But unless there's something special going on, there's not much that an attacker can do by guessing the number that they can't do in a general denial-of-service attack.) How do you scold users when the page is pulled from the cache? I'd probably do it quick-and-dirty, like this: Put a place holder into your original HTML: Now it's easy to use a single simple s/// to replace that with whatever scolding is needed, after you pull in the page from the cache. One last note: Beware of concurrent processes. Somebody who repeat-clicks on your link will give you two or more processes running at the same time, sooner or later. It's probably best to have a single file somewhere that your program gets an exclusive lock on; I often use a log file for that purpose, keeping it open for the entire run of the program. If you don't use a lock file, you may start dumping out a cache entry while it's still being saved into the file, or something worse. Hope this helps! --Tom Phoenix From merlyn at stonehenge.com Sat Dec 13 02:19:49 2003 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Sorry CGI question In-Reply-To: References: Message-ID: <86zndx2kpq.fsf@blue.stonehenge.com> >>>>> "Roderick" == Roderick A Anderson writes: Roderick> I have a CGI script that does it all: from initial screen Roderick> through all the options to final completion. It uses CGI.pm Roderick> to pull form variables with one being 'action'. The problem Roderick> is if a user clicks reload the last action (tries to) Roderick> execute again. I haven't figured out where my logic falls Roderick> apart so it only half works on a reload. What I'm trying to Roderick> do it is kludge a temporary fix. Google for site:stonehenge.com "one-click" cgi [Always wondering how many times I have to tell people to google my 198+ columns here... {grin}] -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! From curtis_ovid_poe at yahoo.com Fri Dec 12 17:33:46 2003 From: curtis_ovid_poe at yahoo.com (Ovid) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Attribute::Context Message-ID: <20031212233346.35132.qmail@web60801.mail.yahoo.com> If anyone's curious, I uploaded the "Sub::Attributes" module to the CPAN. http://search.cpan.org/~ovid/Attribute-Context-0.03/ The name has been changed to reflect that fact that it used attributes to alter behavior based upon context. It might be expanded to more things than just subroutines, though that's down the road. Cheers, Curtis ===== Silence is Evil http://users.easystreet.com/ovid/philosophy/indexdecency.htm Ovid http://www.perlmonks.org/index.pl?node_id=17000 Web Programming with Perl http://users.easystreet.com/ovid/cgi_course/ From raanders at acm.org Sun Dec 14 09:00:14 2003 From: raanders at acm.org (Roderick A. Anderson) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Sorry CGI question In-Reply-To: <86zndx2kpq.fsf@blue.stonehenge.com> Message-ID: On 13 Dec 2003, Randal L. Schwartz wrote: > >>>>> "Roderick" == Roderick A Anderson writes: > > Google for > > site:stonehenge.com "one-click" cgi > > [Always wondering how many times I have to tell people to google > my 198+ columns here... {grin}] And how many times I have forgotten to bookmark your site so I think of it. I read your articles in several different magazines then if they are not applicable now I file them in the cache and they get pushed out. {REALLY BIG GRIN}. I'll do it now. Thanks, Rod -- "Open Source Software - You usually get more than you pay for..." "Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL" From raanders at acm.org Sun Dec 14 09:07:45 2003 From: raanders at acm.org (Roderick A. Anderson) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Sorry CGI question In-Reply-To: Message-ID: On Fri, 12 Dec 2003, Tom Phoenix wrote: > Isn't there a module on CPAN for this? I couldn't find it, but my sleepy > brain probably didn't think of the right search term. I couldn't think of a good choice either and it was late in the day after a very early morning. > If you're using a form, browsers are not supposed to blindly re-use a POST > action without asking the user. Not that you can completely rely upon that > happening... :-) Of course, GET requests, such as clicking on link text, > may be reused without any problem. So it sounds like this is a job for a > POST, for one thing. It is using HTTPS (on a Windows IIS system) and I'm a valid user on that system so the session certificate (?) doesn't expire as the system is used for several other processes that I access many times a day. > I think you want to do something like this: Include something that makes > each request unique, so that you'll know if the "same" form is used twice. > For example, each time you generate the form, include some random data > item, such as 'random_id=12345987'. (Or the equivalent as a form element, > or whatever.) I'd been thinking of this. After looking at Randall's one-click I'll know which is better for this setup. Thanks, Rod -- "Open Source Software - You usually get more than you pay for..." "Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL" From raanders at acm.org Sun Dec 14 09:35:43 2003 From: raanders at acm.org (Roderick A. Anderson) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Sorry CGI question In-Reply-To: Message-ID: On Fri, 12 Dec 2003, Tom Phoenix wrote: [Lots of great stuff.] Tom, After looking at Randall's page I see you both were solving it the same way. Go figure eh? Thanks for the more indepth discussion on the hows and whys. I'll put the two of them together in my 'Black Book of Perl' folder. Rod -- "Open Source Software - You usually get more than you pay for..." "Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL" From joe at radiojoe.org Mon Dec 15 10:11:09 2003 From: joe at radiojoe.org (Joe Oppegaard) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] Bruce Schneier @ Powell's Technical Books Message-ID: Mongers, Bruce Schneier, everyone's favorite crypto-guy, will be at Powell's Technical Books on January 14th, 7:30pm. Mark your calendar! As stated in the last crypto-gram, Schneier is doing a series of lectures and signings to promote Beyond Fear (his newest book). Portland is one of the few stops. -Joe Oppegaard From cdawson at webiphany.com Mon Dec 15 14:40:49 2003 From: cdawson at webiphany.com (Chris Dawson) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] how to append to library path? Message-ID: <3FDE1C51.1060406@webiphany.com> Is it possible to append to the @INC path such that any instance of Perl always uses a special library path? Is this something that is compiled into perl, or is there a file which I can modify to do this? I realize I can add a "use lib" statement to my scripts, but I would like to enable this in a more global way. Thanks, Chris From merlyn at stonehenge.com Mon Dec 15 14:46:06 2003 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] how to append to library path? In-Reply-To: <3FDE1C51.1060406@webiphany.com> References: <3FDE1C51.1060406@webiphany.com> Message-ID: <86iskhq06t.fsf@blue.stonehenge.com> >>>>> "Chris" == Chris Dawson writes: Chris> Is it possible to append to the @INC path such that any instance of Chris> Perl always uses a special library path? Is this something that is Chris> compiled into perl, Yes. You must rebuild Perl to change it permanently. Chris> or is there a file which I can modify to do this? How would it know where to look for the file? You've always got a chicken-and-egg problem there. :) Chris> I realize I can add a "use lib" statement to my scripts, but I would Chris> like to enable this in a more global way. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! From cdawson at webiphany.com Mon Dec 15 14:58:27 2003 From: cdawson at webiphany.com (Chris Dawson) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] how to append to library path? In-Reply-To: <86iskhq06t.fsf@blue.stonehenge.com> References: <3FDE1C51.1060406@webiphany.com> <86iskhq06t.fsf@blue.stonehenge.com> Message-ID: <3FDE2073.5070204@webiphany.com> Answers inline: Randal L. Schwartz wrote: >>>>>>"Chris" == Chris Dawson writes: >>>>>> >>>>>> > >Chris> Is it possible to append to the @INC path such that any instance of >Chris> Perl always uses a special library path? Is this something that is >Chris> compiled into perl, > >Yes. You must rebuild Perl to change it permanently. > >Chris> or is there a file which I can modify to do this? > >How would it know where to look for the file? You've always got a >chicken-and-egg problem there. :) > > > Well, I thought perhaps the path to this file might have been compiled into perl. :) Am I missing something? Is there a fundamental reason why this would not work? I guess I will just use PERL5LIB.... >Chris> I realize I can add a "use lib" statement to my scripts, but I would >Chris> like to enable this in a more global way. > > > > Thanks Randal. Chris From jkeroes at eli.net Mon Dec 15 14:50:36 2003 From: jkeroes at eli.net (Joshua Keroes) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] how to append to library path? In-Reply-To: <3FDE1C51.1060406@webiphany.com> References: <3FDE1C51.1060406@webiphany.com> Message-ID: <20031215205036.GK17162@eli.net> On (Mon, Dec 15 12:40), Chris Dawson wrote: > Is it possible to append to the @INC path such that any instance of Perl > always uses a special library path? Is this something that is compiled > into perl, or is there a file which I can modify to do this? I realize > I can add a "use lib" statement to my scripts, but I would like to > enable this in a more global way. To modify @INC globally, you'll need to rebuild perl. @INC and module tricks: List your default @INC, the one your perl was originally built with: perl -V Prepend directories to @INC: use lib qw[ /path/to/somewhere/ ]; use lib qw[ . .. ]; Append directories to @INC: BEGIN { push @INC, qw[ /path/to/somewhere ] } Show loaded libraries and where they were loaded from: use Data::Dumper; print Dumper \%INC; Hope that helps, J From jeff at vpservices.com Mon Dec 15 14:59:19 2003 From: jeff at vpservices.com (Jeff Zucker) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] how to append to library path? In-Reply-To: <3FDE1C51.1060406@webiphany.com> References: <3FDE1C51.1060406@webiphany.com> Message-ID: <3FDE2079.2010401@vpservices.com> Chris Dawson wrote: > Is it possible to append to the @INC path such that any instance of > Perl always uses a special library path? Is this something that is > compiled into perl, or is there a file which I can modify to do this? > I realize I can add a "use lib" statement to my scripts, but I would > like to enable this in a more global way. The PERL5LIB environment setting. (see perldoc perlrun) -- Jeff From merlyn at stonehenge.com Mon Dec 15 15:01:45 2003 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Mon Aug 2 21:34:27 2004 Subject: [Pdx-pm] how to append to library path? In-Reply-To: <3FDE2073.5070204@webiphany.com> References: <3FDE1C51.1060406@webiphany.com> <86iskhq06t.fsf@blue.stonehenge.com> <3FDE2073.5070204@webiphany.com> Message-ID: <86ekv5pzgw.fsf@blue.stonehenge.com> >>>>> "Chris" == Chris Dawson writes: >> How would it know where to look for the file? You've always got a >> chicken-and-egg problem there. :) >> >> Chris> Well, I thought perhaps the path to this file might have been compiled Chris> into perl. :) Am I missing something? Yes, at some point, you HAVE to have a path compiled into Perl. Why not make it the business paths, instead of meta-paths? That's what Larry decided to do. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! From jkeroes at eli.net Mon Dec 15 16:23:45 2003 From: jkeroes at eli.net (Joshua Keroes) Date: Mon Aug 2 21:34:28 2004 Subject: [Pdx-pm] Stepping Down Message-ID: <20031215222345.GN17162@eli.net> I've been doing this thing some people call "organizing" for a year now. My time is over. It's time for someone else to hold sway over the Portland Perl Mongers. Thank-you all, Joshua From hydo at mac.com Mon Dec 15 16:28:41 2003 From: hydo at mac.com (Clint Moore) Date: Mon Aug 2 21:34:28 2004 Subject: [Pdx-pm] Stepping Down In-Reply-To: <20031215222345.GN17162@eli.net> References: <20031215222345.GN17162@eli.net> Message-ID: <096CCD6C-2F4E-11D8-8413-000393AF17E6@mac.com> On Dec 15, 2003, at 2:23 PM, Joshua Keroes wrote: > I've been doing this thing some people call "organizing" for a year > now. > My time is over. It's time for someone else to hold sway over the > Portland > Perl Mongers. This begs the question: Who's stepping in? -cm From jkeroes at eli.net Mon Dec 15 16:34:14 2003 From: jkeroes at eli.net (Joshua Keroes) Date: Mon Aug 2 21:34:28 2004 Subject: [Pdx-pm] Stepping Down In-Reply-To: <096CCD6C-2F4E-11D8-8413-000393AF17E6@mac.com> References: <20031215222345.GN17162@eli.net> <096CCD6C-2F4E-11D8-8413-000393AF17E6@mac.com> Message-ID: <20031215223414.GO17162@eli.net> > On Dec 15, 2003, at 2:23 PM, Joshua Keroes wrote: > >I've been doing this thing some people call "organizing" for a year > >now. My time is over. It's time for someone else to hold sway over > >the Portland Perl Mongers. On (Mon, Dec 15 14:28), Clint Moore wrote: > This begs the question: Who's stepping in? It's a matter of group consensus. Whomever the mob likes shall be the Chosen One. J From nat at powning.org Mon Dec 15 18:58:45 2003 From: nat at powning.org (Nathaniel Powning) Date: Mon Aug 2 21:34:28 2004 Subject: [Pdx-pm] how to append to library path? In-Reply-To: <86ekv5pzgw.fsf@blue.stonehenge.com> Message-ID: <20031215165610.B75620-100000@butters.natwork.com> On 15 Dec 2003, Randal L. Schwartz wrote: > >>>>> "Chris" == Chris Dawson writes: > > >> How would it know where to look for the file? You've always got a > >> chicken-and-egg problem there. :) > >> > >> > Chris> Well, I thought perhaps the path to this file might have been compiled > Chris> into perl. :) Am I missing something? > > Yes, at some point, you HAVE to have a path compiled into Perl. Why > not make it the business paths, instead of meta-paths? That's > what Larry decided to do. > What if you're an individual user wanting to include your own modules while using the global perl binary? Is it not okay to populate your own @INC or push an additional value into it? From rootbeer at redcat.com Mon Dec 15 20:14:26 2003 From: rootbeer at redcat.com (Tom Phoenix) Date: Mon Aug 2 21:34:28 2004 Subject: [Pdx-pm] how to append to library path? In-Reply-To: <20031215165610.B75620-100000@butters.natwork.com> References: <20031215165610.B75620-100000@butters.natwork.com> Message-ID: On Mon, 15 Dec 2003, Nathaniel Powning wrote: > What if you're an individual user wanting to include your own modules > while using the global perl binary? Is it not okay to populate your own > @INC or push an additional value into it? Sure, nothing wrong with that. Or with setting PERL5LIB and forgetting about it. The underlying suggestion is to fix up Perl to always do something like this before it compiles any other code: if (-r "/home/barney/.perl-config.pl") { require "/home/barney/.perl-config.pl"; } That file could then set up the proper @INC paths or do all sorts of other initialization. The cost would be that this check would slightly slow down every invocation of Perl when you don't have such a file. (It's pretty small, but some systems launch a Perl program more than 1000 times per second. It adds up.) But how would the system-wide Perl binary know where to find that file? The path to _something_ has to be compiled into Perl. So, as Randal said, Larry chose the simpler route of compiling the @INC paths, rather than a specific filename. But Larry gives us the tools to do something like what you want, with PERL5LIB and the -M command-line option. Would one of those be what you're looking for? After all, if you can't modify the system-wide perl binary, and you can't change the environment variables, and you can't alter the invocation options on the command line, and you can't change the source code to your programs, it can be hard to get Perl to do what you want. --Tom From tex at off.org Mon Dec 15 21:52:54 2003 From: tex at off.org (Austin Schutz) Date: Mon Aug 2 21:34:28 2004 Subject: [Pdx-pm] how to append to library path? In-Reply-To: References: <20031215165610.B75620-100000@butters.natwork.com> Message-ID: <20031216035254.GL22969@gblx.net> On Mon, Dec 15, 2003 at 06:14:26PM -0800, Tom Phoenix wrote: > But how would the system-wide Perl binary know where to find that file? > The path to _something_ has to be compiled into Perl. So, as Randal said, > Larry chose the simpler route of compiling the @INC paths, rather than a > specific filename. Sure, but it seems pretty reasonable to make it possible to modify the path, maybe by having perl read some sort of (possibly precompiled) config file, like e.g. sendmail does. I dunno, sometimes it's nice to have something _just work_ system wide without having to recompile a big program such as perl and probably break 50 other things at the same time. Compiling is also a big PITA, especially on systems that have hobbled development systems by default, e.g. solaris. Also as a perl geek it goes against my nature. What can I say, I'm spoiled. But then again, I seem to be the contrarian most of the time :-) Austin p.s. those chocolate chip cookies from last time rocked! From john at digitalmx.com Mon Dec 15 22:00:25 2003 From: john at digitalmx.com (John Springer) Date: Mon Aug 2 21:34:28 2004 Subject: [Pdx-pm] how to append to library path? In-Reply-To: References: <20031215165610.B75620-100000@butters.natwork.com> Message-ID: <60C67E5F-2F7C-11D8-AB89-000A95DC32DA@digitalmx.com> On Dec 15, 2003, at 6:14 PM, Tom Phoenix wrote: > > After all, if you can't modify the system-wide perl binary, and you > can't > change the environment variables, and you can't alter the invocation > options on the command line, and you can't change the source code to > your > programs, it can be hard to get Perl to do what you want. > > --Tom Now be gentle. At least one place where this a real pain is in a shared webserver environment, where you can't modify the binary, you can't easily change the ENV, and you can't alter the command line invocation. So you're down to changing the source code. On every script. Over and over. It's a nuisance, if nothing else. I usually have a .pm file that I reference with a use statement to setup a bunch of definitions and stuff. But it would surely be nice to have a default place in ~/ or ./ that perl would look in. -- John Springer Somewhere in Portland Where it's probably raining. From merlyn at stonehenge.com Mon Dec 15 22:02:07 2003 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Mon Aug 2 21:34:28 2004 Subject: [Pdx-pm] how to append to library path? In-Reply-To: <20031215165610.B75620-100000@butters.natwork.com> References: <20031215165610.B75620-100000@butters.natwork.com> Message-ID: <86oeu9o1fn.fsf@blue.stonehenge.com> >>>>> "Nathaniel" == Nathaniel Powning writes: Nathaniel> What if you're an individual user wanting to include your Nathaniel> own modules while using the global perl binary? Is it not Nathaniel> okay to populate your own @INC or push an additional value Nathaniel> into it? Absolutely. But that wasn't the original question. You can affect @INC with -I on the command-line, or PERL5LIB, or "use lib ..." or pushing directly onto @INC in a BEGIN {} block. But that wasn't the original question. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! From merlyn at stonehenge.com Mon Dec 15 22:32:20 2003 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Mon Aug 2 21:34:28 2004 Subject: [Pdx-pm] how to append to library path? In-Reply-To: <20031216035254.GL22969@gblx.net> References: <20031215165610.B75620-100000@butters.natwork.com> <20031216035254.GL22969@gblx.net> Message-ID: <86k74xo019.fsf@blue.stonehenge.com> >>>>> "Austin" == Austin Schutz writes: Austin> Sure, but it seems pretty reasonable to make it possible to modify Austin> the path, maybe by having perl read some sort of (possibly precompiled) Austin> config file, like e.g. sendmail does. Yes, but *from where*? That's a path too. How do you define *that* path? -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! From merlyn at stonehenge.com Mon Dec 15 22:32:53 2003 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Mon Aug 2 21:34:28 2004 Subject: [Pdx-pm] how to append to library path? In-Reply-To: <60C67E5F-2F7C-11D8-AB89-000A95DC32DA@digitalmx.com> References: <20031215165610.B75620-100000@butters.natwork.com> <60C67E5F-2F7C-11D8-AB89-000A95DC32DA@digitalmx.com> Message-ID: <86fzflo00h.fsf@blue.stonehenge.com> >>>>> "John" == John Springer writes: John> But it would surely be nice to have a default place in ~/ or ./ that John> perl would look in. But whose "~"? or what "."? -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! From rootbeer at redcat.com Mon Dec 15 22:35:02 2003 From: rootbeer at redcat.com (Tom Phoenix) Date: Mon Aug 2 21:34:28 2004 Subject: [Pdx-pm] how to append to library path? In-Reply-To: <5AAF7944-2F72-11D8-AB89-000A95DC32DA@digitalmx.com> References: <20031215165610.B75620-100000@butters.natwork.com> <5AAF7944-2F72-11D8-AB89-000A95DC32DA@digitalmx.com> Message-ID: On Mon, 15 Dec 2003, John Springer wrote: > Now be gentle. Maybe I should have put a smiley on my message, but I thought it was redundant. :-) > At least one place where this a real pain is in a shared webserver > environment, where you can't modify the binary, you can't easily change > the ENV, and you can't alter the command line invocation. So you're > down to changing the source code. On every script. Over and over. > It's a nuisance, if nothing else. Agreed. > But it would surely be nice to have a default place in ~/ or ./ that > perl would look in. It's worth considering. I have to admit that I like the idea of having Perl look _only_ in /etc/perl-config.pl or somesuch. (Sorry, but that filepath would have to be spelled out at compile time. And don't ask me what name it should be on Windows or something else.) That file could look in user directories or not, at the administrator's option. If somebody wants to add that feature to Perl (or talk somebody else into doing so), try it out. But be sure to benchmark how much it slows down every invocation when there's no config file, and how much when there's a config file that looks in all of the likely places where config files live on a given system. It's probably not much of a slowdown, but on small, frequently-called programs (such as those on a webserver), it could double the compilation time. At least, that's what happens with the version of Perl that's installed in my brain, but that one needs some patching anyway. Cheers! --Tom Phoenix From robbyrussell at pdxlug.org Mon Dec 15 23:13:35 2003 From: robbyrussell at pdxlug.org (Robby Russell) Date: Mon Aug 2 21:34:28 2004 Subject: [Pdx-pm] how to append to library path? In-Reply-To: References: <20031215165610.B75620-100000@butters.natwork.com> <5AAF7944-2F72-11D8-AB89-000A95DC32DA@digitalmx.com> Message-ID: <3FDE947F.1090209@pdxlug.org> Tom Phoenix wrote: > > If somebody wants to add that feature to Perl (or talk somebody else into > doing so), try it out. But be sure to benchmark how much it slows down > every invocation when there's no config file, and how much when there's a > config file that looks in all of the likely places where config files live > on a given system. It's probably not much of a slowdown, but on small, > frequently-called programs (such as those on a webserver), it could double > the compilation time. > That's how PHP does it with the PHP.ini file, which is just another way to store GLOBAL variables. Wouldn't it make more sense to include specific libraries on an as needed basis (per script) rather than do this in some global place? It'd make sense to just recompile should this change be necessary. Once you use something like a system config file, people would want to turn on/off more configuration stuff there rather than controlling it within their application. I'm just curious as to why that would be a really useful feature for perl as I find it to be one of the things that I dislike about PHP. Robby From curtis_ovid_poe at yahoo.com Mon Dec 15 16:42:47 2003 From: curtis_ovid_poe at yahoo.com (Ovid) Date: Mon Aug 2 21:34:28 2004 Subject: [Pdx-pm] Stepping Down In-Reply-To: <20031215223414.GO17162@eli.net> Message-ID: <20031215224247.32940.qmail@web60801.mail.yahoo.com> --- Joshua Keroes wrote: > On (Mon, Dec 15 14:28), Clint Moore wrote: > > This begs the question: Who's stepping in? > > It's a matter of group consensus. Whomever the mob likes shall be the > Chosen One. Joshua, That might work. Herding kittens might also work. (Of course, there's a lady in my neighborhood who takes her cats for walks -- without a leash -- and they follow her, so what do I know?). When I tried that, you were the only one foolish enough to want to do this. I thought you would do a good job, so I appointed you and no one argued. If several people want to do this and there's a vote, so be it, but I really think it would be easier for everyone if you waited for someone foolish enough to volunteer and then you yell "tag, you're it!" :) For the record, I think you've done a kick @$$ job. Thanks for doing this. Cheers, Ovid ===== Silence is Evil http://users.easystreet.com/ovid/philosophy/indexdecency.htm Ovid http://www.perlmonks.org/index.pl?node_id=17000 Web Programming with Perl http://users.easystreet.com/ovid/cgi_course/ From joe at radiojoe.org Tue Dec 16 10:15:09 2003 From: joe at radiojoe.org (Joe Oppegaard) Date: Mon Aug 2 21:34:28 2004 Subject: [Pdx-pm] Stepping Down In-Reply-To: <20031215224247.32940.qmail@web60801.mail.yahoo.com> References: <20031215224247.32940.qmail@web60801.mail.yahoo.com> Message-ID: On Mon, 15 Dec 2003, Ovid wrote: > --- Joshua Keroes wrote: > > On (Mon, Dec 15 14:28), Clint Moore wrote: > > > This begs the question: Who's stepping in? > > > > It's a matter of group consensus. Whomever the mob likes shall be the > > Chosen One. > > For the record, I think you've done a kick @$$ job. Thanks for doing > this. > Agreed, thanks Joshua. -Joe Oppegaard From lemming at quirkyqatz.com Tue Dec 16 12:53:59 2003 From: lemming at quirkyqatz.com (Mark Morgan) Date: Mon Aug 2 21:34:28 2004 Subject: [Pdx-pm] Stepping Down In-Reply-To: References: <20031215224247.32940.qmail@web60801.mail.yahoo.com> Message-ID: <49265.134.134.136.3.1071600839.squirrel@webmail.pair.com> Joe Oppegaard said: > On Mon, 15 Dec 2003, Ovid wrote: > >> --- Joshua Keroes wrote: >> > On (Mon, Dec 15 14:28), Clint Moore wrote: >> > > This begs the question: Who's stepping in? >> > >> > It's a matter of group consensus. Whomever the mob likes shall be >> the Chosen One. >> >> For the record, I think you've done a kick @$$ job. Thanks for doing >> this. >> > > Agreed, thanks Joshua. Thanks Joshua. You've done a great job. -- Mark http://www.kittydream.org - House of Dreams Cat Shelter http://www.quirkyqatz.com/lemming - My own stuff From jeff at vpservices.com Tue Dec 16 13:13:53 2003 From: jeff at vpservices.com (Jeff Zucker) Date: Mon Aug 2 21:34:28 2004 Subject: [Pdx-pm] Stepping Down In-Reply-To: <49265.134.134.136.3.1071600839.squirrel@webmail.pair.com> References: <20031215224247.32940.qmail@web60801.mail.yahoo.com> <49265.134.134.136.3.1071600839.squirrel@webmail.pair.com> Message-ID: <3FDF5971.5050900@vpservices.com> Mark Morgan wrote: >Joe Oppegaard said: > > >>On Mon, 15 Dec 2003, Ovid wrote: >> >> >>For the record, I think you've done a kick @$$ job. Thanks for doing >>this. >> >> >> >>Agreed, thanks Joshua. >> >> > >Thanks Joshua. You've done a great job. > > Yep, thanks a bunch, Joshua. -- Jeff From perl at sonofhans.net Tue Dec 16 13:59:23 2003 From: perl at sonofhans.net (Randall Hansen) Date: Mon Aug 2 21:34:28 2004 Subject: [Pdx-pm] Stepping Down In-Reply-To: <20031215224247.32940.qmail@web60801.mail.yahoo.com> References: <20031215224247.32940.qmail@web60801.mail.yahoo.com> Message-ID: <5860BE54-3002-11D8-BEF7-000A95D9E32C@sonofhans.net> On Dec 15, 2003, at 14:42, Ovid wrote: > For the record, I think you've done a kick @$$ job. Thanks for doing > this. ... adding my voice to the chorus of thanks ... randall From merlyn at stonehenge.com Tue Dec 16 14:01:56 2003 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Mon Aug 2 21:34:28 2004 Subject: [Pdx-pm] Stepping Down In-Reply-To: <5860BE54-3002-11D8-BEF7-000A95D9E32C@sonofhans.net> References: <20031215224247.32940.qmail@web60801.mail.yahoo.com> <5860BE54-3002-11D8-BEF7-000A95D9E32C@sonofhans.net> Message-ID: <86he00lefh.fsf@blue.stonehenge.com> >>>>> "Randall" == Randall Hansen writes: Randall> On Dec 15, 2003, at 14:42, Ovid wrote: >> For the record, I think you've done a kick @$$ job. Thanks for doing >> this. Randall> ... adding my voice to the chorus of thanks ... Randall> randall Ditto. One l randal. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! From raanders at acm.org Tue Dec 16 14:11:24 2003 From: raanders at acm.org (Roderick A. Anderson) Date: Mon Aug 2 21:34:28 2004 Subject: [Pdx-pm] sub calling logic Message-ID: This may fly in the face of good design so you should realize I am not a 'trained' programmer. Some classes but lots of head pounding, beer, swearing, and aspirin (along with LOTS of reading) is how I've learned. I am working on a (#$%^&) CGI program that is getting out of hand quickly. Mostly because I have to deal with a 'less-than-well-documented' XML interface on the back side and changing specifications. So as this thing growns like a fungus in manure I'm trying to ride herd on the code proliferation. A rather cute trick occured to me as I again realized I had missed a test and the script blow chunks ... again. How about placing the subroutine call anywhere I think it might fit and have it decide if it needs to do anything. So instead of if (something) { doit(); } # something is a grep for a key in a hash. I can doit(); sub doit { if (something) { ... } else { return; } } Nothing intensive happening in the sub and no recursion involved. Thanks for any input, Rod -- "Open Source Software - You usually get more than you pay for..." "Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL" From perl at sonofhans.net Tue Dec 16 14:36:52 2003 From: perl at sonofhans.net (Randall Hansen) Date: Mon Aug 2 21:34:28 2004 Subject: [Pdx-pm] sub calling logic In-Reply-To: References: Message-ID: <94D1721E-3007-11D8-BEF7-000A95D9E32C@sonofhans.net> On Dec 16, 2003, at 12:11, Roderick A. Anderson wrote: > sub doit { > > if (something) { > ... > } else { > return; > } > } This looks fine to me. Especially if you're potentially "doing it" more than once, you've reduced the amount of code and left yourself only one bit of logic to debug. Here's another way to write that sub: sub doit { return unless [something]; ... } HTH randall From raanders at acm.org Tue Dec 16 15:00:14 2003 From: raanders at acm.org (Roderick A. Anderson) Date: Mon Aug 2 21:34:28 2004 Subject: [Pdx-pm] sub calling logic In-Reply-To: <94D1721E-3007-11D8-BEF7-000A95D9E32C@sonofhans.net> Message-ID: On Tue, 16 Dec 2003, Randall Hansen wrote: > This looks fine to me. Especially if you're potentially "doing it" > more than once, you've reduced the amount of code and left yourself > only one bit of logic to debug. Oh yeah. Plus sometimes I don't know if I need to doit, but the data does. > Here's another way to write that sub: > > sub doit { > return unless [something]; > ... > } I like this! Gets the exception(s) right up front. Rod -- "Open Source Software - You usually get more than you pay for..." "Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL" From curtis_ovid_poe at yahoo.com Tue Dec 16 14:53:11 2003 From: curtis_ovid_poe at yahoo.com (Ovid) Date: Mon Aug 2 21:34:28 2004 Subject: [Pdx-pm] sub calling logic In-Reply-To: Message-ID: <20031216205311.59723.qmail@web60801.mail.yahoo.com> --- "Roderick A. Anderson" wrote: > How about placing the > subroutine call anywhere I think it might fit and have it decide if > it > needs to do anything. Interesting timing. I just sent an email to a few friends asking for some feedback on OO tips I was putting together and something very similar to this was in there. Rewriting your examples into something we might actually see, you asked if this: if ($error) { log_error($error); } Should be replaced with: sub log_error { my $error = shift; return unless $error; ... } The answer depends upon whether or not log_error() is logically dependent on $error. If it is the case that log_error() cannot proceed unless $error is true, then your decision is a good one. The test of $error belongs in log_error() and not outside of it. Obviously, there is a dependency here, so you're fine. If, however, you have a subroutine named write_current_orders(), you might think that this is okay: sub write_current_orders { my ($file, @orders) = @_; return unless @orders; ... _write_formatted_data($file, $data); } In fact, it probably is okay. However, what if your requirements change and you want to write out a "no orders received at $time" message if you have no orders? Then you might think you have to test orders: if (@orders) { write_current_orders($file, @orders); } else { write_no_order_entry($file); } In this case, we probably don't even want to do that as we can still push this test into the first sub (since "no orders received" is logically dependent on whether or not we have current orders). sub write_current_orders { my ($file, @orders) = @_; my $data = _format_data(@orders); if ($data) { _write_formatted_data($file, $data); } else { _write_formatted_data($file, "no orders received"); } } Here, we've managed to eliminate a useless subroutine and the calling code merely calls the write_current_orders() subroutine without worrying about extra logic. Once again, we have a win, but sometimes we have to think about dependencies to see how. In short, while it's not always the case that we can push logic down that far, the reality is, the closer logic is to the code that actually is dependent on it, the fewer bugs that we will have. Cheers, Ovid ===== Silence is Evil http://users.easystreet.com/ovid/philosophy/indexdecency.htm Ovid http://www.perlmonks.org/index.pl?node_id=17000 Web Programming with Perl http://users.easystreet.com/ovid/cgi_course/ From dpool at hevanet.com Thu Dec 18 20:13:27 2003 From: dpool at hevanet.com (david pool) Date: Mon Aug 2 21:34:28 2004 Subject: [Pdx-pm] [Fwd: [use Perl] Stories for 2003-12-19] Message-ID: <3FE25EC7.8070502@hevanet.com> Whoopee. Sweet 16! david --------------------------------------------- use Perl Daily Newsletter In this issue: * Perl is 16 - Happy Birthday +--------------------------------------------------------------------+ | Perl is 16 - Happy Birthday | | posted by KM on Thursday December 18, @09:28 (news) | | http://use.perl.org/article.pl?sid=03/12/18/1411200 | +--------------------------------------------------------------------+ [0]nicholas writes "Larry Wall released Perl 1 on this day in 1987, so today Perl is 16 years old. Happy birthday Perl! You can read more about the timeline of Perl releases in [1]perlhist.pod and at [2]history.perl.org." Happy birthday Perl. You are now old enough to get a US drivers license. Update : to celebrate this event, Richard Clamp [3]released perl 1.0.16, which you will be able to fetch at [4]ftp://ftp.cpan.org/pub/CPAN/authors/id/R/RC/RCLAMP/perl-1.0_16.tar.gz. Discuss this story at: http://use.perl.org/comments.pl?sid=03/12/18/1411200 Links: 0. http://www.ccl4.org/~nick/ 1. http://search.cpan.org/~nwclark/perl-5.8.2/pod/perlhist.pod 2. http://history.perl.org/ 3. http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2003-12/msg00696.html 4. ftp://ftp.cpan.org/pub/CPAN/authors/id/R/RC/RCLAMP/perl-1.0_16.tar.gz Copyright 1997-2003 pudge. All rights reserved. ====================================================================== You have received this message because you subscribed to it on use Perl. To stop receiving this and other messages from use Perl, or to add more messages or change your preferences, please go to your user page. http://use.perl.org/my/messages/ You can log in and change your preferences from there. From jkeroes at eli.net Mon Dec 22 13:49:46 2003 From: jkeroes at eli.net (Joshua Keroes) Date: Mon Aug 2 21:34:28 2004 Subject: [Pdx-pm] OSCON 2004 call for participation Message-ID: Want to talk at OSCON this summer? It's once again in Portland. Submit your proposal soon, they're due 9 Feb 2004. http://conferences.oreillynet.com/cs/os2004/create/e_sess J From raanders at acm.org Mon Dec 22 18:03:59 2003 From: raanders at acm.org (Roderick A. Anderson) Date: Mon Aug 2 21:34:28 2004 Subject: [Pdx-pm] sub calling logic In-Reply-To: <20031216205311.59723.qmail@web60801.mail.yahoo.com> Message-ID: BTW, this got dropped into the Postpone folder last week because of an interruption and then I was gone to Seattle for my son's graduation and just realized I'd never finished it. On Tue, 16 Dec 2003, Ovid wrote: > The answer depends upon whether or not log_error() is logically > dependent on $error. If it is the case that log_error() cannot proceed > unless $error is true, then your decision is a good one. The test of > $error belongs in log_error() and not outside of it. Obviously, there > is a dependency here, so you're fine. I think this is my case. Much head scratching and deep thought lead me here. > If, however, you have a subroutine named write_current_orders(), you > might think that this is okay: > > sub write_current_orders { > my ($file, @orders) = @_; > return unless @orders; > ... > _write_formatted_data($file, $data); > } Yeah. I almost, in a fit of madness, did this once. My current script has far too many output subs. I'm trying to use the idea above to reduce them to one generalized subroutine and pass in the differing types. -- "Open Source Software - You usually get more than you pay for..." "Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL" From curtis_ovid_poe at yahoo.com Mon Dec 22 18:24:29 2003 From: curtis_ovid_poe at yahoo.com (Ovid) Date: Mon Aug 2 21:34:28 2004 Subject: [Pdx-pm] sub calling logic In-Reply-To: Message-ID: <20031223002429.71236.qmail@web60808.mail.yahoo.com> --- "Roderick A. Anderson" wrote: > Yeah. I almost, in a fit of madness, did this once. My current > script > has far too many output subs. I'm trying to use the idea above to > reduce > them to one generalized subroutine and pass in the differing types. Well, if helps, here's a program that I use a lot at work to summarize web tests that run nightly: # a bunch of use module statements # initialize variables copy($mail_file, $mail_local) or die "Could not copy $mail_file to $mail_local: $!"; my $folder = new Mail::Folder('mbox', $mail_local); print message_summary($folder, $folder->message_list); unlink $mail_local or die "Could not unlink $mail_local: $!"; exit(0); You'll notice that, with the exception of tests on my file operations, there's no logic here. There are only commands. By pushing my iterations and conditionals as far down as I can, I reduce each logical portion of the program to the least complicated structure that I can. I find I write fewer bugs that way, but your mileage may vary. Cheers, Ovid ===== Silence is Evil http://users.easystreet.com/ovid/philosophy/indexdecency.htm Ovid http://www.perlmonks.org/index.pl?node_id=17000 Web Programming with Perl http://users.easystreet.com/ovid/cgi_course/ From curtis_ovid_poe at yahoo.com Mon Dec 22 18:31:25 2003 From: curtis_ovid_poe at yahoo.com (Ovid) Date: Mon Aug 2 21:34:28 2004 Subject: [Pdx-pm] sub calling logic In-Reply-To: <20031223002429.71236.qmail@web60808.mail.yahoo.com> Message-ID: <20031223003125.74204.qmail@web60808.mail.yahoo.com> --- Ovid wrote: > You'll notice that, with the exception of tests on my file > operations, > there's no logic here. There are only commands. Er, in case it wasn't clear, there is logic in the program. I put the subs after the "exit(0)" statement but deliberately left them out of my previous email. By putting all subs after the exit, the actual flow of program behavior can be read by reading just a few lines of code. Cheers, Ovid ===== Silence is Evil http://users.easystreet.com/ovid/philosophy/indexdecency.htm Ovid http://www.perlmonks.org/index.pl?node_id=17000 Web Programming with Perl http://users.easystreet.com/ovid/cgi_course/