From mike at stok.ca Fri Apr 2 06:54:09 2010 From: mike at stok.ca (Mike Stok) Date: Fri, 2 Apr 2010 09:54:09 -0400 Subject: [tpm] Fwd: UG News: Discount for O'Reilly Open Source Convention (OSCON) References: <1270162897.8917.0.566023@post.oreilly.com> Message-ID: If you would like to view this information in your browser, click here. Forward this announcement Hi, OSCON Registration is open. Here's a discount you can pass along to your members through your mailing list or at your meetings: OSCON happens July 19-23, 2010 in Portland, OR Use code "os10usrg" when you register, and receive 20% off the registration price. To register for the conference, go to http://oreil.ly/osconug2010 At OSCON, you'll participate in hundreds of sessions covering open source languages and platforms, practical tutorials that go deep into technical skill and best practices, inspirational keynote presentations, an Expo Hall featuring dozens of the latest projects and products, fun networking events and activities, and the best "hallway track" around. Explore the benefits and challenges of building scalable applications for the cloud Use open source to target Android, iPhone and other mobile platforms Understand how and when to use NoSQL databases Learn best practices from experts in Python, Java, Ruby, Perl, PHP and JavaScript Use open source effectively as part of your business strategy Learn how to foster contribution and adoption of your open source projects Follow OSCON on your favorite social networking sites: Facebook Twitter (or look for #OSCON) LinkedIn Hope to see you there, Marsee Henon You are receiving this email because you are a User Group contact with O'Reilly Media. Forward this announcement. If you would like to stop receiving these newsletters or announcements from O'Reilly, send an email to marsee at oreilly.com. O'Reilly Media, Inc. 1005 Gravenstein Highway North, Sebastopol, CA 95472 (707) 827-7000 -------------- next part -------------- An HTML attachment was scrubbed... URL: From linux at alteeve.com Tue Apr 6 12:14:44 2010 From: linux at alteeve.com (Digimer) Date: Tue, 06 Apr 2010 15:14:44 -0400 Subject: [tpm] ucfirst() and unicode Message-ID: <4BBB8824.2070506@alteeve.com> Hi all, From reading perldoc perlunicode, I was able to figure out why ucfirst() wasn't doing anything; The data I am altering is coming from a UTF8-encoded database. I also see the example of creating UTF8 compatible ToUpper(), ToLower(), etc. There isn't an example of a compatible ucfirst() alternative, and as I read it, I'd need to create a custom function listing the source->destination unicodes to convert... This seems tedious so, given that laziness is the source of all code, I am guessing someone has come up with another way. Failing that, is there such a function already? My CPAN search for 'ucfirst unicode' failed (though it's always possible that there is a PEBCAK). tl;dr - need a ucfirst() variant that works with Unicode strings. Thanks! -- Digimer E-Mail: linux at alteeve.com AN!Whitepapers: http://alteeve.com Node Assassin: http://nodeassassin.org From stuart at morungos.com Tue Apr 6 12:33:51 2010 From: stuart at morungos.com (Stuart Watt) Date: Tue, 06 Apr 2010 15:33:51 -0400 Subject: [tpm] ucfirst() and unicode In-Reply-To: <4BBB8824.2070506@alteeve.com> References: <4BBB8824.2070506@alteeve.com> Message-ID: <4BBB8C9F.4090603@morungos.com> Digimer wrote: > From reading perldoc perlunicode, I was able to figure out why > ucfirst() wasn't doing anything; The data I am altering is coming from > a UTF8-encoded database. I also see the example of creating UTF8 > compatible ToUpper(), ToLower(), etc. > > There isn't an example of a compatible ucfirst() alternative, and as > I read it, I'd need to create a custom function listing the > source->destination unicodes to convert... This seems tedious so, > given that laziness is the source of all code, I am guessing someone > has come up with another way. Failing that, is there such a function > already? > > My CPAN search for 'ucfirst unicode' failed (though it's always > possible that there is a PEBCAK). > > tl;dr - need a ucfirst() variant that works with Unicode strings. I think some of this is locale-specific, which is why it isn't obvious. i.e., what actually happens can vary from locale to locale. For example, ? can be uppercased to E and ? depending on which region you are in. See http://search.cpan.org/~dapm/perl-5.10.1/pod/perllocale.pod#Category_LC_CTYPE:_Character_Types for some stuff. Just putting "use locale;" in your script might be a good place to start. All the best Stuart From liam at holoweb.net Wed Apr 7 04:46:37 2010 From: liam at holoweb.net (Liam R E Quin) Date: Wed, 07 Apr 2010 07:46:37 -0400 Subject: [tpm] ucfirst() and unicode In-Reply-To: <4BBB8824.2070506@alteeve.com> References: <4BBB8824.2070506@alteeve.com> Message-ID: <1270640797.9097.10902.camel@desktop.barefootcomputing.com> On Tue, 2010-04-06 at 15:14 -0400, Digimer wrote: > There isn't an example of a compatible ucfirst() alternative, use locale; should be enough. $input =~ s{^([[:lower:]])}\u$1}; should also work. Note that when reading/writing UTF-8 you have to use binmode($filehandle, ":utf8"); Liam -- Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ Pictures from old books: http://fromoldbooks.org/ Ankh: irc.sorcery.net irc.gnome.org www.advogato.org From linux at alteeve.com Wed Apr 7 12:12:31 2010 From: linux at alteeve.com (Digimer) Date: Wed, 07 Apr 2010 15:12:31 -0400 Subject: [tpm] ucfirst() and unicode In-Reply-To: <4BBB8C9F.4090603@morungos.com> References: <4BBB8824.2070506@alteeve.com> <4BBB8C9F.4090603@morungos.com> Message-ID: <4BBCD91F.6000905@alteeve.com> On 10-04-06 03:33 PM, Stuart Watt wrote: > Digimer wrote: >> From reading perldoc perlunicode, I was able to figure out why >> ucfirst() wasn't doing anything; The data I am altering is coming from >> a UTF8-encoded database. I also see the example of creating UTF8 >> compatible ToUpper(), ToLower(), etc. >> >> There isn't an example of a compatible ucfirst() alternative, and as I >> read it, I'd need to create a custom function listing the >> source->destination unicodes to convert... This seems tedious so, >> given that laziness is the source of all code, I am guessing someone >> has come up with another way. Failing that, is there such a function >> already? >> >> My CPAN search for 'ucfirst unicode' failed (though it's always >> possible that there is a PEBCAK). >> >> tl;dr - need a ucfirst() variant that works with Unicode strings. > I think some of this is locale-specific, which is why it isn't obvious. > i.e., what actually happens can vary from locale to locale. For example, > ? can be uppercased to E and ? depending on which region you are in. See > http://search.cpan.org/~dapm/perl-5.10.1/pod/perllocale.pod#Category_LC_CTYPE:_Character_Types > > for some stuff. > > Just putting "use locale;" in your script might be a good place to start. > > All the best > Stuart > This got me going in the right direction, thank you! I had already been using 'use locale', but while looking into it I saw that is plays with what perl interprets \l, \u, \L and \U to mean. From that, I was able to create this little function that seems to work: sub uppercase_first_letter { my ($word)=@_; my $new=""; foreach my $char (split//, $word) { $char=~s/^(\w)/\l$1/; $new.=$char; } $new=~s/^(\w)/\u$1/; $word=$new; return($word); } -- Digimer E-Mail: linux at alteeve.com AN!Whitepapers: http://alteeve.com Node Assassin: http://nodeassassin.org From mike at stok.ca Sat Apr 10 09:44:26 2010 From: mike at stok.ca (Mike Stok) Date: Sat, 10 Apr 2010 12:44:26 -0400 Subject: [tpm] May and June meetings Message-ID: <4C2F38E0-4063-4502-BFD5-DA191D56AC7C@stok.ca> I'm planning the May, June, and July meetings, and my current thinking is: May - we need a presentation (or two) for May. June - the scheduled date for the Toronto Perl Mongers meeting is the day after YAPC::NA 2010 finishes. If people are driving back from Columbus then this might not be the best time for a YAPC debriefing. A light (or light hearted) technical talk for June. July - YAPC::NA debrief (even though it's a month later...) and possibly a short other presentation. Does anyone have any thoughts about this or how things could be shuffled around to be or more use to the mongers who attend? Please discuss on-list. Mike -- Mike Stok http://www.stok.ca/~mike/ The "`Stok' disclaimers" apply. -------------- next part -------------- An HTML attachment was scrubbed... URL: From psema4 at gmail.com Sat Apr 10 12:08:20 2010 From: psema4 at gmail.com (Scott Elcomb) Date: Sat, 10 Apr 2010 15:08:20 -0400 Subject: [tpm] May and June meetings In-Reply-To: <4C2F38E0-4063-4502-BFD5-DA191D56AC7C@stok.ca> References: <4C2F38E0-4063-4502-BFD5-DA191D56AC7C@stok.ca> Message-ID: On Sat, Apr 10, 2010 at 12:44 PM, Mike Stok wrote: > I'm planning the May, June, and July meetings, and my current thinking is: > May - we need a presentation (or two) for May. > June - the scheduled date for the Toronto Perl Mongers meeting is the day > after YAPC::NA 2010 finishes. ?If people are driving back from Columbus then > this might not be the best time for a YAPC debriefing. ?A light (or light > hearted) technical talk for ?June. > July - YAPC::NA debrief (even though it's a month later...) and possibly a > short other presentation. > Does anyone have any thoughts about this or how things could be shuffled > around to be or more use to the mongers who attend? ?Please discuss on-list. Gah... Missed the reply to all. Sorry for the dup Mike. [original response] I was thinking to put something together for a lightning talk later in the year but if you're stuck for presentations/topics I could expand the piece I'm working on a little... Perl on Android -- Scott Elcomb http://www.psema4.com/ @psema4 Member of the Pirate Party of Canada http://www.pirateparty.ca/ From olaf at vilerichard.com Sat Apr 10 12:52:19 2010 From: olaf at vilerichard.com (Olaf Alders) Date: Sat, 10 Apr 2010 15:52:19 -0400 Subject: [tpm] May and June meetings In-Reply-To: References: <4C2F38E0-4063-4502-BFD5-DA191D56AC7C@stok.ca> Message-ID: On 2010-04-10, at 3:08 PM, Scott Elcomb wrote: > On Sat, Apr 10, 2010 at 12:44 PM, Mike Stok wrote: >> I'm planning the May, June, and July meetings, and my current thinking is: >> May - we need a presentation (or two) for May. >> June - the scheduled date for the Toronto Perl Mongers meeting is the day >> after YAPC::NA 2010 finishes. If people are driving back from Columbus then >> this might not be the best time for a YAPC debriefing. A light (or light >> hearted) technical talk for June. >> July - YAPC::NA debrief (even though it's a month later...) and possibly a >> short other presentation. >> Does anyone have any thoughts about this or how things could be shuffled >> around to be or more use to the mongers who attend? Please discuss on-list. > > Gah... Missed the reply to all. Sorry for the dup Mike. > > [original response] > I was thinking to put something together for a lightning talk later in > the year but if you're stuck for presentations/topics I could expand > the piece I'm working on a little... Perl on Android On a related note, Mark Jubenville and I are currently working on bundling the POD for all of CPAN into an iPhone app. So, it's Perl POD on the iPhone, by way of Perl and Objective-C. We could talk a bit about that in May if anyone is interested. Olaf From arocker at vex.net Sat Apr 10 13:08:34 2010 From: arocker at vex.net (arocker at vex.net) Date: Sat, 10 Apr 2010 16:08:34 -0400 Subject: [tpm] May and June meetings In-Reply-To: <4C2F38E0-4063-4502-BFD5-DA191D56AC7C@stok.ca> References: <4C2F38E0-4063-4502-BFD5-DA191D56AC7C@stok.ca> Message-ID: I like the theme of "Perl phones" that seems to have emerged for May. From mike at stok.ca Sat Apr 10 18:40:53 2010 From: mike at stok.ca (Mike Stok) Date: Sat, 10 Apr 2010 21:40:53 -0400 Subject: [tpm] May and June meetings In-Reply-To: References: <4C2F38E0-4063-4502-BFD5-DA191D56AC7C@stok.ca> Message-ID: On Apr 10, 2010, at 3:52 PM, Olaf Alders wrote: > On 2010-04-10, at 3:08 PM, Scott Elcomb wrote: > >> On Sat, Apr 10, 2010 at 12:44 PM, Mike Stok wrote: >>> I'm planning the May, June, and July meetings, and my current thinking is: >>> May - we need a presentation (or two) for May. >>> June - the scheduled date for the Toronto Perl Mongers meeting is the day >>> after YAPC::NA 2010 finishes. If people are driving back from Columbus then >>> this might not be the best time for a YAPC debriefing. A light (or light >>> hearted) technical talk for June. >>> July - YAPC::NA debrief (even though it's a month later...) and possibly a >>> short other presentation. >>> Does anyone have any thoughts about this or how things could be shuffled >>> around to be or more use to the mongers who attend? Please discuss on-list. >> >> Gah... Missed the reply to all. Sorry for the dup Mike. >> >> [original response] >> I was thinking to put something together for a lightning talk later in >> the year but if you're stuck for presentations/topics I could expand >> the piece I'm working on a little... Perl on Android > > On a related note, Mark Jubenville and I are currently working on bundling the POD for all of CPAN into an iPhone app. So, it's Perl POD on the iPhone, by way of Perl and Objective-C. We could talk a bit about that in May if anyone is interested. If Scott and Olaf are OK with sharing May then I, like Alan, would be happy to see May as Perl and Phones month. I'll put it on the web site, it can always be updated later. Cheers, Mike -- Mike Stok http://www.stok.ca/~mike/ The "`Stok' disclaimers" apply. From olaf at vilerichard.com Sat Apr 10 19:34:50 2010 From: olaf at vilerichard.com (Olaf Alders) Date: Sat, 10 Apr 2010 22:34:50 -0400 Subject: [tpm] May and June meetings In-Reply-To: References: <4C2F38E0-4063-4502-BFD5-DA191D56AC7C@stok.ca> Message-ID: <47E3ADBC-66F7-4C6D-901B-21B8194E5646@vilerichard.com> On 2010-04-10, at 9:40 PM, Mike Stok wrote: > > On Apr 10, 2010, at 3:52 PM, Olaf Alders wrote: > >> On 2010-04-10, at 3:08 PM, Scott Elcomb wrote: >> >>> On Sat, Apr 10, 2010 at 12:44 PM, Mike Stok wrote: >>>> I'm planning the May, June, and July meetings, and my current thinking is: >>>> May - we need a presentation (or two) for May. >>>> June - the scheduled date for the Toronto Perl Mongers meeting is the day >>>> after YAPC::NA 2010 finishes. If people are driving back from Columbus then >>>> this might not be the best time for a YAPC debriefing. A light (or light >>>> hearted) technical talk for June. >>>> July - YAPC::NA debrief (even though it's a month later...) and possibly a >>>> short other presentation. >>>> Does anyone have any thoughts about this or how things could be shuffled >>>> around to be or more use to the mongers who attend? Please discuss on-list. >>> >>> Gah... Missed the reply to all. Sorry for the dup Mike. >>> >>> [original response] >>> I was thinking to put something together for a lightning talk later in >>> the year but if you're stuck for presentations/topics I could expand >>> the piece I'm working on a little... Perl on Android >> >> On a related note, Mark Jubenville and I are currently working on bundling the POD for all of CPAN into an iPhone app. So, it's Perl POD on the iPhone, by way of Perl and Objective-C. We could talk a bit about that in May if anyone is interested. > > If Scott and Olaf are OK with sharing May then I, like Alan, would be happy to see May as Perl and Phones month. I'll put it on the web site, it can always be updated later. I think that would work out quite well. Olaf From psema4 at gmail.com Sun Apr 11 13:30:29 2010 From: psema4 at gmail.com (Scott Elcomb) Date: Sun, 11 Apr 2010 16:30:29 -0400 Subject: [tpm] May and June meetings In-Reply-To: <47E3ADBC-66F7-4C6D-901B-21B8194E5646@vilerichard.com> References: <4C2F38E0-4063-4502-BFD5-DA191D56AC7C@stok.ca> <47E3ADBC-66F7-4C6D-901B-21B8194E5646@vilerichard.com> Message-ID: On Sat, Apr 10, 2010 at 10:34 PM, Olaf Alders wrote: > > On 2010-04-10, at 9:40 PM, Mike Stok wrote: > >> If Scott and Olaf are OK with sharing May then I, like Alan, would be happy to see May as Perl and Phones month. ?I'll put it on the web site, it can always be updated later. > > I think that would work out quite well. Sounds good here. :-) -- Scott Elcomb http://www.psema4.com/ @psema4 Member of the Pirate Party of Canada http://www.pirateparty.ca/ From stuart at morungos.com Tue Apr 13 08:52:22 2010 From: stuart at morungos.com (Stuart Watt) Date: Tue, 13 Apr 2010 11:52:22 -0400 Subject: [tpm] 5.12 Message-ID: <4BC49336.4010806@morungos.com> 5.12 is actually out. Has anybody tried it yet? Is it good? http://lwn.net/Articles/383203/ All the best Stuart -- Stuart Watt stuart at morungos.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From mike at stok.ca Tue Apr 13 19:02:07 2010 From: mike at stok.ca (Mike Stok) Date: Tue, 13 Apr 2010 22:02:07 -0400 Subject: [tpm] Checking perl syntax in isolation. Message-ID: <8C40452A-C90E-4C08-B315-E429179ABDC3@stok.ca> Recently I was asked to come up with a script to check the syntax of perl programs and modules to give a level of confidence that code checked into a repository didn't have any obvious problems - later building and testing will find other issues. I'll describe the outlines of what I have done, in case someone else has done it differently or more effectively. This check was to be done on the source tree as pushed to the repository, so Perl files might not be in the same relative positions as when they are deployed, and no equivalent of a CPAN module's "perl Makefile.PL && make ..." would have been done. The server running the checks would only have a "standard" perl installation with the usual core modules. As it is intended to be run over multiple existing projects it would be best if there was no magic per project configuration (e.g. setting up @INC by checking a file in a known location). The script is run by a shell wrapper which does a find to find all the .pl and .pm files, there's no snooping to try and figure out if a file is a Perl script. If I can assume that no source filters are allowed, and that the Perl on the server running the checks is "close enough" to the Perl running on the production hosts then the best I was able to come up with was something that can deal with code like this: #!/usr/bin/perl use Some::Unlikely::Module 'foo'; use Another::Module ':all'; use strict; use warnings; my $x = foo('bar'); print "Hello\n" if $x # missing ; for my $y ( 1 .. 10 ) { ice_cream('please'); } exit 1; sub :banana ice_cream { my ($arg) = @_; return $arg ? 'baz' : 'plugh'; } __END__ The first attempts failed: perl -wc gives up if it can't locate Some/Unlikely/Module.pm, if I remove the ; after the print then perlcritic -5 considers the source OK: $ perl -wc try.pl Can't locate Some/Unlikely/Module.pm in @INC (@INC contains: /home/mstok/perl5/lib/perl5/i486-linux-gnu-thread-multi /home/mstok/perl5/lib/perl5 /home/mstok/perl5/lib/perl5/i486-linux-gnu-thread-multi /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at try.pl line 3. $ perlcritic -5 try.pl try.pl source OK $ bin/check-perl try.pl syntax error at try.pl line 11, near "$x for " try.pl had compilation errors. What I have ended up doing is using PPI::XS to tokenize the file. I then look at a the use / require / no directives and keep "use warnings;" and "use vars ... ;", turn "use strict;" into "use strict; no strict 'subs';", and delete all other use / reqires. That gets rid of issues with uninstalled modules as the use (or require) has been removed. Then I peel out all subroutine attributes, as they often rely on the effects of a use I have just deleted to be parsed. Then I write the file out to a temporaray file, and call perl -c on it to check the syntax (or perl -wc if I'm not being lenient), filtering stdout & stderr to replace the temporary file name with the original so as not to confuse the reader of the output. This seems to pick up most of the trivial errors (the kind where I have tested the code, realize there's some debugging left in it, delete the debugging, and maybe the odd }, check it in, and run out to lunch...). So has anyone else tried this, and if so how did you end up doing it? Was it successful, or were there better techniques for catching this type of thing? I'll have to see if I can show the code, but the outline should be enough to give a rough idea of what I was up to. Mike -- Mike Stok http://www.stok.ca/~mike/ The "`Stok' disclaimers" apply. From matt at sergeant.org Wed Apr 14 06:36:27 2010 From: matt at sergeant.org (Matt Sergeant) Date: Wed, 14 Apr 2010 09:36:27 -0400 Subject: [tpm] Checking perl syntax in isolation. In-Reply-To: <8C40452A-C90E-4C08-B315-E429179ABDC3@stok.ca> References: <8C40452A-C90E-4C08-B315-E429179ABDC3@stok.ca> Message-ID: <4BC5C4DB.9040408@sergeant.org> Mike Stok wrote: > So has anyone else tried this, and if so how did you end up doing it? Was it successful, or were there better techniques for catching this type of thing? Why not just have a company standard that all t/00*.t tests are for checking the modules load OK, and run make test on every checkin with TEST_FILES=t/00*.t From jztam at yahoo.com Wed Apr 14 11:10:12 2010 From: jztam at yahoo.com (J Z Tam) Date: Wed, 14 Apr 2010 11:10:12 -0700 (PDT) Subject: [tpm] Checking perl syntax in isolation. In-Reply-To: <8C40452A-C90E-4C08-B315-E429179ABDC3@stok.ca> References: <8C40452A-C90E-4C08-B315-E429179ABDC3@stok.ca> Message-ID: <171419.14052.qm@web57604.mail.re1.yahoo.com> #!/bin/ksh -- # -*- perl -*- # perforce git rcs stuff # who,when, how, why eval `/home/yourid/bin/check-perl.ksh try.pl`; # rest of source of try.pl But you probably want to cook what check-perl.ksh returns or not before heading into the rest of source. Perhaps even refactoring check-perl.ksh into checkPerl.pl ? ;-) Maybe even add a BEGIN END block after the eval with the path spidering code. /jordan The first attempts failed: perl -wc gives up if it can't locate Some/Unlikely/Module.pm, if I remove the ; after the print then perlcritic -5 considers the source OK: $ perl -wc try.pl Can't locate Some/Unlikely/Module.pm in @INC (@INC contains: /home/mstok/perl5/lib/perl5/i486-linux-gnu-thread-multi /home/mstok/perl5/lib/perl5 /home/mstok/perl5/lib/perl5/i486-linux-gnu-thread-multi /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at try.pl line 3. $ perlcritic -5 try.pl try.pl source OK $ bin/check-perl try.pl syntax error at try.pl line 11, near "$x for " try.pl had compilation errors. What I have ended up doing is using PPI::XS to tokenize the file. I then look at a the use / require / no directives and keep "use warnings;" and "use vars ... ;", turn "use strict;" into "use strict; no strict 'subs';", and delete all other use / reqires. That gets rid of issues with uninstalled modules as the use (or require) has been removed. Then I peel out all subroutine attributes, as they often rely on the effects of a use I have just deleted to be parsed. Then I write the file out to a temporaray file, and call perl -c on it to check the syntax (or perl -wc if I'm not being lenient), filtering stdout & stderr to replace the temporary file name with the original so as not to confuse the reader of the output. This seems to pick up most of the trivial errors (the kind where I have tested the code, realize there's some debugging left in it, delete the debugging, and maybe the odd }, check it in, and run out to lunch...). So has anyone else tried this, and if so how did you end up doing it? Was it successful, or were there better techniques for catching this type of thing? I'll have to see if I can show the code, but the outline should be enough to give a rough idea of what I was up to. Mike -- Mike Stok http://www.stok.ca/~mike/ The "`Stok' disclaimers" apply. ----- Original Message ---- From: Mike Stok To: Toronto PerlMongers Sent: Tue, April 13, 2010 10:02:07 PM Subject: [tpm] Checking perl syntax in isolation. Recently I was asked to come up with a script to check the syntax of perl programs and modules to give a level of confidence that code checked into a repository didn't have any obvious problems - later building and testing will find other issues. I'll describe the outlines of what I have done, in case someone else has done it differently or more effectively. This check was to be done on the source tree as pushed to the repository, so Perl files might not be in the same relative positions as when they are deployed, and no equivalent of a CPAN module's "perl Makefile.PL && make ..." would have been done. The server running the checks would only have a "standard" perl installation with the usual core modules. As it is intended to be run over multiple existing projects it would be best if there was no magic per project configuration (e.g. setting up @INC by checking a file in a known location). The script is run by a shell wrapper which does a find to find all the .pl and .pm files, there's no snooping to try and figure out if a file is a Perl script. If I can assume that no source filters are allowed, and that the Perl on the server running the checks is "close enough" to the Perl running on the production hosts then the best I was able to come up with was something that can deal with code like this: #!/usr/bin/perl use Some::Unlikely::Module 'foo'; use Another::Module ':all'; use strict; use warnings; my $x = foo('bar'); print "Hello\n" if $x # missing ; for my $y ( 1 .. 10 ) { ice_cream('please'); } exit 1; sub :banana ice_cream { my ($arg) = @_; return $arg ? 'baz' : 'plugh'; } __END__ The first attempts failed: perl -wc gives up if it can't locate Some/Unlikely/Module.pm, if I remove the ; after the print then perlcritic -5 considers the source OK: $ perl -wc try.pl Can't locate Some/Unlikely/Module.pm in @INC (@INC contains: /home/mstok/perl5/lib/perl5/i486-linux-gnu-thread-multi /home/mstok/perl5/lib/perl5 /home/mstok/perl5/lib/perl5/i486-linux-gnu-thread-multi /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at try.pl line 3. $ perlcritic -5 try.pl try.pl source OK $ bin/check-perl try.pl syntax error at try.pl line 11, near "$x for " try.pl had compilation errors. What I have ended up doing is using PPI::XS to tokenize the file. I then look at a the use / require / no directives and keep "use warnings;" and "use vars ... ;", turn "use strict;" into "use strict; no strict 'subs';", and delete all other use / reqires. That gets rid of issues with uninstalled modules as the use (or require) has been removed. Then I peel out all subroutine attributes, as they often rely on the effects of a use I have just deleted to be parsed. Then I write the file out to a temporaray file, and call perl -c on it to check the syntax (or perl -wc if I'm not being lenient), filtering stdout & stderr to replace the temporary file name with the original so as not to confuse the reader of the output. This seems to pick up most of the trivial errors (the kind where I have tested the code, realize there's some debugging left in it, delete the debugging, and maybe the odd }, check it in, and run out to lunch...). So has anyone else tried this, and if so how did you end up doing it? Was it successful, or were there better techniques for catching this type of thing? I'll have to see if I can show the code, but the outline should be enough to give a rough idea of what I was up to. Mike -- Mike Stok http://www.stok.ca/~mike/ The "`Stok' disclaimers" apply. _______________________________________________ toronto-pm mailing list toronto-pm at pm.org http://mail.pm.org/mailman/listinfo/toronto-pm From arocker at vex.net Thu Apr 22 06:24:46 2010 From: arocker at vex.net (arocker at vex.net) Date: Thu, 22 Apr 2010 09:24:46 -0400 Subject: [tpm] Blasphemy! Message-ID: <213a325c72fc76f4411854db153ac11c.squirrel@webmail.vex.net> http://www.theregister.co.uk/2010/04/21/ken_thompson_take_our_test/ From dave.s.doyle at gmail.com Thu Apr 22 06:42:10 2010 From: dave.s.doyle at gmail.com (Dave Doyle) Date: Thu, 22 Apr 2010 09:42:10 -0400 Subject: [tpm] Blasphemy! In-Reply-To: <213a325c72fc76f4411854db153ac11c.squirrel@webmail.vex.net> References: <213a325c72fc76f4411854db153ac11c.squirrel@webmail.vex.net> Message-ID: That's just hilarious. -- dave.s.doyle at gmail.com On Thu, Apr 22, 2010 at 9:24 AM, wrote: > http://www.theregister.co.uk/2010/04/21/ken_thompson_take_our_test/ > > _______________________________________________ > 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 mike at stok.ca Thu Apr 22 16:47:26 2010 From: mike at stok.ca (Mike Stok) Date: Thu, 22 Apr 2010 19:47:26 -0400 Subject: [tpm] Meeting April 29, 2010 - KinoSearch Message-ID: See http://to.pm.org. I'll send out a note about the room when I know more. Mike Date: Thu 29 Apr 2010 18:45 EDT Venue: Nexient Topic: KinoSearch - Free Text Search Stuart Watt: Free Text Search a la KinoSearch KinoSearch is a Perl search engine library. Stuart will cover the basics of information retrieval technology, and the use of the module. The module is pretty easy to use when you get the hang of it. 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. -------------- next part -------------- An HTML attachment was scrubbed... URL: From sfryer at sourcery.ca Thu Apr 22 18:39:31 2010 From: sfryer at sourcery.ca (Shaun Fryer) Date: Thu, 22 Apr 2010 21:39:31 -0400 Subject: [tpm] Modification of a read-only value Message-ID: I'm curious why a scalar reference is considered a read-only value? $ perl -le 'my $x = \"0"; $$x++; print $$x' Modification of a read-only value attempted at -e line 1. $ perl -le 'my $x = {x=> 0}; $x->{x}++; print $x->{x}' 1 Is there an easy way to update a simple scalar ref without having to use an array or hash ref instead? Fyi... This is perl, v5.10.0 built for i486-linux-gnu-thread-multi -- Shaun Fryer From stuart at morungos.com Thu Apr 22 18:57:50 2010 From: stuart at morungos.com (Stuart Watt) Date: Thu, 22 Apr 2010 21:57:50 -0400 Subject: [tpm] Modification of a read-only value In-Reply-To: References: Message-ID: <72620407-491C-402E-8CEA-0102C33C28F4@morungos.com> A simpler example of how to use a scalar reference is: > perl -le 'my $y = 0; my $x = \$y; $$x++; print $$x' Basically, the error tells you that the code is actually trying to modify the constant string "0", and you're not allowed to do that. The example here might help you. All the best Stuart On 2010-04-22, at 9:39 PM, Shaun Fryer wrote: > I'm curious why a scalar reference is considered a read-only value? > > $ perl -le 'my $x = \"0"; $$x++; print $$x' > Modification of a read-only value attempted at -e line 1. > > $ perl -le 'my $x = {x=> 0}; $x->{x}++; print $x->{x}' > 1 > > Is there an easy way to update a simple scalar ref without having to > use an array or hash ref instead? > > Fyi... This is perl, v5.10.0 built for i486-linux-gnu-thread-multi > -- > Shaun Fryer > _______________________________________________ > 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 thakore.kartik at gmail.com Thu Apr 22 19:08:08 2010 From: thakore.kartik at gmail.com (Kartik Thakore) Date: Thu, 22 Apr 2010 22:08:08 -0400 Subject: [tpm] Blasphemy! In-Reply-To: References: <213a325c72fc76f4411854db153ac11c.squirrel@webmail.vex.net> Message-ID: A bit of drama by the news fold at theregister ;) http://www.reddit.com/r/programming/comments/bu6j1/c_language_inventor_spurns_googles_language_exam/c0okezu On Thu, Apr 22, 2010 at 9:42 AM, Dave Doyle wrote: > That's just hilarious. > > -- > dave.s.doyle at gmail.com > > > > On Thu, Apr 22, 2010 at 9:24 AM, wrote: > >> http://www.theregister.co.uk/2010/04/21/ken_thompson_take_our_test/ >> >> _______________________________________________ >> toronto-pm mailing list >> toronto-pm at pm.org >> http://mail.pm.org/mailman/listinfo/toronto-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 shlomif at iglu.org.il Fri Apr 23 00:58:07 2010 From: shlomif at iglu.org.il (Shlomi Fish) Date: Fri, 23 Apr 2010 10:58:07 +0300 Subject: [tpm] Modification of a read-only value In-Reply-To: References: Message-ID: <201004231058.07724.shlomif@iglu.org.il> On Friday 23 Apr 2010 04:39:31 Shaun Fryer wrote: > I'm curious why a scalar reference is considered a read-only value? > > $ perl -le 'my $x = \"0"; $$x++; print $$x' > Modification of a read-only value attempted at -e line 1. > > $ perl -le 'my $x = {x=> 0}; $x->{x}++; print $x->{x}' > 1 > > Is there an easy way to update a simple scalar ref without having to > use an array or hash ref instead? > Yes: [code] #!/usr/bin/perl use strict; use warnings; my $var = 0; my $x = \$var; ${$x}++; print "Deref[X] is now: ", ${$x}, ".\n"; [/code] You may also be able to do something like << my $x = \(my $var = 0); >> but please don't for clarity sake. Regards, Shlomi Fish > Fyi... This is perl, v5.10.0 built for i486-linux-gnu-thread-multi > -- > Shaun Fryer > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Optimising Code for Speed - http://shlom.in/optimise Deletionists delete Wikipedia articles that they consider lame. Chuck Norris deletes deletionists whom he considers lame. Please reply to list if it's a mailing list post - http://shlom.in/reply . From shlomif at iglu.org.il Fri Apr 23 00:58:07 2010 From: shlomif at iglu.org.il (Shlomi Fish) Date: Fri, 23 Apr 2010 10:58:07 +0300 Subject: [tpm] Modification of a read-only value In-Reply-To: References: Message-ID: <201004231058.07724.shlomif@iglu.org.il> On Friday 23 Apr 2010 04:39:31 Shaun Fryer wrote: > I'm curious why a scalar reference is considered a read-only value? > > $ perl -le 'my $x = \"0"; $$x++; print $$x' > Modification of a read-only value attempted at -e line 1. > > $ perl -le 'my $x = {x=> 0}; $x->{x}++; print $x->{x}' > 1 > > Is there an easy way to update a simple scalar ref without having to > use an array or hash ref instead? > Yes: [code] #!/usr/bin/perl use strict; use warnings; my $var = 0; my $x = \$var; ${$x}++; print "Deref[X] is now: ", ${$x}, ".\n"; [/code] You may also be able to do something like << my $x = \(my $var = 0); >> but please don't for clarity sake. Regards, Shlomi Fish > Fyi... This is perl, v5.10.0 built for i486-linux-gnu-thread-multi > -- > Shaun Fryer > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Optimising Code for Speed - http://shlom.in/optimise Deletionists delete Wikipedia articles that they consider lame. Chuck Norris deletes deletionists whom he considers lame. Please reply to list if it's a mailing list post - http://shlom.in/reply . From jbl at jbldata.com Mon Apr 26 12:33:31 2010 From: jbl at jbldata.com (J. Bobby Lopez) Date: Mon, 26 Apr 2010 15:33:31 -0400 Subject: [tpm] Anything I'm Missing? (IDE) Message-ID: I think I want to make it a habit to annually review my working environment, including OS, IDE, and any utilities that would make my coding more effective or enjoyable. Spring seems like the right time to do this, so I'll just put the question out there to see if anyone has any suggestions. Right now, my primary environment consists of the following: - Mix of ubuntu/debian for servers, just installed Arch linux as my primary workstation OS. - BZR as my version control system (been using it a while, and I like it) - Vim is my editor of choice along with plugins (perl-support.vm, nerd tree, perltidy.. plan to start using Perl::Critic soon) - GNU Screen for terminal multiplexing - Xmonad tiling window manager (minimalist awesomeness) - Tomboy + Snowy for notes - And of course, Perl Are there any other tools out there that you all are using to make your perl coding that much more interesting/fun/productive? I installed Padre via CPAN a few weeks ago, and I like the indentation high-lighting and function/method lists, but I just couldn't get into it. I know Vim well enough that it would be hard to break away. I considered using Cream, but again, too much stuff that I may not need. I like adding useful plugins and features one at a time. Thanks! Bobby -------------- next part -------------- An HTML attachment was scrubbed... URL: From talexb at gmail.com Mon Apr 26 13:36:11 2010 From: talexb at gmail.com (Alex Beamish) Date: Mon, 26 Apr 2010 16:36:11 -0400 Subject: [tpm] Anything I'm Missing? (IDE) In-Reply-To: References: Message-ID: On Mon, Apr 26, 2010 at 3:33 PM, J. Bobby Lopez wrote: > I think I want to make it a habit to annually review my working environment, > including OS, IDE, and any utilities that would make my coding more > effective or enjoyable. > > Spring seems like the right time to do this, so I'll just put the question > out there to see if anyone has any suggestions. > > Right now, my primary environment consists of the following: > > - Mix of ubuntu/debian for servers, just installed Arch linux as my primary > workstation OS. > - BZR as my version control system (been using it a while, and I like it) I've progressed from cvs (ugh) to svn (ok) to git (still at the thumb-fingered stage). If bzr does the job for you, great. > - Vim is my editor of choice along with plugins (perl-support.vm, nerd tree, > perltidy.. plan to start using Perl::Critic soon) Perltidy is a great tool, and perlcritic is quite handy as well. I agree with about 95% of PBP, but there's some debate among my co-workers as to that last 5%. > - GNU Screen for terminal multiplexing Screen is an awesome tool. > - Xmonad tiling window manager (minimalist awesomeness) I am probably one of the last remaining Windowmaker users; I use Gnome at home and quite like it. > - Tomboy + Snowy for notes > - And of course, Perl > > > Are there any other tools out there that you all are using to make your perl > coding that much more interesting/fun/productive?? I installed Padre via > CPAN a few weeks ago, and I like the indentation high-lighting and > function/method lists, but I just couldn't get into it.? I know Vim well > enough that it would be hard to break away.? I considered using Cream, but > again, too much stuff that I may not need.? I like adding useful plugins and > features one at a time. I believe it's Andy Lester's Module::Starter module that's quite handy for getting started with a module. Putting your code in a module is a great way to organize code. -- Alex Beamish Toronto, Ontario aka talexb From olaf at vilerichard.com Mon Apr 26 13:46:01 2010 From: olaf at vilerichard.com (Olaf Alders) Date: Mon, 26 Apr 2010 16:46:01 -0400 Subject: [tpm] Anything I'm Missing? (IDE) In-Reply-To: References: Message-ID: <02CBC2BA-4FA8-40FD-B30D-452D8B458B7A@vilerichard.com> On 2010-04-26, at 4:36 PM, Alex Beamish wrote: >> > > I believe it's Andy Lester's Module::Starter module that's quite handy > for getting started with a module. Putting your code in a module is a > great way to organize code. Dist::Zilla is also a great tool for managing your modules, especially if you're planning to contribute to CPAN. Olaf -- Olaf Alders olaf at vilerichard.com http://vilerichard.com -- folk rock http://twitter.com/vilerichard http://cdbaby.com/cd/vilerichard From mike at stok.ca Wed Apr 28 06:12:20 2010 From: mike at stok.ca (Mike Stok) Date: Wed, 28 Apr 2010 09:12:20 -0400 Subject: [tpm] April Meeting - Room 2 on 12th Floor. Message-ID: Date: Thu 29 Apr 2010 18:45 EDT Venue: Nexient; Room 2 on the 12th floor Topic: KinoSearch - Free Text Search Stuart Watt: Free Text Search a la KinoSearch KinoSearch is a Perl search engine library. Stuart will cover the basics of information retrieval technology, and the use of the module. The module is pretty easy to use when you get the hang of it. 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. -------------- next part -------------- An HTML attachment was scrubbed... URL: From fulko.hew at gmail.com Wed Apr 28 09:44:04 2010 From: fulko.hew at gmail.com (Fulko Hew) Date: Wed, 28 Apr 2010 12:44:04 -0400 Subject: [tpm] why aren't field counts being preserved? Message-ID: What am I doing wrong here??? I want to have an octet string that uses nulls to delimit fields, and then the receiver should be able to 'split' on nulls to restore the original array. Empty strings in the middle of the array are preserved, but empty strings at the end of the array are not. I need them all to be preserved! What am I missing? TIA Fulko #!/usr/bin/perl use Data::Dumper; my @x = ( 'a', 'b', 'c', ' ', 'd', '', '' ); my $f = join ("\x00", @x); print Dumper(@x); print unpack ('H*', $f), "\n\n"; @r = split ("\x00", $f); print Dumper(@r); -------------- next part -------------- An HTML attachment was scrubbed... URL: From stuart at morungos.com Wed Apr 28 09:49:50 2010 From: stuart at morungos.com (Stuart Watt) Date: Wed, 28 Apr 2010 12:49:50 -0400 Subject: [tpm] why aren't field counts being preserved? In-Reply-To: References: Message-ID: <4BD8672E.6040700@morungos.com> Fulko Hew wrote: > What am I doing wrong here??? > > I want to have an octet string that uses nulls to delimit fields, > and then the receiver should be able to 'split' on nulls to > restore the original array. > > Empty strings in the middle of the array are preserved, but > empty strings at the end of the array are not. > > I need them all to be preserved! > What am I missing? > > TIA > Fulko A limit of -1 as an additional parameter to split will do the trick. It's in perldoc -f split, but well hidden All the best Stuart From fulko.hew at gmail.com Wed Apr 28 09:56:10 2010 From: fulko.hew at gmail.com (Fulko Hew) Date: Wed, 28 Apr 2010 12:56:10 -0400 Subject: [tpm] why aren't field counts being preserved? In-Reply-To: <4BD8672E.6040700@morungos.com> References: <4BD8672E.6040700@morungos.com> Message-ID: On Wed, Apr 28, 2010 at 12:49 PM, Stuart Watt wrote: > Fulko Hew wrote: > >> What am I doing wrong here??? >> >> I want to have an octet string that uses nulls to delimit fields, >> and then the receiver should be able to 'split' on nulls to >> restore the original array. >> >> Empty strings in the middle of the array are preserved, but >> empty strings at the end of the array are not. >> >> I need them all to be preserved! >> What am I missing? >> >> TIA >> Fulko >> > A limit of -1 as an additional parameter to split will do the trick. It's > in perldoc -f split, but well hidden > Thanks, works great now! My mistake was only reading the Camel book, and Google. :-( -------------- next part -------------- An HTML attachment was scrubbed... URL: From quantum.mechanic.1964 at gmail.com Fri Apr 30 18:24:38 2010 From: quantum.mechanic.1964 at gmail.com (Quantum Mechanic) Date: Fri, 30 Apr 2010 21:24:38 -0400 Subject: [tpm] why aren't field counts being preserved? In-Reply-To: References: <4BD8672E.6040700@morungos.com> Message-ID: On Wednesday, April 28, 2010, Fulko Hew wrote: > > > On Wed, Apr 28, 2010 at 12:49 PM, Stuart Watt wrote: > > > Fulko Hew wrote: > > What am I doing wrong here??? > > I want to have an octet string that uses nulls to delimit fields, > and then the receiver should be able to 'split' on nulls to > restore the original array. > > Empty strings in the middle of the array are preserved, but > empty strings at the end of the array are not. > > I need them all to be preserved! > What am I missing? > > TIA > Fulko > > A limit of -1 as an additional parameter to split will do the trick. It's in perldoc -f split, but well hidden > > Thanks, works great now! > My mistake was only reading the Camel book, and Google.? :-( > > I start with perldoc.org. -- -QM Quantum Mechanics: The dreams stuff is made of