From arocker at vex.net Tue Jun 8 12:23:26 2010 From: arocker at vex.net (arocker at vex.net) Date: Tue, 8 Jun 2010 15:23:26 -0400 Subject: [tpm] Dependency chains Message-ID: <5d4ad4536d1e11f4da5606d16b367042.squirrel@webmail.vex.net> Is there any way to check the dependency chain of a CPAN module against an installed configuration in advance of an attempt to install? It would be so much more agreeable to start from the bottom and work upwards, in a series of successes, than to work down through a succession of aborts and then back up, (especially when some of the dependencies appear to be mutual). From fulko.hew at gmail.com Tue Jun 8 12:26:59 2010 From: fulko.hew at gmail.com (Fulko Hew) Date: Tue, 8 Jun 2010 15:26:59 -0400 Subject: [tpm] Dependency chains In-Reply-To: <5d4ad4536d1e11f4da5606d16b367042.squirrel@webmail.vex.net> References: <5d4ad4536d1e11f4da5606d16b367042.squirrel@webmail.vex.net> Message-ID: On Tue, Jun 8, 2010 at 3:23 PM, wrote: > Is there any way to check the dependency chain of a CPAN module against an > installed configuration in advance of an attempt to install? > > It would be so much more agreeable to start from the bottom and work > upwards, in a series of successes, than to work down through a succession > of aborts and then back up, (especially when some of the dependencies > appear to be mutual). I haven't tried it, but because I was looking for other 'module' related stuff this morning I saw: CPAN::FindDependencies http://search.cpan.org/~dcantrell/CPAN-FindDependencies-2.34/lib/CPAN/FindDependencies.pm -------------- next part -------------- An HTML attachment was scrubbed... URL: From dave.s.doyle at gmail.com Tue Jun 8 12:34:54 2010 From: dave.s.doyle at gmail.com (Dave Doyle) Date: Tue, 8 Jun 2010 15:34:54 -0400 Subject: [tpm] Dependency chains In-Reply-To: References: <5d4ad4536d1e11f4da5606d16b367042.squirrel@webmail.vex.net> Message-ID: If you wish to do it while browsing instead of programmaticly you can just do a search on search.cpan.org and look at the POD of the module. Beneath the author photo, and download link in the upper right there's a "Dependencies" link that gets you a nifty page like this: http://deps.cpantesters.org/?module=Params::Validate;perl=latest (including test stats) -- dave.s.doyle at gmail.com On Tue, Jun 8, 2010 at 3:26 PM, Fulko Hew wrote: > > On Tue, Jun 8, 2010 at 3:23 PM, wrote: > > > Is there any way to check the dependency chain of a CPAN module against > an > > installed configuration in advance of an attempt to install? > > > > It would be so much more agreeable to start from the bottom and work > > upwards, in a series of successes, than to work down through a succession > > of aborts and then back up, (especially when some of the dependencies > > appear to be mutual). > > I haven't tried it, but because I was looking for other 'module' related > stuff this > morning I saw: > > CPAN::FindDependencies > > > http://search.cpan.org/~dcantrell/CPAN-FindDependencies-2.34/lib/CPAN/FindDependencies.pm > > > > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From steve at ipv6canada.com Tue Jun 8 15:19:04 2010 From: steve at ipv6canada.com (Steve Bertrand) Date: Tue, 08 Jun 2010 18:19:04 -0400 Subject: [tpm] Introduction Message-ID: <4C0EC1D8.3020806@ipv6canada.com> Hi all, I just found this list a few days ago after doing some research based on a comment regarding Boston PM by Uri over on the -beginners list. I live in Port Hope (an hour east of Toronto), and work 10km east of that in Cobourg. My Perl development began about 10 years ago creating small automation/maintenance scripts for an ISP network, and a bunch of FreeBSD servers. Currently, I'm working on a few very large and elaborate application systems, the primary being an ISP management, user-based-billing and accounting system (amongst other things). I'm hoping to get involved face-to-face with people in the Perl community now that more of my time is spent writing production-quality code. Cheers! Steve -- Steve Bertrand Senior Network Manager eagle.ca Internet Services p: 905.373.9313 c: 905.269.0453 IPv6 enabled since March, 2008! From arocker at vex.net Wed Jun 9 07:43:20 2010 From: arocker at vex.net (arocker at vex.net) Date: Wed, 9 Jun 2010 10:43:20 -0400 Subject: [tpm] Dependency chains In-Reply-To: References: <5d4ad4536d1e11f4da5606d16b367042.squirrel@webmail.vex.net> Message-ID: <177f759ba625320a68d1c53e53e33705.squirrel@webmail.vex.net> > > CPAN::FindDependencies > > http://search.cpan.org/~dcantrell/CPAN-FindDependencies-2.34/lib/CPAN/FindDependencies.pm > Thanks. Fulko. Unfortunately, we seem to have a recursive problem here. That module's list of dependencies is rather longer than the modules' that I'm trying to investigate. :-(* From arocker at vex.net Wed Jun 9 12:51:05 2010 From: arocker at vex.net (arocker at vex.net) Date: Wed, 9 Jun 2010 15:51:05 -0400 Subject: [tpm] [Fwd: Re: Dependency chains] Message-ID: <69edba95297928fdc4e3806c07b85f38.squirrel@webmail.vex.net> >> > Have you checked out Module::ScanDeps? > I've just taken a look at it, and I see 2 problems. The first is that it is at the wrong end of the pipeline; it's for people who have code locally, for which they want to establish the dependencies before transferring. The second, fatal, problem, is that it has a fairly hefty list of dependencies of its own, many of which are the very modules that sent me down this particular rabbit-hole in the first place. From arocker at vex.net Wed Jun 9 14:28:20 2010 From: arocker at vex.net (arocker at vex.net) Date: Wed, 9 Jun 2010 17:28:20 -0400 Subject: [tpm] Introduction In-Reply-To: <4C0EC1D8.3020806@ipv6canada.com> References: <4C0EC1D8.3020806@ipv6canada.com> Message-ID: > > I'm hoping to get involved face-to-face with people in the Perl > community now that more of my time is spent writing production-quality > code. > Welcome to TPM. We're always happy to see new faces, especially from lovely, radioactive, Port Hope. From legrady at gmail.com Wed Jun 9 15:39:32 2010 From: legrady at gmail.com (Tom Legrady) Date: Wed, 9 Jun 2010 18:39:32 -0400 Subject: [tpm] Introduction In-Reply-To: References: <4C0EC1D8.3020806@ipv6canada.com> Message-ID: You're just mis-interpreting a healthy glow, Alan On Wed, Jun 9, 2010 at 5:28 PM, wrote: > > > > I'm hoping to get involved face-to-face with people in the Perl > > community now that more of my time is spent writing production-quality > > code. > > > Welcome to TPM. > > We're always happy to see new faces, especially from lovely, radioactive, > Port Hope. > > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm > -------------- next part -------------- An HTML attachment was scrubbed... URL: From steve at ipv6canada.com Wed Jun 9 17:07:30 2010 From: steve at ipv6canada.com (Steve Bertrand) Date: Wed, 09 Jun 2010 20:07:30 -0400 Subject: [tpm] Introduction In-Reply-To: References: <4C0EC1D8.3020806@ipv6canada.com> Message-ID: <4C102CC2.6040402@ipv6canada.com> On 2010.06.09 17:28, arocker at vex.net wrote: >> >> I'm hoping to get involved face-to-face with people in the Perl >> community now that more of my time is spent writing production-quality >> code. >> > Welcome to TPM. > > We're always happy to see new faces, especially from lovely, radioactive, > Port Hope. heh My girl works as a Health and Safety Officer (CRSP) at the conversion facility. I assure you that if I ever make it to a meeting, the glow that I will light up the room with will be due to my endless love for Perl, and not because of radiation. ...besides, the extra eye, and the two extra fingers that have grown since I moved here allow me to write code, manage the bug system and keep my POD up-to-date simultaneously, at an alarmingly fast rate :) Cheers, Steve From thakore.kartik at gmail.com Fri Jun 11 05:59:26 2010 From: thakore.kartik at gmail.com (Kartik Thakore) Date: Fri, 11 Jun 2010 08:59:26 -0400 Subject: [tpm] Introduction In-Reply-To: <4C0EC1D8.3020806@ipv6canada.com> References: <4C0EC1D8.3020806@ipv6canada.com> Message-ID: <0DFB5189-B80F-4A59-8F09-C944AEDA754E@gmail.com> Welcome to Toronto PM. Kartik Thakore On 2010-06-08, at 6:19 PM, Steve Bertrand wrote: > Hi all, > > I just found this list a few days ago after doing some research > based on > a comment regarding Boston PM by Uri over on the -beginners list. > > I live in Port Hope (an hour east of Toronto), and work 10km east of > that in Cobourg. > > My Perl development began about 10 years ago creating small > automation/maintenance scripts for an ISP network, and a bunch of > FreeBSD servers. > > Currently, I'm working on a few very large and elaborate application > systems, the primary being an ISP management, user-based-billing and > accounting system (amongst other things). > > I'm hoping to get involved face-to-face with people in the Perl > community now that more of my time is spent writing production- > quality code. > > Cheers! > > Steve > > -- > Steve Bertrand > Senior Network Manager > eagle.ca Internet Services > p: 905.373.9313 > c: 905.269.0453 > > IPv6 enabled since March, 2008! > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm From arocker at vex.net Tue Jun 15 12:09:54 2010 From: arocker at vex.net (arocker at vex.net) Date: Tue, 15 Jun 2010 15:09:54 -0400 Subject: [tpm] Driving to YAPC Message-ID: Is anybody driving to YAPC with significant seating spare? From jbl at jbldata.com Wed Jun 16 14:15:29 2010 From: jbl at jbldata.com (J. Bobby Lopez) Date: Wed, 16 Jun 2010 17:15:29 -0400 Subject: [tpm] Automatically generating HTML forms from perl data structures Message-ID: Hey All, I'm currently working on some tools which aim to read in JSON data into perl data structures (with JSON::XS), and then automatically generate TT templates for HTML forms, based on the data types of the elements within the data structure. So far I have working code, but I was curious if were more common ways of doing this? I've searched CPAN for similar modules, but haven't found any so far. Template Toolkit isn't necessary, but I figured I'd incorporate that early since it makes dealing with HTML much less cumbersome. The basic goal is to be able to read JSON data and dynamically generate an HTML form (without hard-coding any of the name/value elements), and then use that form to save the data back to JSON format. Experience with XML would likely be relevant here as well. Thanks! Bobby -------------- next part -------------- An HTML attachment was scrubbed... URL: From uri at StemSystems.com Wed Jun 16 14:25:07 2010 From: uri at StemSystems.com (Uri Guttman) Date: Wed, 16 Jun 2010 17:25:07 -0400 Subject: [tpm] Automatically generating HTML forms from perl data structures In-Reply-To: (J. Bobby Lopez's message of "Wed\, 16 Jun 2010 17\:15\:29 -0400") References: Message-ID: <87hbl26570.fsf@quad.sysarch.com> >>>>> "JBL" == J Bobby Lopez writes: JBL> I'm currently working on some tools which aim to read in JSON JBL> data into perl data structures (with JSON::XS), and then JBL> automatically generate TT templates for HTML forms, based on the JBL> data types of the elements within the data structure. JBL> So far I have working code, but I was curious if were more common JBL> ways of doing this?? I've searched CPAN for similar modules, but JBL> haven't found any so far. JBL> Template Toolkit isn't necessary, but I figured I'd incorporate JBL> that early since it makes dealing with HTML much less JBL> cumbersome.? The basic goal is to be able to read JSON data and JBL> dynamically generate an HTML form (without hard-coding any of the JBL> name/value elements), and then use that form to save the data JBL> back to JSON format. to make your life simpler, check out Template::Simple. it can do all the template work you need but is much simpler (only 4 markups) and much faster. what you can do is create smaller templates for each type of data and then build up a larger template from them. then you can render that with the json data. you can even use the module in a dual role. the metatemplates would use a different delimiter than the field ones so you can render both levels given the correct data trees. it really comes down to how you want your html to look and such. if you can factor out all common parts and meta parts then you can template it all. uri -- Uri Guttman ------ uri at stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com --------- From adam.prime at utoronto.ca Wed Jun 16 16:30:22 2010 From: adam.prime at utoronto.ca (Adam Prime) Date: Wed, 16 Jun 2010 19:30:22 -0400 Subject: [tpm] Automatically generating HTML forms from perl data structures In-Reply-To: References: Message-ID: <4C195E8E.9090203@utoronto.ca> None of the Form generation stuff that i've seen is designed to take JSON and generate forms. There are a bunch of form handling modules out there though, that do various stuff. FormFu has the ability to generate forms based on yaml configuration files, which is somewhat similar to what you're doing. I've used: Rose::HTML::Form HTML::FormFu I haven't used, but i know people like: HTML::FormHandler There are other things out there too. Adam J. Bobby Lopez wrote: > Hey All, > > I'm currently working on some tools which aim to read in JSON data into > perl data structures (with JSON::XS), and then automatically generate TT > templates for HTML forms, based on the data types of the elements within > the data structure. > > So far I have working code, but I was curious if were more common ways > of doing this? I've searched CPAN for similar modules, but haven't > found any so far. > > Template Toolkit isn't necessary, but I figured I'd incorporate that > early since it makes dealing with HTML much less cumbersome. The basic > goal is to be able to read JSON data and dynamically generate an HTML > form (without hard-coding any of the name/value elements), and then use > that form to save the data back to JSON format. > > Experience with XML would likely be relevant here as well. > > Thanks! > > Bobby > > > ------------------------------------------------------------------------ > > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm From steve at ipv6canada.com Wed Jun 16 17:16:49 2010 From: steve at ipv6canada.com (Steve Bertrand) Date: Wed, 16 Jun 2010 20:16:49 -0400 Subject: [tpm] Driving to YAPC In-Reply-To: References: Message-ID: <4C196971.8010909@ipv6canada.com> On 2010.06.15 15:09, arocker at vex.net wrote: > > Is anybody driving to YAPC with significant seating spare? Where are you coming from? (I assume you're referring to Ohio yapc, yes?) Steve From mike at stok.ca Fri Jun 18 16:10:02 2010 From: mike at stok.ca (Mike Stok) Date: Fri, 18 Jun 2010 19:10:02 -0400 Subject: [tpm] Meeting - June 24, 18:45 Perl and phones Message-ID: <7F815467-9807-4B0C-A2BC-2349E8C48ED7@stok.ca> FOr all the Toronto Perl mongers who aren't en route from YAPC::NA... And if you are going to YAPC::NA please consider volunteering for a few moments at the July meeting to share the YAPC goodness with the rest of us! See http://to.pm.org for details. When I have the room information I'll update the web site and resend the email. Date: Thu 24 Jun 2010 18:45 EDT Venue: Nexient Topic: Perl and Phones (part II) Synopsis: This month we have Scott's talk on Perl on Android. Scott Elcomb: Perl on Android Location: 2 Bloor Street West, (usually) 8th or 16th floor. The room number will be announced on the mailing list a few days before the meeting. It will also be left with the security desk in the building (main floor lobby) shortly before the meeting starts (i.e. around 6pm). Time: 6:45 p.m. Directions: This building is on the north-west corner of Bloor and Yonge, accessible by subway from Bloor station. Pay parking is also ample in this area. Security note: The elevators in the building are "locked down" after 5:30pm to people without building access cards. Leading up to the meeting someone will come down to the main floor lobby every few minutes to ferry people upstairs. There will be a number of scheduled trips: ? 17:30 ? 18:00 ? 18:30 ? 18:45 ? 19:00 After 19:00, you can reach the access-card-carrying guy via a cell phone number that we'll leave with security in the front lobby. The room and floor numbers will be left with security too. If any latecomers call up there will be a final group elevator run at 19:10. After that, access will be ad-hoc; call up from security and somebody will try to come down and let you up. -- Mike Stok http://www.stok.ca/~mike/ The "`Stok' disclaimers" apply. From mike at stok.ca Wed Jun 23 09:25:56 2010 From: mike at stok.ca (Mike Stok) Date: Wed, 23 Jun 2010 12:25:56 -0400 Subject: [tpm] Meeting - June 24, 18:45 Perl and phones In-Reply-To: <7F815467-9807-4B0C-A2BC-2349E8C48ED7@stok.ca> References: <7F815467-9807-4B0C-A2BC-2349E8C48ED7@stok.ca> Message-ID: <49E58051-46B2-442B-8698-0A7BF65E0228@stok.ca> For all the Toronto Perl mongers who aren't en route from YAPC::NA... And if you are going to YAPC::NA please consider volunteering for a few moments at the July meeting to share the YAPC goodness with the rest of us! Date: Thu 24 Jun 2010 18:45 EDT Venue: Nexient; Room 7 on the 12th floor Topic: Perl and Phones (part II) Synopsis: This month we have Scott's talk on Perl on Android. Scott Elcomb: Perl on Android Location: 2 Bloor Street West, (usually) 8th or 16th floor. The room number will be announced on the mailing list a few days before the meeting. It will also be left with the security desk in the building (main floor lobby) shortly before the meeting starts (i.e. around 6pm). Time: 6:45 p.m. Directions: This building is on the north-west corner of Bloor and Yonge, accessible by subway from Bloor station. Pay parking is also ample in this area. Security note: The elevators in the building are "locked down" after 5:30pm to people without building access cards. Leading up to the meeting someone will come down to the main floor lobby every few minutes to ferry people upstairs. There will be a number of scheduled trips: ? 17:30 ? 18:00 ? 18:30 ? 18:45 ? 19:00 After 19:00, you can reach the access-card-carrying guy via a cell phone number that we'll leave with security in the front lobby. The room and floor numbers will be left with security too. If any latecomers call up there will be a final group elevator run at 19:10. After that, access will be ad-hoc; call up from security and somebody will try to come down and let you up. http://to.pm.org/ -- Mike Stok http://www.stok.ca/~mike/ The "`Stok' disclaimers" apply. From fulko.hew at gmail.com Wed Jun 23 16:22:27 2010 From: fulko.hew at gmail.com (Fulko Hew) Date: Wed, 23 Jun 2010 19:22:27 -0400 Subject: [tpm] Attempt to free unreferenced scalar Message-ID: I'm in the process of developing a module, and during a very simple test (when the program exits, and things get auto-cleaned-up, I get the following error message: Attempt to free unreferenced scalar: SV 0x8c1cc28, Perl interpreter: 0x8c1c008. I know I'm probably doing something wrong somewhere, or better put: 'I'm not doing something I should be doing', but... Whats the process of trying to figure out whats causing this error? How do I find out what was in the variable at '0x8c1cc28'? If I knew that, I may be able to figure out whats wrong. Suggestions anyone? TIA Fulko -------------- next part -------------- An HTML attachment was scrubbed... URL: From mike at stok.ca Wed Jun 23 19:35:57 2010 From: mike at stok.ca (Mike Stok) Date: Wed, 23 Jun 2010 22:35:57 -0400 Subject: [tpm] Attempt to free unreferenced scalar In-Reply-To: References: Message-ID: On Jun 23, 2010, at 7:22 PM, Fulko Hew wrote: > > I'm in the process of developing a module, and during a very simple > test (when the program exits, and things get auto-cleaned-up, I get the > following error message: > > Attempt to free unreferenced scalar: SV 0x8c1cc28, Perl interpreter: 0x8c1c008. > > I know I'm probably doing something wrong somewhere, or better put: > 'I'm not doing something I should be doing', but... > > Whats the process of trying to figure out whats causing this error? > How do I find out what was in the variable at '0x8c1cc28'? > If I knew that, I may be able to figure out whats wrong. > > Suggestions anyone? What version of perl? I have seen problems reported with 5.10.0 which were fixed in 5.10.1 e.g. http://www.gossamer-threads.com/lists/engine?do=post_view_printable;post=245361;list=perl Mike -- Mike Stok http://www.stok.ca/~mike/ The "`Stok' disclaimers" apply. -------------- next part -------------- An HTML attachment was scrubbed... URL: From fulko.hew at gmail.com Thu Jun 24 06:08:46 2010 From: fulko.hew at gmail.com (Fulko Hew) Date: Thu, 24 Jun 2010 09:08:46 -0400 Subject: [tpm] Attempt to free unreferenced scalar In-Reply-To: References: Message-ID: On Wed, Jun 23, 2010 at 10:35 PM, Mike Stok wrote: > > On Jun 23, 2010, at 7:22 PM, Fulko Hew wrote: > > > I'm in the process of developing a module, and during a very simple > test (when the program exits, and things get auto-cleaned-up, I get the > following error message: > > Attempt to free unreferenced scalar: SV 0x8c1cc28, Perl interpreter: > 0x8c1c008. > > I know I'm probably doing something wrong somewhere, or better put: > 'I'm not doing something I should be doing', but... > > Whats the process of trying to figure out whats causing this error? > How do I find out what was in the variable at '0x8c1cc28'? > If I knew that, I may be able to figure out whats wrong. > > Suggestions anyone? > > > What version of perl? I have seen problems reported with 5.10.0 which were > fixed in 5.10.1 e.g. > http://www.gossamer-threads.com/lists/engine?do=post_view_printable;post=245361;list=perl > Specifically version 5.8.8. And yes, I saw the issues with specific versions, but I felt it was an issue with my code. I've solved it (details below), but my generic question remains: "Given a memory address, how can I dump the contents of the associated variable?" I see a number of modules on CPAN to: dump the internal structure of scalars, dump symbol tables, dump memory usage of variables, etc. but not a 'dump the variable at a memory location'. If I had something like that, I could have seen the value of the data, and immediately recognized where that data was being generated and stored. OK... Back to _my_ problem. It turned out that I was storing a global variable into a hash element inside an object. Once I made it a 'my' variable, the problem went away. The (bad) pseudo code would be: foreach $name (@names) { MYCLASS->new(name=>$name); } whereas it should have been: foreach my $name (@names) { MYCLASS->new(name=>$name); } -------------- next part -------------- An HTML attachment was scrubbed... URL: From olaf at vilerichard.com Fri Jun 25 11:01:23 2010 From: olaf at vilerichard.com (Olaf Alders) Date: Fri, 25 Jun 2010 14:01:23 -0400 Subject: [tpm] Meeting - June 24, 18:45 Perl and phones In-Reply-To: <49E58051-46B2-442B-8698-0A7BF65E0228@stok.ca> References: <7F815467-9807-4B0C-A2BC-2349E8C48ED7@stok.ca> <49E58051-46B2-442B-8698-0A7BF65E0228@stok.ca> Message-ID: <3C34E242-4F6C-47CC-888E-5D82A7AAC0A4@vilerichard.com> Are there any slides available for those of us who missed last night's talk? Olaf -- Olaf Alders olaf at vilerichard.com http://vilerichard.com -- folk rock http://twitter.com/vilerichard http://cdbaby.com/cd/vilerichard From psema4 at gmail.com Fri Jun 25 13:02:49 2010 From: psema4 at gmail.com (Scott Elcomb) Date: Fri, 25 Jun 2010 16:02:49 -0400 Subject: [tpm] Meeting - June 24, 18:45 Perl and phones In-Reply-To: <3C34E242-4F6C-47CC-888E-5D82A7AAC0A4@vilerichard.com> References: <7F815467-9807-4B0C-A2BC-2349E8C48ED7@stok.ca> <49E58051-46B2-442B-8698-0A7BF65E0228@stok.ca> <3C34E242-4F6C-47CC-888E-5D82A7AAC0A4@vilerichard.com> Message-ID: On Fri, Jun 25, 2010 at 2:01 PM, Olaf Alders wrote: > Are there any slides available for those of us who missed last night's talk? Not yet, but I will try to get them posted up later tonight. Take care, - Scott -- Scott Elcomb http://www.psema4.com/ @psema4 Member of the Pirate Party of Canada http://www.pirateparty.ca/ From mike at stok.ca Tue Jun 29 18:59:21 2010 From: mike at stok.ca (Mike Stok) Date: Tue, 29 Jun 2010 21:59:21 -0400 Subject: [tpm] July meeting call for speakers (YAPC::NA debrief) Message-ID: <702B2B3C-B1A3-42C9-8644-FE5E9C2EC138@stok.ca> I'd like to get an idea of who can talk for a few minutes about the highlights of their YAPC::NA trip at the next Toronto Perl Mongers meeting, scheduled for 29 July 2010. If you went to YAPC::NA and think you could do 5, 10, or more minutes on the interesting bits then let me know on or off list. Thanks, Mike -- Mike Stok http://www.stok.ca/~mike/ The "`Stok' disclaimers" apply. -------------- next part -------------- An HTML attachment was scrubbed... URL: From fulko.hew at gmail.com Wed Jun 30 08:06:49 2010 From: fulko.hew at gmail.com (Fulko Hew) Date: Wed, 30 Jun 2010 11:06:49 -0400 Subject: [tpm] how to delete array entries en-passant Message-ID: As the subject line asks... what I'd like to do is something like foreach (@array) { if (condition) { splice @array, this_entry, 1; next; } do processing on this entry; } @array now contains a sub-set of the original that I can now further process 'delete' might work, but the words say delete on arrays is deprecated and it still doesn't give me the delete 'this' entry concept, because it too works on an index. I'd like to do it without creating another array, because I like 'premature optimizations' and because I think it would make the code more readable. :-) TIA Fulko -------------- next part -------------- An HTML attachment was scrubbed... URL: From shlomif at iglu.org.il Wed Jun 30 08:41:06 2010 From: shlomif at iglu.org.il (Shlomi Fish) Date: Wed, 30 Jun 2010 18:41:06 +0300 Subject: [tpm] how to delete array entries en-passant In-Reply-To: References: Message-ID: <201006301841.07024.shlomif@iglu.org.il> Hi Fulko, On Wednesday 30 Jun 2010 18:06:49 Fulko Hew wrote: > As the subject line asks... > what I'd like to do is something like > > foreach (@array) { > if (condition) { > splice @array, this_entry, 1; > next; > } > do processing on this entry; > } > > @array now contains a sub-set of the original > that I can now further process > It's always a bad idea to modify the order of an array's elements while iterating over it using foreach. Don't do that. I should also note splicing an index out of the middle of an array is an O(N) operation where N is the number of elements in the array. > > > > 'delete' might work, but the words say delete on arrays is deprecated > and it still doesn't give me the delete 'this' entry concept, because > it too works on an index. > > I'd like to do it without creating another array, because I like > 'premature optimizations' and because I think it would make the > code more readable. :-) It will likely make things slower and less readable (assuming it will work at all), so don't do that. Regards, Shlomi Fish -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Freecell Solver - http://fc-solve.berlios.de/ God considered inflicting XSLT as the tenth plague of Egypt, but then decided against it because he thought it would be too evil. Please reply to list if it's a mailing list post - http://shlom.in/reply . From shlomif at iglu.org.il Wed Jun 30 08:41:06 2010 From: shlomif at iglu.org.il (Shlomi Fish) Date: Wed, 30 Jun 2010 18:41:06 +0300 Subject: [tpm] how to delete array entries en-passant In-Reply-To: References: Message-ID: <201006301841.07024.shlomif@iglu.org.il> Hi Fulko, On Wednesday 30 Jun 2010 18:06:49 Fulko Hew wrote: > As the subject line asks... > what I'd like to do is something like > > foreach (@array) { > if (condition) { > splice @array, this_entry, 1; > next; > } > do processing on this entry; > } > > @array now contains a sub-set of the original > that I can now further process > It's always a bad idea to modify the order of an array's elements while iterating over it using foreach. Don't do that. I should also note splicing an index out of the middle of an array is an O(N) operation where N is the number of elements in the array. > > > > 'delete' might work, but the words say delete on arrays is deprecated > and it still doesn't give me the delete 'this' entry concept, because > it too works on an index. > > I'd like to do it without creating another array, because I like > 'premature optimizations' and because I think it would make the > code more readable. :-) It will likely make things slower and less readable (assuming it will work at all), so don't do that. Regards, Shlomi Fish -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Freecell Solver - http://fc-solve.berlios.de/ God considered inflicting XSLT as the tenth plague of Egypt, but then decided against it because he thought it would be too evil. Please reply to list if it's a mailing list post - http://shlom.in/reply . From indy at indigostar.com Wed Jun 30 08:49:10 2010 From: indy at indigostar.com (Indy Singh) Date: Wed, 30 Jun 2010 11:49:10 -0400 Subject: [tpm] how to delete array entries en-passant References: Message-ID: <6543CDDEF9D244938C123FAA92DBCF3E@ROADKILL> Modifying the array while iterating through the array is usually something to be avoided when writing clear code. Don't do it. What would you expect the foreach function to return when you are modifying the list under its feet? You may also want to look at using the grep and map functions. Indy Singh IndigoSTAR Software -- www.indigostar.com ----- Original Message ----- From: Fulko Hew To: TPM Sent: Wednesday, June 30, 2010 11:06 AM Subject: [tpm] how to delete array entries en-passant As the subject line asks... what I'd like to do is something like foreach (@array) { if (condition) { splice @array, this_entry, 1; next; } do processing on this entry; } @array now contains a sub-set of the original that I can now further process 'delete' might work, but the words say delete on arrays is deprecated and it still doesn't give me the delete 'this' entry concept, because it too works on an index. I'd like to do it without creating another array, because I like 'premature optimizations' and because I think it would make the code more readable. :-) TIA Fulko ------------------------------------------------------------------------------ _______________________________________________ toronto-pm mailing list toronto-pm at pm.org http://mail.pm.org/mailman/listinfo/toronto-pm -------------- next part -------------- An HTML attachment was scrubbed... URL: From shlomif at iglu.org.il Wed Jun 30 09:02:55 2010 From: shlomif at iglu.org.il (Shlomi Fish) Date: Wed, 30 Jun 2010 19:02:55 +0300 Subject: [tpm] how to delete array entries en-passant In-Reply-To: <6543CDDEF9D244938C123FAA92DBCF3E@ROADKILL> References: <6543CDDEF9D244938C123FAA92DBCF3E@ROADKILL> Message-ID: <201006301902.55837.shlomif@iglu.org.il> On Wednesday 30 Jun 2010 18:49:10 Indy Singh wrote: > Modifying the array while iterating through the array is usually something > to be avoided when writing clear code. Don't do it. Well, you are allowed to modify the elements themselves one at a time, using something like: foreach my $var (@array) { $var = SOMETHING_ELSE($var); } But modifying the order of the elements should be avoided. > > What would you expect the foreach function to return when you are modifying > the list under its feet? A few notes - in Perl, foreach is not a function - it's a loop construct with some magic. And one should not rely on the return value of a foreach list - use it only for side-effects. > > You may also want to look at using the grep and map functions. > Right. Regards, Shlomi Fish > Indy Singh > IndigoSTAR Software -- www.indigostar.com > -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Why I Love Perl - http://shlom.in/joy-of-perl God considered inflicting XSLT as the tenth plague of Egypt, but then decided against it because he thought it would be too evil. Please reply to list if it's a mailing list post - http://shlom.in/reply . From shlomif at iglu.org.il Wed Jun 30 09:02:55 2010 From: shlomif at iglu.org.il (Shlomi Fish) Date: Wed, 30 Jun 2010 19:02:55 +0300 Subject: [tpm] how to delete array entries en-passant In-Reply-To: <6543CDDEF9D244938C123FAA92DBCF3E@ROADKILL> References: <6543CDDEF9D244938C123FAA92DBCF3E@ROADKILL> Message-ID: <201006301902.55837.shlomif@iglu.org.il> On Wednesday 30 Jun 2010 18:49:10 Indy Singh wrote: > Modifying the array while iterating through the array is usually something > to be avoided when writing clear code. Don't do it. Well, you are allowed to modify the elements themselves one at a time, using something like: foreach my $var (@array) { $var = SOMETHING_ELSE($var); } But modifying the order of the elements should be avoided. > > What would you expect the foreach function to return when you are modifying > the list under its feet? A few notes - in Perl, foreach is not a function - it's a loop construct with some magic. And one should not rely on the return value of a foreach list - use it only for side-effects. > > You may also want to look at using the grep and map functions. > Right. Regards, Shlomi Fish > Indy Singh > IndigoSTAR Software -- www.indigostar.com > -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Why I Love Perl - http://shlom.in/joy-of-perl God considered inflicting XSLT as the tenth plague of Egypt, but then decided against it because he thought it would be too evil. Please reply to list if it's a mailing list post - http://shlom.in/reply . From fulko.hew at gmail.com Wed Jun 30 09:11:33 2010 From: fulko.hew at gmail.com (Fulko Hew) Date: Wed, 30 Jun 2010 12:11:33 -0400 Subject: [tpm] how to delete array entries en-passant In-Reply-To: <201006301841.07024.shlomif@iglu.org.il> References: <201006301841.07024.shlomif@iglu.org.il> Message-ID: On Wed, Jun 30, 2010 at 11:41 AM, Shlomi Fish wrote: > Hi Fulko, > > On Wednesday 30 Jun 2010 18:06:49 Fulko Hew wrote: > > As the subject line asks... > > what I'd like to do is something like > > > > foreach (@array) { > > if (condition) { > > splice @array, this_entry, 1; > > next; > > } > > do processing on this entry; > > } > > > > @array now contains a sub-set of the original > > that I can now further process > > > > It's always a bad idea to modify the order of an array's elements while > iterating over it using foreach. Don't do that. > OK, let me give you the specific example... The array contains all of the lines of a file... The foreach is used to loop over then, and 'take action' upon them. But when I'm done I want all the empty lines stripped from the array ('just because!') > I should also note splicing an index out of the middle of an array is an > O(N) > operation where N is the number of elements in the array. > I know, thats why I was looking for a 'faster' technique. I guess the alternative could be (shown simplified): my @array; while ($_ = <>) { next unless $_; # skip empty lines push @array, $_; # but remember non-empty lines process($_); } -------------- next part -------------- An HTML attachment was scrubbed... URL: From fulko.hew at gmail.com Wed Jun 30 09:11:33 2010 From: fulko.hew at gmail.com (Fulko Hew) Date: Wed, 30 Jun 2010 12:11:33 -0400 Subject: [tpm] how to delete array entries en-passant In-Reply-To: <201006301841.07024.shlomif@iglu.org.il> References: <201006301841.07024.shlomif@iglu.org.il> Message-ID: On Wed, Jun 30, 2010 at 11:41 AM, Shlomi Fish wrote: > Hi Fulko, > > On Wednesday 30 Jun 2010 18:06:49 Fulko Hew wrote: > > As the subject line asks... > > what I'd like to do is something like > > > > foreach (@array) { > > if (condition) { > > splice @array, this_entry, 1; > > next; > > } > > do processing on this entry; > > } > > > > @array now contains a sub-set of the original > > that I can now further process > > > > It's always a bad idea to modify the order of an array's elements while > iterating over it using foreach. Don't do that. > OK, let me give you the specific example... The array contains all of the lines of a file... The foreach is used to loop over then, and 'take action' upon them. But when I'm done I want all the empty lines stripped from the array ('just because!') > I should also note splicing an index out of the middle of an array is an > O(N) > operation where N is the number of elements in the array. > I know, thats why I was looking for a 'faster' technique. I guess the alternative could be (shown simplified): my @array; while ($_ = <>) { next unless $_; # skip empty lines push @array, $_; # but remember non-empty lines process($_); } -------------- next part -------------- An HTML attachment was scrubbed... URL: From sfryer at sourcery.ca Wed Jun 30 09:25:44 2010 From: sfryer at sourcery.ca (Shaun Fryer) Date: Wed, 30 Jun 2010 12:25:44 -0400 Subject: [tpm] how to delete array entries en-passant In-Reply-To: References: <201006301841.07024.shlomif@iglu.org.il> Message-ID: @array = grep {!/^\s*\z/} @array; # strip empty (or whitespace only) lines -- Shaun Fryer On Wed, Jun 30, 2010 at 12:11 PM, Fulko Hew wrote: > > > On Wed, Jun 30, 2010 at 11:41 AM, Shlomi Fish wrote: >> >> Hi Fulko, >> >> On Wednesday 30 Jun 2010 18:06:49 Fulko Hew wrote: >> > As the subject line asks... >> > what I'd like to do is something like >> > >> > foreach (@array) { >> > ? ? if (condition) { >> > ? ? ? ? splice @array, this_entry, 1; >> > ? ? ? ? next; >> > ? ? } >> > ? ? do processing on this entry; >> > } >> > >> > @array now contains a sub-set of the original >> > that I can now further process >> > >> >> It's always a bad idea to modify the order of an array's elements while >> iterating over it using foreach. Don't do that. > > OK, let me give you the specific example... > The array contains all of the lines of a file... > The foreach is used to loop over then, and 'take action' upon them. > But when I'm done I want all the empty lines stripped from the array ('just > because!') > >> >> I should also note splicing an index out of the middle of an array is an >> O(N) >> operation where N is the number of elements in the array. > > I know, thats why I was looking for a 'faster' technique. > > I guess the alternative could be (shown simplified): > > my @array; > while ($_ = <>) { > ??? next unless $_;????? # skip empty lines > ??? push @array, $_;???? # but remember non-empty lines > ? ? process($_); > } > > > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm > > From arocker at vex.net Wed Jun 30 09:31:40 2010 From: arocker at vex.net (arocker at vex.net) Date: Wed, 30 Jun 2010 12:31:40 -0400 Subject: [tpm] how to delete array entries en-passant In-Reply-To: References: <201006301841.07024.shlomif@iglu.org.il> Message-ID: <3576f48081d11bfbed9fe81febbdc064.squirrel@webmail.vex.net> > > OK, let me give you the specific example... > The array contains all of the lines of a file... > The foreach is used to loop over then, and 'take action' upon them. > But when I'm done I want all the empty lines stripped from the array > ('just > because!') > Does the process require the presence of the entire file in memory before the loop, and the shuffled-down file afterwards? Do you output the remaining lines? From arocker at vex.net Wed Jun 30 09:31:40 2010 From: arocker at vex.net (arocker at vex.net) Date: Wed, 30 Jun 2010 12:31:40 -0400 Subject: [tpm] how to delete array entries en-passant In-Reply-To: References: <201006301841.07024.shlomif@iglu.org.il> Message-ID: <3576f48081d11bfbed9fe81febbdc064.squirrel@webmail.vex.net> > > OK, let me give you the specific example... > The array contains all of the lines of a file... > The foreach is used to loop over then, and 'take action' upon them. > But when I'm done I want all the empty lines stripped from the array > ('just > because!') > Does the process require the presence of the entire file in memory before the loop, and the shuffled-down file afterwards? Do you output the remaining lines? From fulko.hew at gmail.com Wed Jun 30 09:35:37 2010 From: fulko.hew at gmail.com (Fulko Hew) Date: Wed, 30 Jun 2010 12:35:37 -0400 Subject: [tpm] how to delete array entries en-passant In-Reply-To: <3576f48081d11bfbed9fe81febbdc064.squirrel@webmail.vex.net> References: <201006301841.07024.shlomif@iglu.org.il> <3576f48081d11bfbed9fe81febbdc064.squirrel@webmail.vex.net> Message-ID: On Wed, Jun 30, 2010 at 12:31 PM, wrote: > > > > OK, let me give you the specific example... > > The array contains all of the lines of a file... > > The foreach is used to loop over then, and 'take action' upon them. > > But when I'm done I want all the empty lines stripped from the array > > ('just > > because!') > > > Does the process require the presence of the entire file in memory before > the loop, and the shuffled-down file afterwards? Do you output the > remaining lines? > No, but I need to output the 'remaining' lines. Also I forgot to mention, the reason the original data was in an array, was because it came from one of two sources... slurping a file, or a 'received' string. So I thought I'd first normalize either dataset into the array I would then traverse. -------------- next part -------------- An HTML attachment was scrubbed... URL: From fulko.hew at gmail.com Wed Jun 30 09:35:37 2010 From: fulko.hew at gmail.com (Fulko Hew) Date: Wed, 30 Jun 2010 12:35:37 -0400 Subject: [tpm] how to delete array entries en-passant In-Reply-To: <3576f48081d11bfbed9fe81febbdc064.squirrel@webmail.vex.net> References: <201006301841.07024.shlomif@iglu.org.il> <3576f48081d11bfbed9fe81febbdc064.squirrel@webmail.vex.net> Message-ID: On Wed, Jun 30, 2010 at 12:31 PM, wrote: > > > > OK, let me give you the specific example... > > The array contains all of the lines of a file... > > The foreach is used to loop over then, and 'take action' upon them. > > But when I'm done I want all the empty lines stripped from the array > > ('just > > because!') > > > Does the process require the presence of the entire file in memory before > the loop, and the shuffled-down file afterwards? Do you output the > remaining lines? > No, but I need to output the 'remaining' lines. Also I forgot to mention, the reason the original data was in an array, was because it came from one of two sources... slurping a file, or a 'received' string. So I thought I'd first normalize either dataset into the array I would then traverse. -------------- next part -------------- An HTML attachment was scrubbed... URL: From stuart at morungos.com Wed Jun 30 09:45:43 2010 From: stuart at morungos.com (Stuart Watt) Date: Wed, 30 Jun 2010 09:45:43 -0700 Subject: [tpm] how to delete array entries en-passant In-Reply-To: References: <201006301841.07024.shlomif@iglu.org.il> <3576f48081d11bfbed9fe81febbdc064.squirrel@webmail.vex.net> Message-ID: You could take the alternative route of turning the string into a file handle, using open on a reference to the string (an example is shown in perldoc -f open), and then having a single regular while loop over lines read from a file handle (whether from string or file), chomping and processing. This would likely be the most memory efficient, as you'd never need a second copy of the input in memory. Useful if you could be dealing with very large files. I think this may be Perl 5.10. Perl 5.8 might use a separate module, IO::String, for the same purpose, if I remember right. Just a thought - but I do love the way Perl allows you to work with a file handle backed by a string so easily. All the best Stuart On 2010-06-30, at 9:35 AM, Fulko Hew wrote: > > > On Wed, Jun 30, 2010 at 12:31 PM, wrote: > > > > OK, let me give you the specific example... > > The array contains all of the lines of a file... > > The foreach is used to loop over then, and 'take action' upon them. > > But when I'm done I want all the empty lines stripped from the array > > ('just > > because!') > > > Does the process require the presence of the entire file in memory before > the loop, and the shuffled-down file afterwards? Do you output the > remaining lines? > > No, but I need to output the 'remaining' lines. > > Also I forgot to mention, the reason the original data was in an array, was because > it came from one of two sources... slurping a file, or a 'received' string. > So I thought I'd first normalize either dataset into the array I would then traverse. > > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm -------------- next part -------------- An HTML attachment was scrubbed... URL: From sfryer at sourcery.ca Wed Jun 30 09:46:07 2010 From: sfryer at sourcery.ca (Shaun Fryer) Date: Wed, 30 Jun 2010 12:46:07 -0400 Subject: [tpm] how to delete array entries en-passant In-Reply-To: References: <201006301841.07024.shlomif@iglu.org.il> <3576f48081d11bfbed9fe81febbdc064.squirrel@webmail.vex.net> Message-ID: # a file and an input stream are both filehandles # assign $fh from either <> or open() while (<$fh>) { my $line = process($_); print $line if $line !~ /^\s*\z/; } -- Shaun Fryer On Wed, Jun 30, 2010 at 12:35 PM, Fulko Hew wrote: >> Does the process require the presence of the entire file in memory before >> the loop, and the shuffled-down file afterwards? Do you output the >> remaining lines? > > No, but I need to output the 'remaining' lines. > > Also I forgot to mention, the reason the original data was in an array, was > because > it came from one of two sources... slurping a file, or a 'received' string. > So I thought I'd first normalize either dataset into the array I would then > traverse. From psema4 at gmail.com Wed Jun 30 19:07:49 2010 From: psema4 at gmail.com (Scott Elcomb) Date: Wed, 30 Jun 2010 22:07:49 -0400 Subject: [tpm] Meeting - June 24, 18:45 Perl and phones In-Reply-To: <3C34E242-4F6C-47CC-888E-5D82A7AAC0A4@vilerichard.com> References: <7F815467-9807-4B0C-A2BC-2349E8C48ED7@stok.ca> <49E58051-46B2-442B-8698-0A7BF65E0228@stok.ca> <3C34E242-4F6C-47CC-888E-5D82A7AAC0A4@vilerichard.com> Message-ID: On Fri, Jun 25, 2010 at 2:01 PM, Olaf Alders wrote: > Are there any slides available for those of us who missed last night's talk? Apologies for the prolonged delay. The slides can be found at and are contained within a TiddlyWiki (using the SlideShowPlugin). Upon opening the document, click "Start Presentation"; the controls are somewhat similar to those of s5. Hovering over the bottom right-hand portion of the document (near the page counter) will display a small toolbar if you need it. Cheers, - Scott. -- Scott Elcomb http://www.psema4.com/ @psema4 Member of the Pirate Party of Canada http://www.pirateparty.ca/