From grand-rapids-pm-list at pm.org Fri May 1 11:56:39 2009 From: grand-rapids-pm-list at pm.org (grand-rapids-pm-list at pm.org) Date: Fri, 1 May 2009 14:56:39 -0400 Subject: [grand-rapids-pm-list] Perl Date Validator Test Chokes! Message-ID: Today I noticed a test failing in a piece of old code that tests a date validator. After some quick debugging, I found the problem. Can you find what is wrong with the second test below? (Btw, you can't actually run the code below, as I'm only including the tests from the pod.) Hint: It worked yesterday! How would you fix it? I'll share my solution a bit later. use Test::Exception; # TEST 1 valid date, in the future $q->param("${field}", '01/01/3005'); lives_ok { %ret = $date_v->validate; } 'Valid date validated'; isnt($ret{'valid'}, 1, '> 6 months ago date validated correctly'); like($ret{'error'}, qr/\w+/, 'Correct error message returned.'); # TEST 2 valid date my @time = localtime(time - 86400); # yesterday my $date = sprintf('%02d/%02d/%04d', $time[4] + 1, $time[3] + 1, $time[5] + 1900); diag("Date: $date"); $q->param("${field}", $date); lives_ok { %ret = $date_v->validate; } 'Valid date validated'; is($ret{'valid'}, 1, 'Valid date validated correctly'); Ed Eddington Gr.pm ** ** ** PRIVILEGED AND CONFIDENTIAL ** ** ** This email transmission contains privileged and confidential information intended only for the use of the individual(s) or entity named above. Any unauthorized review, use, disclosure or distribution is prohibited and may be a violation of law. If you are not the intended recipient or a person responsible for delivering this message to an intended recipient, please delete the email and immediately notify the sender via the email return address or mailto:postmaster at priorityhealth.com. Thank you. From grand-rapids-pm-list at pm.org Fri May 1 17:24:08 2009 From: grand-rapids-pm-list at pm.org (grand-rapids-pm-list at pm.org) Date: Fri, 1 May 2009 20:24:08 -0400 Subject: [grand-rapids-pm-list] Perl Date Validator Test Chokes! In-Reply-To: References: Message-ID: <000001c9cabc$50027310$f0075930$@com> Looks like it never really worked right. It may have passed the test but the date would have been today's date except on the first day of the month when it would have been one day more than the possible number of days in the last month 12/32/2008 if run on 1/1/2009. The localtime function is a little confusing because some things are zero based (like the month) and some things not (the day of the month) does anyone know of any other functions that do things like this? Does anyone know or have a guess why they did this? Looks like things that are always numbers do not need conversion and things that would be converted to names like days and months start at zero. So did it work yesterday or just not fail? To fix it I would take out '+ 1' after '$time[3]' in the 12th line. Is Perl Mongers meeting in May? -----Original Message----- From: grand-rapids-pm-list-bounces+dave=hopasaurus.com at pm.org [mailto:grand-rapids-pm-list-bounces+dave=hopasaurus.com at pm.org] On Behalf Of grand-rapids-pm-list at pm.org Sent: Friday, May 01, 2009 2:57 PM To: grand-rapids-pm-list at pm.org Subject: [grand-rapids-pm-list] Perl Date Validator Test Chokes! Today I noticed a test failing in a piece of old code that tests a date validator. After some quick debugging, I found the problem. Can you find what is wrong with the second test below? (Btw, you can't actually run the code below, as I'm only including the tests from the pod.) Hint: It worked yesterday! How would you fix it? I'll share my solution a bit later. use Test::Exception; # TEST 1 valid date, in the future $q->param("${field}", '01/01/3005'); lives_ok { %ret = $date_v->validate; } 'Valid date validated'; isnt($ret{'valid'}, 1, '> 6 months ago date validated correctly'); like($ret{'error'}, qr/\w+/, 'Correct error message returned.'); # TEST 2 valid date my @time = localtime(time - 86400); # yesterday my $date = sprintf('%02d/%02d/%04d', $time[4] + 1, $time[3] + 1, $time[5] + 1900); diag("Date: $date"); $q->param("${field}", $date); lives_ok { %ret = $date_v->validate; } 'Valid date validated'; is($ret{'valid'}, 1, 'Valid date validated correctly'); Ed Eddington Gr.pm ** ** ** PRIVILEGED AND CONFIDENTIAL ** ** ** This email transmission contains privileged and confidential information intended only for the use of the individual(s) or entity named above. Any unauthorized review, use, disclosure or distribution is prohibited and may be a violation of law. If you are not the intended recipient or a person responsible for delivering this message to an intended recipient, please delete the email and immediately notify the sender via the email return address or mailto:postmaster at priorityhealth.com. Thank you. _______________________________________________ grand-rapids-pm-list mailing list grand-rapids-pm-list at pm.org http://mail.pm.org/mailman/listinfo/grand-rapids-pm-list From grand-rapids-pm-list at pm.org Mon May 4 06:21:59 2009 From: grand-rapids-pm-list at pm.org (grand-rapids-pm-list at pm.org) Date: Mon, 4 May 2009 09:21:59 -0400 Subject: [grand-rapids-pm-list] Perl Date Validator Test Chokes! In-Reply-To: <000001c9cabc$50027310$f0075930$@com> References: <000001c9cabc$50027310$f0075930$@com> Message-ID: <2b5f94b80905040621p718af2e5k8a24dcc809ee9413@mail.gmail.com> Exactly. The main problem is the "day of the month" ($mday) element of localtime begins with "1 not "0" and does not need to be incremented. # 0 1 2 3 4 5 6 7 8 ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime (time ); It does seem pretty arbitrary, since even the "day of the year" ($yday) element begins with "0" and goes through "364". Not sure the history behind it - there may be a good story there. The second problem with that test was that it was just plain confusing. Not sure if the intent was to test yesterday's date or today's. But, you cannot get today by incrementing yesterday (at least not in that manner). So, I fixed the test by doing as you suggested, plus I began testing today's date instead. Ed Eddington On Fri, May 1, 2009 at 8:24 PM, wrote: > Looks like it never really worked right. It may have passed the test but > the > date would have been today's date except on the first day of the month when > it would have been one day more than the possible number of days in the > last > month 12/32/2008 if run on 1/1/2009. The localtime function is a little > confusing because some things are zero based (like the month) and some > things not (the day of the month) does anyone know of any other functions > that do things like this? Does anyone know or have a guess why they did > this? Looks like things that are always numbers do not need conversion and > things that would be converted to names like days and months start at zero. > > So did it work yesterday or just not fail? > > To fix it I would take out '+ 1' after '$time[3]' in the 12th line. > > > > Is Perl Mongers meeting in May? > > > > -----Original Message----- > From: grand-rapids-pm-list-bounces+dave=hopasaurus.com at pm.org > [mailto:grand-rapids-pm-list-bounces+dave > =hopasaurus.com at pm.org] On Behalf > Of grand-rapids-pm-list at pm.org > Sent: Friday, May 01, 2009 2:57 PM > To: grand-rapids-pm-list at pm.org > Subject: [grand-rapids-pm-list] Perl Date Validator Test Chokes! > > Today I noticed a test failing in a piece of old code that tests a date > validator. After some quick debugging, I found the problem. Can you find > what is wrong with the second test below? (Btw, you can't actually run the > code below, as I'm only including the tests from the pod.) Hint: It worked > yesterday! How would you fix it? I'll share my solution a bit later. > > use Test::Exception; > > # TEST 1 valid date, in the future > $q->param("${field}", '01/01/3005'); > lives_ok { > %ret = $date_v->validate; > } 'Valid date validated'; > isnt($ret{'valid'}, 1, '> 6 months ago date validated correctly'); > like($ret{'error'}, qr/\w+/, 'Correct error message returned.'); > > # TEST 2 valid date > my @time = localtime(time - 86400); # yesterday > my $date = sprintf('%02d/%02d/%04d', $time[4] + 1, $time[3] + 1, > $time[5] + 1900); > diag("Date: $date"); > $q->param("${field}", $date); > lives_ok { > %ret = $date_v->validate; > } 'Valid date validated'; > is($ret{'valid'}, 1, 'Valid date validated correctly'); > > > > Ed Eddington > Gr.pm > > ** ** ** PRIVILEGED AND CONFIDENTIAL ** ** ** > This email transmission contains privileged and confidential information > intended only for the use of the individual(s) or entity named above. Any > unauthorized review, use, disclosure or distribution is prohibited and may > be a violation of law. If you are not the intended recipient or a person > responsible for delivering this message to an intended recipient, please > delete the email and immediately notify the sender via the email return > address or mailto:postmaster at priorityhealth.com. Thank you. > > > _______________________________________________ > grand-rapids-pm-list mailing list > grand-rapids-pm-list at pm.org > http://mail.pm.org/mailman/listinfo/grand-rapids-pm-list > > _______________________________________________ > grand-rapids-pm-list mailing list > grand-rapids-pm-list at pm.org > http://mail.pm.org/mailman/listinfo/grand-rapids-pm-list > -------------- next part -------------- An HTML attachment was scrubbed... URL: From grand-rapids-pm-list at pm.org Mon May 4 14:10:22 2009 From: grand-rapids-pm-list at pm.org (grand-rapids-pm-list at pm.org) Date: Mon, 04 May 2009 17:10:22 -0400 Subject: [grand-rapids-pm-list] Perl Date Validator Test Chokes! In-Reply-To: <2b5f94b80905040621p718af2e5k8a24dcc809ee9413@mail.gmail.com> References: <000001c9cabc$50027310$f0075930$@com> <2b5f94b80905040621p718af2e5k8a24dcc809ee9413@mail.gmail.com> Message-ID: <49FF59BE.2020606@gmail.com> Just use strftime(). From grand-rapids-pm-list at pm.org Tue May 26 07:59:03 2009 From: grand-rapids-pm-list at pm.org (grand-rapids-pm-list at pm.org) Date: Tue, 26 May 2009 10:59:03 -0400 Subject: [grand-rapids-pm-list] Fwd: Adding Perl support for Google App Engine In-Reply-To: Message-ID: Read below if you are interested in having Google App Engine add support for Perl. Ed Eddington ------ Forwarded Message From: breno Date: Fri, 22 May 2009 13:29:56 -0400 To: Fred Moyer Cc: Subject: Re: [pm_groups] Fwd: Adding Perl support for Google App Engine Also, it is worth noticing (like one of the first notes on the list) that there is *no need* to add comments such as "+1" or "please add perl support". Clicking on the star on the upper left is enough, and message sending should probably be used only to update the status of the issue or giving actually helpful information, since every single message is sent to everyone that already starred it (when this started, we actually *lost* a few people that "un-starred" it because they were annoyed with too much useless messages). Cheers, garu On Fri, May 22, 2009 at 1:26 PM, Fred Moyer wrote: > Another quick note - you have to be logged in with a Google account. > Not a Gmail account, not a Google Apps account, but a regular Google > account (there were three different types last time I checked... go > figure... Google are you listening?). > > The list is here - click 'Sign In' on the upper right. If it seems > like I'm putting a lot of effort out there to make this simple - I am > :) Got about half a dozen off list replies asking how the heck do you > login and vote on this thing. > > http://code.google.com/p/googleappengine/issues/list > > On Fri, May 22, 2009 at 7:53 AM, Jay Hannah wrote: >> Feel free to distribute to your groups if you like. Thanks, >> >> j >> >> >> Begin forwarded message: >>> >>> From: Garrett Goebel >>> Date: May 22, 2009 8:20:25 AM CDT >>> To: kc at pm.org >>> >>> Votes for supporting Perl is in 3rd place behind PHP and Ruby in Google >>> App Engine's "Open List" of issues. Perl is less than 300 votes behind Ruby. >>> If you'd like to help change that... vote and spread the word... >>> >>> See: >>> http://ergoletterbag.blogspot.com/2009/05/adding-perl-support-to-google-app.html >> >> -- >> Request pm.org Technical Support via support at pm.org >> >> pm_groups mailing list >> pm_groups at pm.org >> http://mail.pm.org/mailman/listinfo/pm_groups >> > -- > Request pm.org Technical Support via support at pm.org > > pm_groups mailing list > pm_groups at pm.org > http://mail.pm.org/mailman/listinfo/pm_groups > -- Request pm.org Technical Support via support at pm.org pm_groups mailing list pm_groups at pm.org http://mail.pm.org/mailman/listinfo/pm_groups ------ End of Forwarded Message ** ** ** PRIVILEGED AND CONFIDENTIAL ** ** ** This email transmission contains privileged and confidential information intended only for the use of the individual(s) or entity named above. Any unauthorized review, use, disclosure or distribution is prohibited and may be a violation of law. If you are not the intended recipient or a person responsible for delivering this message to an intended recipient, please delete the email and immediately notify the sender via the email return address or mailto:postmaster at priorityhealth.com. Thank you. From grand-rapids-pm-list at pm.org Tue May 26 08:07:55 2009 From: grand-rapids-pm-list at pm.org (grand-rapids-pm-list at pm.org) Date: Tue, 26 May 2009 08:07:55 -0700 Subject: [grand-rapids-pm-list] Tester Roundtable: June 4th, ThornApple Grill, Ada Message-ID: <61dd97c0905260807w557c4028m17ac89e5055c7fe0@mail.gmail.com> The Next Grand Rapids Testers Roundtable will be 5:30PM Thursday, June 4th at the Thorn Apple Grill in Ada: http://www.thegilmorecollection.com/thornappledailygrill.html Current plans include a lightning talk on exploratory testing, dinner off the menu, and a discussion on implementing a quality program at a large mid-west retail organization. Format events won't start until at least 5:45. Please feel free to email Matthew Heusser (matt.heusser at gmail.com) for more details or an invitation. regards, -- Matthew Heusser, Testing Blog: http://xndev.blogspot.com SW Craft Blog: http://craftingsw.blogspot.com/ Twitter: http://www.twitter.com/mheusser In our world, there is no rank, only merit. Merit is contingent. - James Bach -------------- next part -------------- An HTML attachment was scrubbed... URL: