From scott.l.miller at hp.com Wed Jul 7 15:07:01 2004 From: scott.l.miller at hp.com (Miller, Scott L (Omaha Networks)) Date: Mon Aug 2 21:33:59 2004 Subject: [Omaha.pm] Sort quickie Message-ID: <1F7C0C8F4BD7C54A8BC55012FEF3DF6D0302E605@omaexc11.americas.cpqcorp.net> Along these lines, here's something that I've stuck into most of my scripts; whether it is actually used or not. ############################################################ # Sorting routine to sort by number # below subroutine is equivalent to these 3 lines # if($a < $b) { -1; } # elsif($a == $b) { 0; } # elsif($a > $b) { 1; } ############################################################ sub by_number { $a <=> $b; } In use, it looks like this: @numary = (2,9,5,4,30,21,11,10,1,7,215,"Two","Three","Four"); print "Sorted by ASCII\n"; foreach (sort @numary) { print "$_\n"; } print "\nSorted by number\n"; foreach (sort by_number @numary) { print "$_\n"; } Output is: Sorted by ASCII 1 10 11 2 21 215 30 4 5 7 9 Four Three Two Sorted by number Three Two Four 1 2 4 5 7 9 10 11 21 30 215 Another interesting possibility, expanding on what Jay started; it might be possible to use Jay's technique to sort IP addresses without first converting the addresses to their "long int" form... -Scott -----Original Message----- From: omaha-pm-bounces@pm.org [mailto:omaha-pm-bounces@pm.org]On Behalf Of m?ntar3 Sent: Saturday, June 19, 2004 6:29 PM To: Perl Mongers of Omaha, Nebraska USA Subject: Re: [Omaha.pm] Sort quickie I use(d) that functionality to sort tabular data (two-dimensional arrays, or an array hashes)---work(s|ed) well with CGI, allowing user(s) to specify what column to sort on (and hides detail like comparisons of text vs numerals vs dates in the called function). It's about as useful as the Unix "find" utility. Jay Hannah wrote: > > I had a bunch of hash keys that were dates in MMDDYYYY format. I > wanted to get a sorted list of the keys. Perl to the rescue! Have > y'all configured custom sort subroutines before? They're cool... > > The real code in context... > ------------ > print "\n\nGroup pickup by cap_date (running total):\n"; > foreach (sort sort_by_cap_date keys %{$group_pickup{by_cap_date}}) { > my $val = $group_pickup{by_cap_date}{$_}; > next if $val == 0; > print "$_: $val\n"; > } > } > > sub sort_by_cap_date ($$) { > # We have to throw some mojo here since capdate is MMDDYYYY and > obviously > # we can't sort until we turn it into YYYYMMDD... -jhannah 6/14/04 > my ($a, $b) = @_; > for ($a, $b) { > s/(\d\d)(\d\d)(\d\d\d\d)/$3$1$2/; > } > $a <=> $b; > } > --------------- > > Same idea, distilled out to see the results easier and so you can play > with it: > --------------- > my @dates = qw( 05012003 02012004 11012002 ); > print join ", ", sort @dates; > print "\n"; > print join ", ", sort by_date @dates; > print "\n"; > > sub by_date ($$) { > my ($a, $b) = @_; > for ($a, $b) { > s/(\d\d)(\d\d)(\d\d\d\d)/$3$1$2/; > } > $a <=> $b; > } > ---------------- > > "sort" just does an ASCII sort, which isn't in date order for MMDDYYYY > dates. Instead, "sort by_date" does a comparison after converting > MMDDYYYY into YYYYMMDD, which does sort dates correctly. It doesn't > munge the real values though. > > Neat, huh? > > perldoc -f sort > > j > > _______________________________________________ > Omaha-pm mailing list > Omaha-pm@pm.org > http://www.pm.org/mailman/listinfo/omaha-pm > _______________________________________________ Omaha-pm mailing list Omaha-pm@pm.org http://www.pm.org/mailman/listinfo/omaha-pm From jay at jays.net Thu Jul 8 00:12:03 2004 From: jay at jays.net (Jay Hannah) Date: Mon Aug 2 21:33:59 2004 Subject: [Omaha.pm] Sort quickie In-Reply-To: <1F7C0C8F4BD7C54A8BC55012FEF3DF6D0302E605@omaexc11.americas.cpqcorp.net> References: <1F7C0C8F4BD7C54A8BC55012FEF3DF6D0302E605@omaexc11.americas.cpqcorp.net> Message-ID: <5925D98C-D09D-11D8-BB09-000A95E317B8@jays.net> On Jul 7, 2004, at 3:07 PM, Miller, Scott L (Omaha Networks) wrote: > Another interesting possibility, expanding on what Jay started; > it might be possible to use Jay's technique to sort IP addresses > without first converting the addresses to their "long int" form... cmp was driving me crazy so I jumped on IRC (irc.freenode.net #perl)... The 2nd code block below is an IPv4 IP sorter for you... The 1st code block is a faulty one. -grin- j -------------------------------- This content is stored as http://sial.org/pbot/3335. From: "Omaha" at 68.13.20.113 Summary: Confused by cmp I was writing a quick demo of how to sort IPv4 addresses. The problem is that the by_ip sort below should NOT work, as I undestand cmp, yet somehow it already does... Shouldn't "sort @x" and "sort by_ip @x" as written below both return the same series? I thought '$a cmp $b' was the default behavior of sort? Confused... my @ips = qw( 20.0.50.0 20.0.100.0 77.0.0.0 100.0.0.0 ); print join ", ", sort @ips; print "\n"; print join ", ", sort by_ip @ips; print "\n"; sub by_ip { my ($a, $b) = @_; $a cmp $b; } ---------- "Omaha" at 68.13.20.113 pasted "Confused by cmp" (23 lines, 554B) at http://sial.org/pbot/3335 Omaha: that's because you're comparing two undef vars i.e $a & $b aren't put in @_, they're magical package level vars drop my($a,$b) = @_ and it works as expected ... ahhh... ok. So my cmp always returned 0, leaving the array in original order, which just happened to be sorted by IP already. Got it... Any way to local($a, $b) so I can manipulate them? -ponder- Just trying to save a couple lines of code I guess... Maybe more descriptive variable names would be a prudent idea. * Omaha grins avoid $a & $b outside of sort { ... }, it saves all sorts of headaches ----------- This content is stored as http://sial.org/pbot/3336. From: "Omaha" at 68.13.20.113 Summary: sort by_ip -- feedback anyone? Quick and dirty IPv4 sorter? my @ips = qw( 20.0.100.0 20.0.50.0 100.0.0.0 77.0.0.0 ); print join ", ", sort @ips; print "\n"; print join ", ", sort by_ip @ips; print "\n"; sub by_ip { my ($j, $k) = ($a, $b); for ($j, $k) { $_ = sprintf("%03d.%03d.%03d.%03d", split /\./); } $j cmp $k; } ------------------------ "Omaha" at 68.13.20.113 pasted "sort by_ip -- feedback anyone?" (17 lines, 327B) at http://sial.org/pbot/3336 Omaha: I'd use Sockets, inet_aton and {$a cmp $b} Omaha: but yours works too --------------- Beware False Hubris (inventing your own wheel), False Impatience (thinking you can make one more quickly than it'd take to learn an existing one), and False Laziness (thinking that making your own is less effort). -------------- is this fine? if (!$lasttimestamp) { $lasttimestamp = 0; } $lasttimestamp ||= 0; Omaha, cool. ya. :) From scott.l.miller at hp.com Thu Jul 8 10:54:09 2004 From: scott.l.miller at hp.com (Miller, Scott L (Omaha Networks)) Date: Mon Aug 2 21:33:59 2004 Subject: [Omaha.pm] Sort quickie Message-ID: <1F7C0C8F4BD7C54A8BC55012FEF3DF6D0302E606@omaexc11.americas.cpqcorp.net> See Jay's IP sorting routine below: Very cool :-) Now, who's up for a discussion about whether it's a good idea to convert first and then sort, or leave the solution as given? While this is a cheap, clear solution for small arrays, actually using this technique for large arrays with N elements, means that the conversions will need to be done O (N * ln N) times with recent version of perl (which use the heap sort). Where if you convert first, then sort then convert back, the conversion only needs to be done 2*N times. Using older versions of perl where the quick sort method was used, if the data was already sorted, then quick sort performs very badly, and the comparisons jump to O (N^2). There is fascinating (to me anyway) discussion happening on the "perl-5-porters" email list, which can be found near the bottom of the page here: http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2004-06/thrd2.html#00441 The really interesting portion of the thread starts where you see the subject "Short circuiting sort". To give you a quick taste of the discussion; as you may or may not know, sort in scalar context (what it returns) is undefined. Several options have been discussed on what it should return in scalar context. Some want the first element in the resulting sorted list, some want a truth value of whether it was already sorted, some want the number of swaps performed, others want a ratio of how sorted the list was, etc. Thus, due to the range of desires, and no clear cut "best option" it has been left undefined. That is the prehistory of this topic. Recently someone presented a patch for sort to actually go play "nethack" if someone called it in scalar context. It was, of course, a joke, but some people ran with that joke... Anyway, while that absurdity was being discussed, someone else said they would like to see the ability to short circuit the sort routine if they only wanted the first M elements resulting from a sort of N elements. The argument being, "why sort the whole list if I only want the top 5 elements?". Thus, the discussion of the pro's and con's of various sorting algorithms, how to implement a short circuiting ability without making a complete sort any more expensive etc. Cool stuff. -Scott -----Original Message----- From: omaha-pm-bounces@pm.org [mailto:omaha-pm-bounces@pm.org]On Behalf Of Jay Hannah Sent: Thursday, July 08, 2004 12:12 AM To: Perl Mongers of Omaha, Nebraska USA Subject: Re: [Omaha.pm] Sort quickie On Jul 7, 2004, at 3:07 PM, Miller, Scott L (Omaha Networks) wrote: > Another interesting possibility, expanding on what Jay started; > it might be possible to use Jay's technique to sort IP addresses > without first converting the addresses to their "long int" form... cmp was driving me crazy so I jumped on IRC (irc.freenode.net #perl)... The 2nd code block below is an IPv4 IP sorter for you... The 1st code block is a faulty one. -grin- j -------------------------------- This content is stored as http://sial.org/pbot/3335. From: "Omaha" at 68.13.20.113 Summary: Confused by cmp I was writing a quick demo of how to sort IPv4 addresses. The problem is that the by_ip sort below should NOT work, as I undestand cmp, yet somehow it already does... Shouldn't "sort @x" and "sort by_ip @x" as written below both return the same series? I thought '$a cmp $b' was the default behavior of sort? Confused... my @ips = qw( 20.0.50.0 20.0.100.0 77.0.0.0 100.0.0.0 ); print join ", ", sort @ips; print "\n"; print join ", ", sort by_ip @ips; print "\n"; sub by_ip { my ($a, $b) = @_; $a cmp $b; } ---------- "Omaha" at 68.13.20.113 pasted "Confused by cmp" (23 lines, 554B) at http://sial.org/pbot/3335 Omaha: that's because you're comparing two undef vars i.e $a & $b aren't put in @_, they're magical package level vars drop my($a,$b) = @_ and it works as expected ... ahhh... ok. So my cmp always returned 0, leaving the array in original order, which just happened to be sorted by IP already. Got it... Any way to local($a, $b) so I can manipulate them? -ponder- Just trying to save a couple lines of code I guess... Maybe more descriptive variable names would be a prudent idea. * Omaha grins avoid $a & $b outside of sort { ... }, it saves all sorts of headaches ----------- This content is stored as http://sial.org/pbot/3336. From: "Omaha" at 68.13.20.113 Summary: sort by_ip -- feedback anyone? Quick and dirty IPv4 sorter? my @ips = qw( 20.0.100.0 20.0.50.0 100.0.0.0 77.0.0.0 ); print join ", ", sort @ips; print "\n"; print join ", ", sort by_ip @ips; print "\n"; sub by_ip { my ($j, $k) = ($a, $b); for ($j, $k) { $_ = sprintf("%03d.%03d.%03d.%03d", split /\./); } $j cmp $k; } ------------------------ "Omaha" at 68.13.20.113 pasted "sort by_ip -- feedback anyone?" (17 lines, 327B) at http://sial.org/pbot/3336 Omaha: I'd use Sockets, inet_aton and {$a cmp $b} Omaha: but yours works too --------------- Beware False Hubris (inventing your own wheel), False Impatience (thinking you can make one more quickly than it'd take to learn an existing one), and False Laziness (thinking that making your own is less effort). -------------- is this fine? if (!$lasttimestamp) { $lasttimestamp = 0; } $lasttimestamp ||= 0; Omaha, cool. ya. :) _______________________________________________ Omaha-pm mailing list Omaha-pm@pm.org http://www.pm.org/mailman/listinfo/omaha-pm From jay at jays.net Fri Jul 9 16:45:07 2004 From: jay at jays.net (Jay Hannah) Date: Mon Aug 2 21:33:59 2004 Subject: [Omaha.pm] s(a)(AAA) -- wow Message-ID: <3EA22AFC-D1F1-11D8-9EAE-000A95E317B8@jays.net> Wow. I knew you could change / to any character for matching and substituting... s/// can be written as s### or sxxx But I've never seen parens used before! test code -------------------- % cat j.pl #!/usr/bin/perl my $j = "blah away"; $j =~ s(a)(AAA)g; print "$j\n"; % perl j.pl blAAAh AAAwAAAy -------------------- Actual code I ran into in Pod::Tree::PerlPod: my $perl_dir = $perl_pod->{perl_dir}; my $html_dir = $perl_pod->{html_dir}; $dest =~ s(^$perl_dir)($html_dir); Wow..... hese work too: s[a][AAA]g s{a}{AAA}g What arcane crap *can't* you do in Perl? Laugh, j From hostetlerm at gmail.com Mon Jul 12 10:48:43 2004 From: hostetlerm at gmail.com (Mike Hostetler) Date: Mon Aug 2 21:33:59 2004 Subject: [Omaha.pm] Sort quickie In-Reply-To: <7A626BB0-C1AF-11D8-8759-000A95E317B8@jays.net> References: <7A626BB0-C1AF-11D8-8759-000A95E317B8@jays.net> Message-ID: On Sat, 19 Jun 2004 00:14:02 -0500, Jay Hannah wrote: > > I had a bunch of hash keys that were dates in MMDDYYYY format. I wanted > to get a sorted list of the keys. Perl to the rescue! Have y'all > configured custom sort subroutines before? They're cool... [snip] Concerning parsing dates . .. I just discovered a nifty module in CPAN called Date::Manip that will parse anything -- just dangle anything that resembles a date around it, and it will figure it out. >From perldoc Date::Manip: $date = ParseDate("today"); $date = ParseDate("1st thursday in June 1992"); $date = ParseDate("05/10/93"); $date = ParseDate("12:30 Dec 12th 1880"); $date = ParseDate("8:00pm december tenth"); -- Mike Hostetler thehaas@binary.net http://www.binary.net/thehaas From ken at bitsko.slc.ut.us Tue Jul 13 17:56:08 2004 From: ken at bitsko.slc.ut.us (Ken MacLeod) Date: Mon Aug 2 21:33:59 2004 Subject: [Omaha.pm] Odd jobs wanted: Perl, C, Python, Unix/Linux Message-ID: Really Cheap Rates for Really Good Software No, this is not a spam for w@r3z, just looking for interesting side work to supplement the Marina and Beer fund while I look for the perfect position. I'm looking to do small (days to a week or so at a go), fixed-priced projects. As long as it's interesting -- spinning tops have been known to keep me entertained for hours -- you can name your rate! Here's your chance to get that special whiz-bang project done, the little utility you've been meaning to get written, or spend some quality time improving an area of your project or product. All without any hassles: you describe, I do, you pay. *** Satisfaction and bug-free software guaranteed. *** Here's where I do best: * Unix, Linux, MacOS X, BSD, and Open Source-style Windows XP. * Expert in Perl, C, and Python, and at these rates, pretty damn fine at Java, C++, and potentially .NET too! * Web-based apps, servlets, XML services * Databases/DB APIs, Oracle, Postgres, MySQL, Sybase * Internet, systems software, build/release tools, packaging * Systems admin type stuff I can also help implement, mentor, or coach on the following: * Test-driven development, JUnit, PyUnit, *Unit * Automating software builds, releases, and testing * Building "standard" releases and release packages * Portable software, autoconf/automake * Configuration management, CVS, Subversion, arch, Perforce * Maintaining perfect systems, scaling up Email, Jabber, or MSN message me at ken@bitsko.slc.ut.us, or 'poy_mp3' on Yahoo!, or if you're an in-real-life sort of person, you can call me on 515-222-5993. Remember: it's fixed price, you get to set the price, and the work is guaranteed or you don't pay. There's nothing to lose and the only "catch", if you can call the obvious that, is that someone else offers something more interesting before your project starts, so get in early! -- Ken From hjarce2001 at yahoo.com Wed Jul 14 22:32:04 2004 From: hjarce2001 at yahoo.com (Hugh Jarce) Date: Mon Aug 2 21:33:59 2004 Subject: [Omaha.pm] Sort quickie Message-ID: <20040715033204.71348.qmail@web90005.mail.scd.yahoo.com> Jay Hannah wrote: > sub sort_by_cap_date ($$) { > # We have to throw some mojo here since capdate is MMDDYYYY and obviously > # we can't sort until we turn it into YYYYMMDD... -jhannah 6/14/04 > my ($a, $b) = @_; > for ($a, $b) { > s/(\d\d)(\d\d)(\d\d\d\d)/$3$1$2/; > } > $a <=> $b; > } This sub can be written more efficiently as: sub by_date2 { substr($a,4) cmp substr($b,4) || $a cmp $b } or: sub by_date3 { substr($a,4).$a cmp substr($b,4).$b } Out of curiosity, I benchmarked 4 different ways to do it: use strict; use Benchmark; my @dates = ( '05012003', '02012004', '11012002', '05012002', '02012003', '11012001', '06012002', '05022002', '05022004' ) x 9999; sub by_date ($$) { my ($a, $b) = @_; for ($a, $b) { s/(\d\d)(\d\d)(\d\d\d\d)/$3$1$2/; } $a <=> $b; } sub by_date2 { substr($a,4) cmp substr($b,4) || $a cmp $b } sub by_date3 { substr($a,4).$a cmp substr($b,4).$b } sub j9 { my @x = sort by_date @dates } sub j2 { my @x = sort by_date2 @dates } sub j3 { my @x = sort by_date3 @dates } sub j1 { my @x = map { substr($_,4) } sort map { substr($_,4).$_ } @dates } timethese(10, { 'j1' => \&j1, 'j2' => \&j2, 'j3' => \&j3, 'j9' => \&j9 }); Results on Linux were: perl 5.8.4: j1: 7 wallclock secs ( 7.54 usr + 0.03 sys = 7.57 CPU) @ 1.32/s (n=10) j2: 10 wallclock secs (10.04 usr + 0.01 sys = 10.05 CPU) @ 1.00/s (n=10) j3: 13 wallclock secs (13.45 usr + 0.00 sys = 13.45 CPU) @ 0.74/s (n=10) j9: 169 wallclock secs (168.82 usr + 0.00 sys = 168.82 CPU) @ 0.06/s (n=10) perl 5.6.1: j1: 6 wallclock secs ( 6.07 usr + 0.02 sys = 6.09 CPU) @ 1.64/s (n=10) j2: 5 wallclock secs ( 5.34 usr + 0.00 sys = 5.34 CPU) @ 1.87/s (n=10) j3: 7 wallclock secs ( 7.00 usr + 0.00 sys = 7.00 CPU) @ 1.43/s (n=10) j9: 75 wallclock secs (74.57 usr + 0.00 sys = 74.57 CPU) @ 0.13/s (n=10) Which surprised me. I expected j1 to be much faster. Hugh --------------------------------- Do you Yahoo!? Yahoo! Mail - You care about security. So do we. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/omaha-pm/attachments/20040714/d39a398d/attachment.htm From hjarce2001 at yahoo.com Wed Jul 14 22:42:03 2004 From: hjarce2001 at yahoo.com (Hugh Jarce) Date: Mon Aug 2 21:33:59 2004 Subject: [Omaha.pm] s(a)(AAA) -- wow Message-ID: <20040715034203.74514.qmail@web90006.mail.scd.yahoo.com> Jay Hannah wrote: > These work too: > > s[a][AAA]g > s{a}{AAA}g > > What arcane crap *can't* you do in Perl? Also, note that the replacement operand may have different delimiters to the regex operand. So these work too: s[a]/AAA/g s'AAA'g When the replacement operand's delimiters are single quotes, no variable interpolation is done. Hugh --------------------------------- Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/omaha-pm/attachments/20040714/ece59339/attachment.htm From jhannah at omnihotels.com Wed Jul 21 17:56:34 2004 From: jhannah at omnihotels.com (Jay Hannah) Date: Mon Aug 2 21:33:59 2004 Subject: [Omaha.pm] Pod::Tree - .pm files w/ no POD? Message-ID: <001501c46f75$f92ba3a0$4722000a@omarests2> Hi Steve -- I just discovered pods2html. Very cool! We have a lot of .pm files that do have POD, and even more .pm files that don't have POD. Unfortunately, the no POD .pm files do create an (empty) .html file, and are added to the index. So, I'm running the following hack: -------------------- pods2html /usr/lib/perl5/site_perl/Omni /home/jhannah/public_html # It would be neat to use the pods2html option # --index "Omni POD Archive" # but the .pm's w/ no POD end up in the index, which is annoying. # Nuke out all the no POD .html's which have been created. They're all # 95 bytes. find ./ -size 95c -exec rm {} \; -------------------- I noticed you're also the author of Pod::Tree, so I just thought I'd send this to you, wondering if you'd want a patch to Pod::Tree::has_pod() which would (optionally?) return false if the .pm file didn't actually have any POD in it...? Then I guess an option would have to be added to pods2html as well to pass that in? Or is my idea stupid and/or not worth the time to worry about? (First I played with Pod::Tree::PerlPod, which seems to create the same phenomenon. I'm unclear about the differences between Pod::Tree::PerlPod and pods2html...) (Incidentally, I'm also the group leader of the Omaha Perl Mongers http://omaha.pm.org) Thanks! Jay Hannah Director of Development Omni Hotels Reservation Center Tel: (402) 952-6573 Mobile: (402) 578-3976 Email: jhannah@omnihotels.com Find out why we believe the Lone Star State is even more ideal this summer and about the Ideal Escape leisure package. Call 1-800-The-Omni or visit us at www.omnitexashotels.com. From jhannah at omnihotels.com Wed Jul 21 18:16:04 2004 From: jhannah at omnihotels.com (Jay Hannah) Date: Mon Aug 2 21:33:59 2004 Subject: [Omaha.pm] Mail::Folder missing person Message-ID: <001601c46f78$b2e88cc0$4722000a@omarests2> Interesting... Kevin Johnson (author of Mail::Folder) email bounces and I can't find him. Looks like he hasn't posted up to CPAN since 1999. http://cpan.org/modules/by-authors/id/KJOHNSON/ I even Googled and found a wrong Kevin Johnson. -grin- - CPAN policy (according to their FAQ) seems to not touch anything if an author disappears (even for 5 years?)... - It appears that Mail::Folder has been superceeded by Mail::Box, which is active. Should probably port our gizmo to that some day. - A forced install of Mail::Folder got us through the problem below anyway. It still works fine for our purposes. I guess I've bought some time before having to learn Mail::Box. -grin- Curiouser and curiouser, j -----Original Message----- From: Jay Hannah [mailto:jhannah@omnihotels.com] Sent: Tuesday, July 20, 2004 9:35 AM To: kjj@pobox.com Subject: Mail::Folder Hi Kevin -- We've been using Mail::Folder for a few years, firing it up every once in a while to purge specific emails out of 2200 Mbox files... In a recent install (last night) we hit a lot of noise. Are you still maintaining Mail::Folder? Would you want patches? Thanks, Jay Hannah Director of Development Omni Hotels Reservation Center Tel: (402) 952-6573 Mobile: (402) 578-3976 Email: jhannah@omnihotels.com Find out why we believe the Lone Star State is even more ideal this summer and about the Ideal Escape leisure package. Call 1-800-The-Omni or visit us at www.omnitexashotels.com. Running make for K/KJ/KJOHNSON/MailFolder-0.07.tar.gz Is already unwrapped into directory /var/cache/cpan/build/MailFolder-0.07 CPAN.pm: Going to build K/KJ/KJOHNSON/MailFolder-0.07.tar.gz cp Mail/Folder/NNTP.pm blib/lib/Mail/Folder/NNTP.pm cp Mail/Folder/Emaul.pm blib/lib/Mail/Folder/Emaul.pm cp Mail/Folder.pm blib/lib/Mail/Folder.pm cp Mail/Folder/Mbox.pm blib/lib/Mail/Folder/Mbox.pm cp Mail/Folder/Maildir.pm blib/lib/Mail/Folder/Maildir.pm Manifying blib/man3/Mail::Folder::NNTP.3 Manifying blib/man3/Mail::Folder::Emaul.3 Manifying blib/man3/Mail::Folder.3 Manifying blib/man3/Mail::Folder::Mbox.3 Manifying blib/man3/Mail::Folder::Maildir.3 /usr/bin/make -- OK Running make test /usr/bin/perl t/TEST 0 emaul/01_emaul........defined(@array) is deprecated at ../blib/lib/Mail/Folder/Emaul.pm line 502. (Maybe you should just omit the defined()?) defined(@array) is deprecated at ../blib/lib/Mail/Folder/Mbox.pm line 782. (Maybe you should just omit the defined()?) ok emaul/02_empty........defined(@array) is deprecated at ../blib/lib/Mail/Folder/Emaul.pm line 502. (Maybe you should just omit the defined()?) ok emaul/03_sync.........defined(@array) is deprecated at ../blib/lib/Mail/Folder/Emaul.pm line 502. (Maybe you should just omit the defined()?) ok emaul/04_curr.........defined(@array) is deprecated at ../blib/lib/Mail/Folder/Emaul.pm line 502. (Maybe you should just omit the defined()?) ok emaul/05_get..........defined(@array) is deprecated at ../blib/lib/Mail/Folder/Emaul.pm line 502. (Maybe you should just omit the defined()?) MIME::Parser=HASH(0x85368fc) isn't a subclass of MIME::ParserBase at emaul/05_get.t line 25 dubious Test returned status 255 (wstat 65280, 0xff00) DIED. FAILED tests 15-24 Failed 10/24 tests, 58.33% okay emaul/06_label........defined(@array) is deprecated at ../blib/lib/Mail/Folder/Emaul.pm line 502. (Maybe you should just omit the defined()?) ok emaul/07_del..........defined(@array) is deprecated at ../blib/lib/Mail/Folder/Emaul.pm line 502. (Maybe you should just omit the defined()?) ok emaul/08_sort.........defined(@array) is deprecated at ../blib/lib/Mail/Folder/Emaul.pm line 502. (Maybe you should just omit the defined()?) ok emaul/09_select.......defined(@array) is deprecated at ../blib/lib/Mail/Folder/Emaul.pm line 502. (Maybe you should just omit the defined()?) ok emaul/10_append.......defined(@array) is deprecated at ../blib/lib/Mail/Folder/Emaul.pm line 502. (Maybe you should just omit the defined()?) ok emaul/11_pack.........defined(@array) is deprecated at ../blib/lib/Mail/Folder/Emaul.pm line 502. (Maybe you should just omit the defined()?) ok emaul/12_refile.......defined(@array) is deprecated at ../blib/lib/Mail/Folder/Emaul.pm line 502. (Maybe you should just omit the defined()?) ok emaul/13_update.......defined(@array) is deprecated at ../blib/lib/Mail/Folder/Emaul.pm line 502. (Maybe you should just omit the defined()?) ok mbox/01_mbox..........defined(@array) is deprecated at ../blib/lib/Mail/Folder/Mbox.pm line 782. (Maybe you should just omit the defined()?) (in cleanup) yeep! can't read /tmp/mbox.1.16029 disappeared: No such file or directory at mbox/01_mbox.t line 14 (in cleanup) yeep! can't read /tmp/mbox.2.16029 disappeared: No such file or directory at mbox/01_mbox.t line 0 ok mbox/02_empty.........defined(@array) is deprecated at ../blib/lib/Mail/Folder/Mbox.pm line 782. (Maybe you should just omit the defined()?) (in cleanup) yeep! can't read /tmp/mbox.1.16031 disappeared: No such file or directory at mbox/02_empty.t line 22 (in cleanup) yeep! can't read /tmp/mbox.2.16031 disappeared: No such file or directory at mbox/02_empty.t line 0 ok mbox/03_sync..........defined(@array) is deprecated at ../blib/lib/Mail/Folder/Mbox.pm line 782. (Maybe you should just omit the defined()?) (in cleanup) yeep! can't read /tmp/mbox.1.16033 disappeared: No such file or directory at mbox/03_sync.t line 0 ok mbox/04_curr..........defined(@array) is deprecated at ../blib/lib/Mail/Folder/Mbox.pm line 782. (Maybe you should just omit the defined()?) (in cleanup) yeep! can't read /tmp/mbox.1.16037 disappeared: No such file or directory at mbox/04_curr.t line 0 ok mbox/05_get...........defined(@array) is deprecated at ../blib/lib/Mail/Folder/Mbox.pm line 782. (Maybe you should just omit the defined()?) MIME::Parser=HASH(0x8541a64) isn't a subclass of MIME::ParserBase at mbox/05_get.t line 26 dubious Test returned status 255 (wstat 65280, 0xff00) DIED. FAILED tests 15-29 Failed 15/29 tests, 48.28% okay mbox/06_label.........defined(@array) is deprecated at ../blib/lib/Mail/Folder/Mbox.pm line 782. (Maybe you should just omit the defined()?) (in cleanup) yeep! can't read /tmp/mbox.1.16041 disappeared: No such file or directory at mbox/06_label.t line 16 (in cleanup) yeep! can't read /tmp/mbox.2.16041 disappeared: No such file or directory at mbox/06_label.t line 24 (in cleanup) yeep! can't read /tmp/mbox.3.16041 disappeared: No such file or directory at mbox/06_label.t line 0 ok mbox/07_del...........defined(@array) is deprecated at ../blib/lib/Mail/Folder/Mbox.pm line 782. (Maybe you should just omit the defined()?) (in cleanup) yeep! can't read /tmp/mbox.2.16043 disappeared: No such file or directory at mbox/07_del.t line 0 ok mbox/08_sort..........defined(@array) is deprecated at ../blib/lib/Mail/Folder/Mbox.pm line 782. (Maybe you should just omit the defined()?) (in cleanup) yeep! can't read /tmp/mbox.1.16045 disappeared: No such file or directory at mbox/08_sort.t line 0 ok mbox/09_select........defined(@array) is deprecated at ../blib/lib/Mail/Folder/Mbox.pm line 782. (Maybe you should just omit the defined()?) (in cleanup) yeep! can't read /tmp/mbox.1.16047 disappeared: No such file or directory at mbox/09_select.t line 0 ok mbox/10_append........defined(@array) is deprecated at ../blib/lib/Mail/Folder/Mbox.pm line 782. (Maybe you should just omit the defined()?) (in cleanup) yeep! can't read /tmp/mbox.1.16049 disappeared: No such file or directory at mbox/10_append.t line 14 (in cleanup) yeep! can't read /tmp/mbox.2.16049 disappeared: No such file or directory at mbox/10_append.t line 0 ok mbox/11_pack..........defined(@array) is deprecated at ../blib/lib/Mail/Folder/Mbox.pm line 782. (Maybe you should just omit the defined()?) (in cleanup) yeep! can't read /tmp/mbox.1.16051 disappeared: No such file or directory at mbox/11_pack.t line 0 ok mbox/12_refile........defined(@array) is deprecated at ../blib/lib/Mail/Folder/Mbox.pm line 782. (Maybe you should just omit the defined()?) (in cleanup) yeep! can't read /tmp/mbox.1.16053 disappeared: No such file or directory at mbox/12_refile.t line 20 (in cleanup) yeep! can't read /tmp/mbox.2.16053 disappeared: No such file or directory at mbox/12_refile.t line 0 ok mbox/13_update........defined(@array) is deprecated at ../blib/lib/Mail/Folder/Mbox.pm line 782. (Maybe you should just omit the defined()?) (in cleanup) yeep! can't read /tmp/mbox.1.16055 disappeared: No such file or directory at mbox/13_update.t line 17 (in cleanup) yeep! can't read /tmp/mbox.2.16055 disappeared: No such file or directory at mbox/13_update.t line 0 ok maildir/01_maildir....defined(@array) is deprecated at ../blib/lib/Mail/Folder/Emaul.pm line 502. (Maybe you should just omit the defined()?) defined(@array) is deprecated at ../blib/lib/Mail/Folder/Mbox.pm line 782. (Maybe you should just omit the defined()?) ok maildir/02_empty......ok maildir/03_sync.......ok maildir/04_curr.......ok maildir/05_get........MIME::Parser=HASH(0x8573b5c) isn't a subclass of MIME::ParserBase at maildir/05_get.t line 26 dubious Test returned status 255 (wstat 65280, 0xff00) DIED. FAILED tests 15-24 Failed 10/24 tests, 58.33% okay maildir/06_label......ok maildir/07_del........ok maildir/08_sort.......ok maildir/09_select.....ok maildir/10_append.....ok maildir/11_pack.......ok maildir/12_refile.....FAILED tests 13-14 Failed 2/16 tests, 87.50% okay maildir/13_update.....Failed 4/39 test scripts, 89.74% okay. 37/570 subtests failed, 93.51% okay. ok Failed Test Stat Wstat Total Fail Failed List of Failed ------------------------------------------------------------------------------- emaul/05_get.t 255 65280 24 20 83.33% 15-24 maildir/05_get.t 255 65280 24 20 83.33% 15-24 maildir/12_refile.t 16 2 12.50% 13-14 mbox/05_get.t 255 65280 29 30 103.45% 15-29 make: *** [test] Error 255 /usr/bin/make test -- NOT OK Running make install make test had returned bad status, won't install without force From hjarce2001 at yahoo.com Thu Jul 22 03:50:12 2004 From: hjarce2001 at yahoo.com (Hugh Jarce) Date: Mon Aug 2 21:33:59 2004 Subject: [Omaha.pm] Mail::Folder missing person In-Reply-To: <001601c46f78$b2e88cc0$4722000a@omarests2> Message-ID: <20040722085012.19941.qmail@web90004.mail.scd.yahoo.com> Jay Hannah wrote: > It appears that Mail::Folder has been superceeded by Mail::Box, > which is active. Should probably port our gizmo to that some day. See also: AFAICT, this simpler Perl Email project was a reaction to the mind-boggling size and complexity of Mail::Box. Hugh __________________________________ Do you Yahoo!? Vote for the stars of Yahoo!'s next ad campaign! http://advision.webevents.yahoo.com/yahoo/votelifeengine/ From omaha-pm at jbisbee.com Thu Jul 22 07:55:15 2004 From: omaha-pm at jbisbee.com (Jeff Bisbee) Date: Mon Aug 2 21:33:59 2004 Subject: [Omaha.pm] Mail::Folder missing person In-Reply-To: <20040722085012.19941.qmail@web90004.mail.scd.yahoo.com> References: <001601c46f78$b2e88cc0$4722000a@omarests2> <20040722085012.19941.qmail@web90004.mail.scd.yahoo.com> Message-ID: <20040722125515.GB22858@jbisbee.com> * Hugh Jarce (hjarce2001@yahoo.com) wrote: > See also: > > Also http://pep.kwiki.org/ -- Jeff Bisbee / omaha-pm@jbisbee.com / jbisbee.com From jhannah at omnihotels.com Thu Jul 22 11:14:24 2004 From: jhannah at omnihotels.com (Jay Hannah) Date: Mon Aug 2 21:33:59 2004 Subject: [Omaha.pm] FW: Pod::Tree - .pm files w/ no POD? Message-ID: <001301c47006$f5487e20$4722000a@omarests2> Steven's response... j -----Original Message----- From: Steven W McDougall [mailto:swmcd@theworld.com] Sent: Thursday, July 22, 2004 7:29 AM To: jhannah@omnihotels.com Subject: Re: Pod::Tree - .pm files w/ no POD? > I just discovered pods2html. Very cool! Thank you :) > We have a lot of .pm files that do have POD, and even more .pm files that don't have POD. Unfortunately, the no POD .pm files do create an (empty) .html file, and are added to the index. People have complained about this before, and I've taken the position that pods2html correctly translates an empty POD file to an empty HTML file, and that I didn't want to special-case the code to suppress the HTML files. BUT...having empty HTML files show up in the index is obviously the Wrong Thing. > I noticed you're also the author of Pod::Tree, so I just thought I'd send this to you, wondering if you'd want a patch to Pod::Tree::has_pod() which would (optionally?) return false if the .pm file didn't actually have any POD in it...? Then I guess an option would have to be added to pods2html as well to pass that in? Some new options to the modues and executables to suppress empty HTML files is probably the simplest fix. I'll try to get a release out sometime in August. > (First I played with Pod::Tree::PerlPod, which seems to create the same phenomenon. I'm unclear about the differences between Pod::Tree::PerlPod and pods2html...) Modules Pod::Tree parses a POD into a syntax tree Pod::Tree::HTML walks a syntax tree and generates HTML Pod::Tree::Perl* converts the PODs in the Perl source distribution to HTML Executables pod2html calls Pod::Tree and Pod::Tree:HTML to convert a single POD file to an HTML file pods2html calls Pod::Tree and Pod::Tree:HTML to convert all the POD files in a directory tree to HTML files in a parallel directory tree perl2html calls Pod::Tree::Perl* to convert all the PODs in - the Perl source distribution - installed Perl modules - installed Perl executables to HTML files. An example of the resulting HTML tree can be seen at http://www.perldoc.com/ Let me know if you need more help with this. - SWM From jhannah at omnihotels.com Thu Jul 22 11:20:48 2004 From: jhannah at omnihotels.com (Jay Hannah) Date: Mon Aug 2 21:33:59 2004 Subject: [Omaha.pm] RE: Pod::Tree - .pm files w/ no POD? In-Reply-To: <200407221228.IAA1411409@shell.TheWorld.com> Message-ID: <001401c47007$da389600$4722000a@omarests2> > > We have a lot of .pm files that do have POD, and even more .pm files > that don't have POD. Unfortunately, the no POD .pm files do create > an (empty) .html file, and are added to the index. > > People have complained about this before, and I've taken the position > that pods2html correctly translates an empty POD file to an empty HTML > file, and that I didn't want to special-case the code to suppress the > HTML files. BUT...having empty HTML files show up in the index is > obviously the Wrong Thing. I understand the argument that empty.pod should always result in empty.html. It seems to me, though, that my module empty.pm may or may not have POD, and that the toolset should figure that out and Do The Right Thing. Yes/no? > Some new options to the modues and executables to suppress empty HTML > files is probably the simplest fix. I'll try to get a release out > sometime in August. You da man. -grin- Thanks for the overview! Take care, j From rps at willconsult.com Thu Jul 22 11:30:05 2004 From: rps at willconsult.com (Ryan Stille) Date: Mon Aug 2 21:33:59 2004 Subject: [Omaha.pm] July meeting? Message-ID: <9A8B75E3985324438F1BFA08B160E820215068@suxsvr.willconsult.com> Was there a meeting last week? I was wondering when the next Perl meeting was going to me, it seems like's been about a month? So I checked the website and it says there was a meeting last week! Are meeting notices not posted to the list? They are for the Omaha LUG and the Sioux City LUG. I find them very helpful. -Ryan From rps at willconsult.com Wed Jul 28 11:48:57 2004 From: rps at willconsult.com (Ryan Stille) Date: Mon Aug 2 21:33:59 2004 Subject: [Omaha.pm] simple syntax question Message-ID: <9A8B75E3985324438F1BFA08B160E82021507D@suxsvr.willconsult.com> I need to alter the value of some elements passed in from a form, using a regular expression. The only way I could think of to do it was like this: $tmp1 = $FORM->param('respond_email'); $tmp2 = $FORM->param('name'); $tmp1 =~ s/\n|\r//g; $tmp2 =~ s/\n|\r//g; $FORM->param(-name=>'respond_email',-value=>$tmp1); $FORM->param(-name=>'name', -value=>$tmp2); Which I'm sure is not the most elegant. Is there a way to do it without using the tmp variables? -Ryan From hjarce2001 at yahoo.com Wed Jul 28 21:36:57 2004 From: hjarce2001 at yahoo.com (Hugh Jarce) Date: Mon Aug 2 21:33:59 2004 Subject: [Omaha.pm] simple syntax question In-Reply-To: <9A8B75E3985324438F1BFA08B160E82021507D@suxsvr.willconsult.com> Message-ID: <20040729023657.56491.qmail@web90006.mail.scd.yahoo.com> Ryan Stille wrote: > I need to alter the value of some elements passed in from a form, using > a regular expression. The only way I could think of to do it was like > this: > > $tmp1 = $FORM->param('respond_email'); > $tmp2 = $FORM->param('name'); > $tmp1 =~ s/\n|\r//g; > $tmp2 =~ s/\n|\r//g; > $FORM->param(-name=>'respond_email',-value=>$tmp1); > $FORM->param(-name=>'name', -value=>$tmp2); > > Which I'm sure is not the most elegant. Is there a way to do it > without using the tmp variables? I don't see how to avoid the tmps because s/// changes its operand in place, while returning the number of substitutions made. (BTW, you could avoid the temporary with a function like substr(), because it returns the new value). I suppose you could hide the temporary in a function like this: sub remove_newlines { my $t = shift; $t =~ tr/\r\n//d; return $t; } allowing you to write code like this (untested): $FORM->param(-name => 'name', -value => remove_newlines( $FORM->param('name') ) ); BTW, tr/\r\n//d achieves the same result as s/\r|\n//g but is faster because there's no need to compile no damn regex. Hugh __________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage! http://promotions.yahoo.com/new_mail From jay at jays.net Sat Jul 31 09:55:03 2004 From: jay at jays.net (Jay Hannah) Date: Mon Aug 2 21:33:59 2004 Subject: [Omaha.pm] Date::Calc Message-ID: In the debugger after use Date::Calc qw( Today Add_Delta_YMD ); ----------- DB<3> x Today 0 2004 1 7 2 31 DB<4> x Add_Delta_YMD(Today, 0, -1, 0) 0 2004 1 7 2 1 ----------- That was not what I was expecting. I guess I was expecting 2004 6 30? j from perldoc Date::Calc --------------------------- o "($year,$month,$day) = Add_Delta_YMD($year,$month,$day, $Dy,$Dm,$Dd);" This function serves to add a years, months and days offset to a given date. (In order to add a weeks offset, simply multiply the weeks offset with ""7"" and add this number to your days offset.) Note that the three offsets for years, months and days are applied independently from each other. This also allows them to have different signs. The years and months offsets are applied first, and the days offset is applied last. If the resulting date happens to fall on a day after the end of the resulting month, like the 32nd of April or the 30th of February, then the date is simply counted forward into the next month (possibly also into the next year) by the number of excessive days (e.g., the 32nd of April will become the 2nd of May). BEWARE that this behaviour differs from that of previous versions of this module! In previous versions, the day was simply truncated to the maximum number of days in the resulting month. If you want the previous behaviour, use the new function ""Add_Delta_YM()"" (described immediately above) plus the function ""Add_Delta_Days()"" instead. BEWARE also that because a year and a month offset is not equivalent to a fixed number of days, the transfor- mation performed by this function is NOT ALWAYS REVERSIBLE! This is in contrast to the functions ""Add_Delta_Days()"" and ""Add_Delta_DHMS()"", which are fully and truly reversible (with the help of the func- tions ""Delta_Days()"" and ""Delta_DHMS()"", for instance). Note that for this same reason, @date = Add_Delta_YMD( Add_Delta_YMD(@date, $Dy,$Dm,$Dd), -$Dy,-$Dm,-$Dd); will in general NOT return the initial date ""@date"". Note that this is NOT a program bug but NECESSARILY so because of the variable lengths of years and months! ------------------ I guess I want Delta_YM instead? It's hard to report bugs when authors keep accurately documenting behaviors. -grin- j