From georgen at neillnet.com Wed Jun 1 08:24:41 2005 From: georgen at neillnet.com (georgen@neillnet.com) Date: Wed, 1 Jun 2005 10:24:41 -0500 (CDT) Subject: [Omaha.pm] Getopt::Long and opt_ variables In-Reply-To: <20050601064621.GA28291@jbisbee.com> References: <200505290115.26995.dthacker9@cox.net> <1643.192.168.10.11.1117424052.squirrel@192.168.10.11> <20050601064621.GA28291@jbisbee.com> Message-ID: <25252.199.125.14.2.1117639481.squirrel@199.125.14.2> > Just need to use 'our'. 'vars' is old skool for 'our' (well for variables > in the current package anyway) Thanks for the correction. I guess I am old skool. ;) > Darth Vader says, "Nooooooooooooooooo!!!" :P > > Also its almost generally a very bad idea to remove 'use strict;' > Very bad things are bound to happen without you being the wiser :) Agreed. I should have mentioned that. Been a while since I have PERL'd, so thanks for being nice! Thanks, George. From jhannah at omnihotels.com Fri Jun 3 09:48:53 2005 From: jhannah at omnihotels.com (Jay Hannah) Date: Fri, 3 Jun 2005 11:48:53 -0500 Subject: [Omaha.pm] precedence: ?: vs. = Message-ID: <200506031648.j53Gm7nn002836@omares-email.omnihotels.com> This doesn't do what the author was expecting: $_[1] ? $prop_to_ping = $_[1] : $prop_to_ping = $_[0]->{prop}; Because = binds tighter than : So, avoid this pattern $a ? $x = $a : $x = $b; Instead, use patterns 2-4 below. I like 4, but that's just me. j ----------------- $ cat j2.pl use Test::More tests => 4; $a = 10; $b = 20; $a ? $x = $a : $x = $b; is ($x, 10, "Pattern 1"); $a ? ($x = $a) : ($x = $b); is ($x, 10, "Pattern 2"); $x = $a ? $a : $b; is ($x, 10, "Pattern 3"); $x = $a || $b; is ($x, 10, "Pattern 4"); $ perl j2.pl 1..4 not ok 1 - Pattern 1 # Failed test (j2.pl at line 7) # got: '20' # expected: '10' ok 2 - Pattern 2 ok 3 - Pattern 3 ok 4 - Pattern 4 # Looks like you failed 1 tests of 4. ----------------- From andy at petdance.com Fri Jun 3 09:54:24 2005 From: andy at petdance.com (Andy Lester) Date: Fri, 3 Jun 2005 11:54:24 -0500 Subject: [Omaha.pm] precedence: ?: vs. = In-Reply-To: <200506031648.j53Gm7nn002836@omares-email.omnihotels.com> References: <200506031648.j53Gm7nn002836@omares-email.omnihotels.com> Message-ID: <20050603165424.GA5231@petdance.com> On Fri, Jun 03, 2005 at 11:48:53AM -0500, Jay Hannah (jhannah at omnihotels.com) wrote: > > This doesn't do what the author was expecting: > > $_[1] ? $prop_to_ping = $_[1] : $prop_to_ping = $_[0]->{prop}; That's not how you should be using the ternary. You're using it as a glorified if/then. You really want. $prop_to_ping = $_[1] ? $_[1] : $_[0]->{prop} xoxo, Andy -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From jay at jays.net Fri Jun 3 09:56:27 2005 From: jay at jays.net (Jay Hannah) Date: Fri, 3 Jun 2005 11:56:27 -0500 Subject: [Omaha.pm] precedence: ?: vs. = In-Reply-To: <20050603165424.GA5231@petdance.com> References: <200506031648.j53Gm7nn002836@omares-email.omnihotels.com> <20050603165424.GA5231@petdance.com> Message-ID: <7e244980895f6baf4e23bc390c288323@jays.net> On Jun 3, 2005, at 11:54 AM, Andy Lester wrote: > On Fri, Jun 03, 2005 at 11:48:53AM -0500, Jay Hannah > (jhannah at omnihotels.com) wrote: >> >> This doesn't do what the author was expecting: >> >> $_[1] ? $prop_to_ping = $_[1] : $prop_to_ping = $_[0]->{prop}; > > That's not how you should be using the ternary. You're using it as a > glorified if/then. You really want. > > $prop_to_ping = $_[1] ? $_[1] : $_[0]->{prop} Ya, that's Pattern 3 from my email. Grin, j From jhannah at omnihotels.com Mon Jun 6 15:58:42 2005 From: jhannah at omnihotels.com (Jay Hannah) Date: Mon, 6 Jun 2005 17:58:42 -0500 Subject: [Omaha.pm] best practice: podchecker Message-ID: <200506062257.j56Mvsnn024363@omares-email.omnihotels.com> > See CVS for details. Unless a server is accessing the sysmaster > database, updates are not needed at this time. > DT Before committing POD changes, always run podchecker please. Please correct so podchecker is happy. Thanks, j jhannah at razorbill:~/Omni> podchecker DB.pm *** ERROR: Spurious text after =cut at line 237 in file DB.pm *** ERROR: Spurious text after =cut at line 249 in file DB.pm DB.pm has 2 pod syntax errors. From andy at petdance.com Mon Jun 6 18:46:48 2005 From: andy at petdance.com (Andy Lester) Date: Mon, 6 Jun 2005 20:46:48 -0500 Subject: [Omaha.pm] best practice: podchecker In-Reply-To: <200506062257.j56Mvsnn024363@omares-email.omnihotels.com> References: <200506062257.j56Mvsnn024363@omares-email.omnihotels.com> Message-ID: > > Before committing POD changes, always run podchecker please. Please > correct so podchecker is happy. If your work has a test suite with it, you can also use the standard t/pod.t. Here's one from WWW::Mechanize: http://search.cpan.org/src/PETDANCE/WWW-Mechanize-1.13_01/t/pod.t -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From jhannah at omnihotels.com Thu Jun 9 09:23:03 2005 From: jhannah at omnihotels.com (Jay Hannah) Date: Thu, 9 Jun 2005 11:23:03 -0500 Subject: [Omaha.pm] Log files might be bz2'd hack Message-ID: <200506091622.j59GMDnn004483@omares-email.omnihotels.com> I thought this was an interesting hack... I've got these log files that may or may not be .bz2'd. Plus I don't necessarily know their whole filename, I only know their date. So, if I want the files for yesterday I do: $ ls -a /junk/__peglogs/comserver-trans-a.log.20050608* /junk/__peglogs/comserver-trans-a.log.20050608235900.bz2 and that file (or files) may or may not be bz2'd. So my code to walk through all the files that are there now looks like this: my $glob = "/junk/__peglogs/comserver-trans-a.log.$y$m$d"; my $cat = "cat"; if (`ls $glob*.bz2 2>/dev/null`) { $cat = "bzcat"; } open (IN, "$cat $glob* |"); while () { ...etc... It only works if all files either are or are not .bz2'd. You can't mix and match. Neat? Not? -ponder- Shrug, j From andy at petdance.com Thu Jun 9 09:29:43 2005 From: andy at petdance.com (Andy Lester) Date: Thu, 9 Jun 2005 11:29:43 -0500 Subject: [Omaha.pm] Log files might be bz2'd hack In-Reply-To: <200506091622.j59GMDnn004483@omares-email.omnihotels.com> References: <200506091622.j59GMDnn004483@omares-email.omnihotels.com> Message-ID: <20050609162943.GA31767@petdance.com> On Thu, Jun 09, 2005 at 11:23:03AM -0500, Jay Hannah (jhannah at omnihotels.com) wrote: > my $glob = "/junk/__peglogs/comserver-trans-a.log.$y$m$d"; > my $cat = "cat"; > if (`ls $glob*.bz2 2>/dev/null`) { > $cat = "bzcat"; > } You don't need to use `ls` to get a list of files. my @files = glob( "$glob*.bz2" ); -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From jhannah at omnihotels.com Thu Jun 9 11:14:41 2005 From: jhannah at omnihotels.com (Jay Hannah) Date: Thu, 9 Jun 2005 13:14:41 -0500 Subject: [Omaha.pm] IIS log hackery Message-ID: <200506091813.j59IDpnn001483@omares-email.omnihotels.com> IIS logs look like this: > zcat 443.access_log-20050609.gz | head 66.45.77.200 - - [08/Jun/2005:04:15:20 -0500] "GET /Omni?prop=STLDTN&pagedst=AvailReq&pagesrc=Hotels HTTP/1.1" 200 23293 10.0.37.2 - - [08/Jun/2005:04:15:22 -0500] "GET /Omni HTTP/1.0" 200 22159 10.0.37.2 - - [08/Jun/2005:04:15:28 -0500] "GET /Carlton HTTP/1.0" 200 6097 66.45.77.200 - - [08/Jun/2005:04:15:32 -0500] "POST /Omni?prop=STLDTN&pagedst=AvailReq&pagesrc=Hotels HTTP/1.1" 200 21303 66.45.77.200 - - [08/Jun/2005:04:15:41 -0500] "GET /Omni?prop=SFODTN&pagedst=AvailReq&pagesrc=Hotels HTTP/1.1" 200 23304 10.0.37.3 - - [08/Jun/2005:04:15:46 -0500] "GET /Omni HTTP/1.0" 200 22159 10.0.37.3 - - [08/Jun/2005:04:15:47 -0500] "GET /Carlton HTTP/1.0" 200 6097 204.94.250.10 - - [08/Jun/2005:04:15:48 -0500] "GET /images/calendar.gif HTTP/1.1" 200 145 10.0.37.2 - - [08/Jun/2005:04:15:50 -0500] "GET /Omni HTTP/1.0" 200 22159 10.0.37.2 - - [08/Jun/2005:04:15:50 -0500] "GET /Carlton HTTP/1.0" 200 6097 Here's a couple quick deals I just did where I found myself piping to Perl: Count all the prop=XXXXX thingies to report count per XXXXX > zcat 443.access_log-20050609.gz | grep 209.73.169. | perl -ne 'print /prop=(\w+)/, "\n";' | sort | uniq -c 5 ATLCNN 3 AUSSTH 28 BOSPAR 25 CHIAMB 24 CHIDTN ...etc... Count hits by class C > zcat 443.access_log-20050609.gz | cut -d' ' -f1 | perl -pe 's/\.\d+$//' | sort | uniq -c | sort -nr | head 10740 10.0.37 4789 66.45.77 3454 209.73.169 1820 68.142.230 1248 12.129.73 223 10.0.33 187 67.79.134 ...etc... Cheers, j From jhannah at omnihotels.com Thu Jun 9 16:04:16 2005 From: jhannah at omnihotels.com (Jay Hannah) Date: Thu, 9 Jun 2005 18:04:16 -0500 Subject: [Omaha.pm] quick n dirty rand() Message-ID: <200506092303.j59N3Qnn025190@omares-email.omnihotels.com> Before my $rand = int(rand(3))+1; my $imagename = "sean.jpg"; $imagename = "jay.jpg" if ($rand == 2); $imagename = "airplane.jpg" if ($rand == 3); After my $imagename = ("sean.jpg", "jay.jpg", "airplane.jpg")[(int rand 3)]; Syntax stolen from http://www.rollmop.org/oneliners/perl.html j From jay at jays.net Thu Jun 9 16:09:48 2005 From: jay at jays.net (Jay Hannah) Date: Thu, 9 Jun 2005 18:09:48 -0500 Subject: [Omaha.pm] Log files might be bz2'd hack In-Reply-To: <20050609162943.GA31767@petdance.com> References: <200506091622.j59GMDnn004483@omares-email.omnihotels.com> <20050609162943.GA31767@petdance.com> Message-ID: <652353597dd0377cb627b9ef81c6a28a@jays.net> On Jun 9, 2005, at 11:29 AM, Andy Lester wrote: > On Thu, Jun 09, 2005 at 11:23:03AM -0500, Jay Hannah > (jhannah at omnihotels.com) wrote: >> my $glob = "/junk/__peglogs/comserver-trans-a.log.$y$m$d"; >> my $cat = "cat"; >> if (`ls $glob*.bz2 2>/dev/null`) { >> $cat = "bzcat"; >> } > > You don't need to use `ls` to get a list of files. > > my @files = glob( "$glob*.bz2" ); oooooo!! Slick! So I guess I could have done something like.... my $glob = "/junk/__peglogs/comserver-trans-a.log.$y$m$d"; my $cat = "cat"; if (glob("$glob*.bz2")) { $cat = "bzcat"; } open (IN, "$cat $glob* |"); while () { ..... or better yet (?): my $glob = "/junk/__peglogs/comserver-trans-a.log.$y$m$d"; my $cat = glob("$glob*.bz2") ? "bzcat" : "cat"; open (IN, "$cat $glob* |"); while () { ..... j From andy at petdance.com Thu Jun 9 18:50:03 2005 From: andy at petdance.com (Andy Lester) Date: Thu, 9 Jun 2005 20:50:03 -0500 Subject: [Omaha.pm] quick n dirty rand() In-Reply-To: <200506092303.j59N3Qnn025190@omares-email.omnihotels.com> References: <200506092303.j59N3Qnn025190@omares-email.omnihotels.com> Message-ID: <20050610015003.GA6939@petdance.com> On Thu, Jun 09, 2005 at 06:04:16PM -0500, Jay Hannah (jhannah at omnihotels.com) wrote: > > Before > > my $rand = int(rand(3))+1; > my $imagename = "sean.jpg"; > $imagename = "jay.jpg" if ($rand == 2); > $imagename = "airplane.jpg" if ($rand == 3); > > After > > my $imagename = ("sean.jpg", "jay.jpg", "airplane.jpg")[(int rand 3)]; Better yet: my @images = qw( sean.jpg jay.jpg airplane.jpg ); my $random_image = $images[rand @images]; -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From jhannah at omnihotels.com Mon Jun 13 11:43:44 2005 From: jhannah at omnihotels.com (Jay Hannah) Date: Mon, 13 Jun 2005 13:43:44 -0500 Subject: [Omaha.pm] CGI restore_parameters() Message-ID: <200506131843.j5DIh1ic016130@omares-email.omnihotels.com> Hi Lincoln -- Does restore_parameters not work the way I think it should? save() is saving a state file fine, and new($fh) will read that state file fine, but I can't seem to get restore_parameters to do anything... perl v5.8.3 built for i686-linux CGI v3.10 Linux razorbill 2.4.21-243-default #1 Thu Aug 12 15:22:14 UTC 2004 i686 i686 i386 GNU/Linux Thanks, j ----------------------- #!/usr/bin/perl use strict; use CGI; use FileHandle; my $q = CGI->new(); my $fh = FileHandle->new(">/tmp/q.param"); $q->param("name", "Jay"); $q->save($fh); $fh->close; # Ok, /tmp/q.param is has name in it. Worked fine. # Let's try to restore_parameters() it... $fh = FileHandle->new("/tmp/q.param"); my $q = CGI->new(); $q->restore_parameters($fh) or die; print "name is ", $q->param("name"), "\n"; # No good. name is empty. $fh = FileHandle->new("/tmp/q.param"); my $q = CGI->new($fh); print "name is ", $q->param("name"), "\n"; # That worked fine. name is set. ----------------------- From jay at jays.net Tue Jun 14 23:17:13 2005 From: jay at jays.net (Jay Hannah) Date: Wed, 15 Jun 2005 01:17:13 -0500 Subject: [Omaha.pm] Reminder: No June mtg Message-ID: <52b2b778e0e98c66e9475e6bba8b22e2@jays.net> Reminder: There is no June mtg. The next mtg is July 21st: http://omaha.pm.org/ I'm off to Taiwan in 4 hours! Wish me luck! j From dan at linder.org Wed Jun 15 21:26:26 2005 From: dan at linder.org (Daniel Linder) Date: Wed, 15 Jun 2005 23:26:26 -0500 (CDT) Subject: [Omaha.pm] One-liner regexp to check for password strength... Message-ID: <22962.24.252.28.96.1118895986.squirrel@24.252.28.96> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Guys, I'm looking for a Perl one-liner regexp that will check a given password string to see if it meets a 'strength' requiement. The tests are: 1: Length >= 6 characters 2a: Contains number(s) (0-9) 2b: Contains lowercase letter(s) (a-z) 2c: Contains uppercase letter(s) (A-Z) 2d: Contains symbol character(s) (!@#$%^&*()-=_+`~\|":;<>,.?/ ... etc) A password is good if it meets rule #1 and three of the four in #2. At first glance a check such as /[a-z]+[A-Z]+[0-9]+/ could be a start, but it requires that the order of the lower case characters be before any upper-case characters or numbers, plus it ignores the length requirement. I've pretty much given up on a one-liner and this is the closest I can come up with (ugly): #!/usr/bin/perl $PASSWD=shift; $LEN = length($PASSWD); printf ("LEN: $LEN\n"); $NumDigits = ($PASSWD =~ tr/[0-9]*//); printf ("NumDigits: $NumDigits\n"); $NumUpperCase = ($PASSWD =~ tr/[A-Z]*//); printf ("NumUpperCase: $NumUpperCase\n"); $NumLowerCase = ($PASSWD =~ tr/[a-z]*//); printf ("NumLowerCase: $NumLowerCase\n"); $NumSpecial = ($PASSWD =~ tr/[\!\@\#\$\%\^\&\*\(\)\_\+\-\=\{\}\[\]\\\|;\':\"\,\.\/\<\>\?\~\`]*//); printf ("NumSpecial: $NumSpecial\n"); if ( ( $LEN >= 6 ) and ( ($NumDigits?1:0) + ($NumUpperCase?1:0) + ($NumLowerCase?1:0) + ($NumSpecial?1:0) >= 3 ) ) { printf ("Password \"%s\" passed.\n", $PASSWD); } Dan - - - - - "Wait for that wisest of all counselors, time." -- Pericles "I do not fear computer, I fear the lack of them." -- Isaac Asimov GPG fingerprint:9EE8 ABAE 10D3 0B55 C536 E17A 3620 4DCA A533 19BF -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQFCsP9yNiBNyqUzGb8RAgsPAJ4lIEf4iu8GVvgc/ad9mGGTQOXEkgCfc4jG 5V5mgha1r4/BjlOqR0c6K24= =MUv8 -----END PGP SIGNATURE----- From glim at mycybernet.net Thu Jun 16 21:44:00 2005 From: glim at mycybernet.net (Gerard Lim) Date: Fri, 17 Jun 2005 00:44 -0400 Subject: [Omaha.pm] Last-minute reminder -- YAPC::NA 2005 Message-ID: Here's a last reminder about Yet Another Perl Conference, North America (YAPC::NA 2005) http://yapc.org/America In case anyone out there has been sitting on the fence or has been meaning to register but has put it on the backburner until now, here is a final information package. Dates: Mon - Wed June 27 - 29, 2005 (11 days from now!) Location: 89 Chestnut Street, University of Toronto, Toronto, Ontario, Canada Accommodations ============== Due to recent renegotiations with the conference facility and hotel, 89 Chestnut, there are still a few rooms left. For details on accommodations go to: http://www.yapc.org/America/accommodations-2005.shtml For quick and easy booking: 89 Chestnut Phone: +1-416-977-0707 Conference booking code: perl0626 The base rate is approx. CAD$80/night, which is *great* for downtown Toronto. Add in taxes and in-room high speed internet and it's up to about CAD$95/night. Book yourself to check-in on Sunday the 26th and check-out on the morning of Wednesday the 29th. Conference Registration ======================= Registration is easy and cheap - only USD$85 - see http://yapc.org/America/register-2005.shtml for details or register directly online at http://donate.perlfoundation.org/index.pl?node=registrant%20info&conference_id=423 The schedule is awesome - http://yapc.org/America/schedule-2005/day1.html >From here, click on the "Day 2" and "Day 3" spots near the top to go from page to page. Click on a talk name to get details regarding the talk. Speakers include Larry Wall, Allison Randal, Autrijus Tang, Brian Ingerson, Andy Lester, chromatic, brian d foy, Chip Salzenberg & Dan Sugalski... and many more! [ This message was sent by Gerard Lim on behalf of the YAPC::NA 2005 Conference organizing committee of the Toronto Perl Mongers. Thanks for your patience and support. ] From jeremy at stuact.tamu.edu Mon Jun 20 08:56:24 2005 From: jeremy at stuact.tamu.edu (Fluhmann, Jeremy) Date: Mon, 20 Jun 2005 10:56:24 -0500 Subject: [Omaha.pm] http://perl.meetup.com - Omaha is #2! Message-ID: <297203B1AD107A438D2616D3A8E9B382E0FE32@DSAE2K.DSAD.AD.TAMU.EDU> I was just doing a search online for some other User groups in College Station when I came across a posting from this group. > I say we drive down to College Station TX (group #1) and TP them. > [snipped] :-( Sadly, I'm the only one in the Meetup group. I was the organizer, but I guess after being inactive they took it away from me (even though I'm the only member). But it looks as if an organizer must pay a monthly subscription now. Is that correct? > BTW, I have a good friend that just moved to College Station, TX that may > be more than willing to take on the task if I asked her. [Posted by Timothy "Irish" O'Brien] Is your friend into Perl? I'm about to get a Perl Mongers group together down here. I already have some people lined up so I'll have to get them into the meetup group as well (maybe). I'm just waiting for support at pm.org to setup my web and MailMan account. Jeremy Fluhmann Microcomputer Specialist Department of Student Activities Texas A&M University 979-458-4649 jeremy at stuact.tamu.edu This e-mail and any files transmitted with it are confidential. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the contents of this information is prohibited. If you have received this e-mail transmission in error, please notify me by telephone or via return e-mail and delete this e-mail from your system. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/omaha-pm/attachments/20050620/1007d02e/attachment.html