Re: Untested modules update: There's more than we thought
Michael G Schwern <[EMAIL PROTECTED]> writes: > On Sun, Dec 16, 2001 at 02:41:31PM +, Piers Cawley wrote: >> > The equivalent code without isa_ok() would be: >> > >> > my $foo = Foo->new; >> > ok( $foo->isa('Foo') ); >> > >> > except should $foo be unblessed or undef that will explode. You have >> > to start doing things like: >> > >> > my $foo = Foo->new; >> > ok( defined $foo && $foo->isa('Foo') ); >> > >> > which rapidly gets tiresome. It also provides you little information >> > about what value $foo held that caused it to fail. >> >> What's wrong with >> >> ok ( eval { $foo->isa('Foo') } ); >> >> or even: >> >> ok (eval { ref($foo) && $foo->isa('Foo') }); > > As Kurt already pointed out, you can do: > > ok( UNIVERSAL::isa($foo, 'Foo') ); > > but if it fails you have no idea what $foo was. No you can't. Not if you've overridden isa anywhere. (Which is perfectly possible.) -- Piers "It is a truth universally acknowledged that a language in possession of a rich syntax must be in need of a rewrite." -- Jane Austen?
Re: Untested modules update: There's more than we thought
On Mon, Dec 17, 2001 at 08:12:43AM +, Piers Cawley wrote: > >> What's wrong with > >> > >> ok ( eval { $foo->isa('Foo') } ); > >> > >> or even: > >> > >> ok (eval { ref($foo) && $foo->isa('Foo') }); > > > > As Kurt already pointed out, you can do: > > > > ok( UNIVERSAL::isa($foo, 'Foo') ); > > > > but if it fails you have no idea what $foo was. > > No you can't. Not if you've overridden isa anywhere. (Which is > perfectly possible.) Ooooh, hadn't thought about that. I've done it myself a few times (to make a delegation look like inheritance). Now I have to go fix Test::More to deal with it. Ya know, I was literally just about to release 0.40 and I HAD to go read my email first. Either way, your above ok() solutions still give you no failure diagnostics, which is the whole point. -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One pleasing symmetry the paste goes in at one end comes out the other. -- mjd
Re: [ANNOUNCE] Test::Harness 2.00 release candiate 2
Op een mooie dag (Sun, 16 Dec 2001 15:30:17 -0500), besloot Michael G Schwern <[EMAIL PROTECTED]> de wereld om te draaien en schreef: > > Sorry, I did look into the failed tests, but I don't understand the > > Test::Harness::Straps::analyze_file() logic. MSWin32 doesn't support the open() > > constructs with '-|' and '|-'. > > Those should be gone in 2.00_04. Are you sure you grabbed the right > version? What $VERSION is Test::Harness::Straps? Doh, my bad, I had 2.00_01 hanging around on my system. Works ok on both my regular ActivePerl 5.6.1 (build 628) and freshly compiled bleadperl Sorry! -- Good luck, Abe Amsterdam Perl Mongers http://amsterdam.pm.org perl -Mstrict -wle 'sub Just{&$_}sub another{&$_}sub Perl{&$_}sub hacker{&$_}$_=sub{(split /::/,(caller $^W)[3])[-$^W].$"};print Just, another, Perl, hacker;'
HELP: mod_perl and Apache::Cookie
given the following setup: Embedded Perl version v5.6.1 for Apache/1.3.22 (Unix) mod_python/2.7.6 Python/2.1.1 PHP/4.0.6 mod_perl/1.26 process 8458, uname -a FreeBSD xxx.com 4.4-RELEASE FreeBSD 4.4-RELEASE #1: Thu Dec 13 08:25:04 EST 2001 [EMAIL PROTECTED]:/usr/src/sys/compile/PHILIP i386 Someone Please Tell me what I am missing with Apache::Cookie because the folling script works fine if I: replace Apache::Cookie->new($r, with &cookie() from CGI Error log Messages: [Sun Dec 16 16:36:57 2001] [error] Died at /usr/home/src/perl/lib/site_perl/5.6.1/Apache/Session/Generate/MD5.pm line 40. Which Is sub validate { #This routine checks to ensure that the session ID is in the form #we expect. This must be called before we start diddling around #in the database or the disk. my $session = shift; if ($session->{data}->{_session_id} !~ /^[a-fA-F0-9]+$/) { die;### LINE 40# } } Now the Following Script assume its in the right place for Apache::Registry handler. #!/usr/local/bin/perl -w use strict; use diagnostics; use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser carpout); # Send Error Messages to Browswer use Apache; use Apache::Cookie; use Apache::Session::MySQL; &main(); sub main() { my $r = Apache->request; my %params = $r->method eq 'POST' ? $r->content : $r->args; my %session = undef; my $cookie = undef; my $valid = undef; my $sid = undef; $sid = Apache::Cookie->new($r, -name=>"SID03"); tie %session, 'Apache::Session::MySQL', $sid, { DataSource => 'dbi:mysql:sessions', #these arguments are UserName => '', #required when using Password => '', #MySQL.pm LockDataSource => 'dbi:mysql:sessions', LockUserName => '', LockPassword => '' }; if ($sid == undef) { $cookie = Apache::Cookie->new($r, -name=>'SID03', -value=>$session{_session_id}, -expires=>'+10m', -path=>"/perl-reg/Admin"); }; $sid = $session{_session_id}; $cookie->bake; $r->internal_redirect_handler("/perl-reg/Admin/main.cgi"); return; } -- Philip M. Gollucci (p6m7g8) [EMAIL PROTECTED] 301.314.3118 Science, Discovery, & the Universe (UMCP) Webmaster & Webship Teacher URL: http://www.sdu.umd.edu EJPress.com Database/PERL Programmer & System Admin URL : http://www.ejournalpress.com Resume : http://www.p6m7g8.com/resume.txt
Re: HELP: mod_perl and Apache::Cookie
On Sun, Dec 16, 2001 at 04:38:44PM -0500, Philip M. Gollucci wrote: > given the following setup: > Embedded Perl version v5.6.1 for Apache/1.3.22 (Unix) mod_python/2.7.6 > Python/2.1.1 PHP/4.0.6 mod_perl/1.26 process 8458, > > uname -a > FreeBSD xxx.com 4.4-RELEASE FreeBSD 4.4-RELEASE #1: Thu Dec > 13 08:25:04 EST 2001 > [EMAIL PROTECTED]:/usr/src/sys/compile/PHILIP i386 > > Someone Please Tell me what I am missing with Apache::Cookie > > because the folling script works fine if I: > replace Apache::Cookie->new($r, with &cookie() from CGI I think you may have strayed onto the wrong mailing list. This is the list for discussing Perl's QA infrastructure. Figuring out why mod_perl is spitting on you would better be done on one of the mod_perl mailing lists here: http://perl.apache.org/#maillists If anyone one on perl-qa wants to help out, just make sure you don't CC the list. -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One There is nothing wrong. We have taken control of this sig file. We will return it to you as soon as you are groovy.
Re: Untested modules update: There's more than we thought
Hallo Michael, Am 2001-12-16 um 21:20 schriebst du: > On Sun, Dec 16, 2001 at 11:09:29AM -0700, chromatic wrote: >> + like( $$out, qr/could not locate your pod2man/, >> + '... should warn if pod2man cannot be located' ); > Gerrit, do you already have a perl installed in the spot you're about > to put this new one? If so, it might be seeing that pod2man. I have 5.6.1 installed in /usr and pod2man in /usr/bin. Hmm, up to now there never was an influence on building bleadperl (I guess), after I renamed /bin/pod2man it works now without error, but ... Gerrit -- =^..^=mailto:[EMAIL PROTECTED]
Re: Untested modules update: There's more than we thought
Hallo chromatic, Am 2001-12-16 um 19:09 schriebst du: > On Sunday 16 December 2001 02:10, Gerrit P. Haase wrote: > Thanks for the report. >> ../lib/ExtUtils/MM_Cygwin.# Failed test >> (../lib/ExtUtils/MM_Cygwin.t at line 73) # undef >> # doesn't match '(?-xism:could not locate your pod2man)' >> # Failed test (../lib/ExtUtils/MM_Cygwin.t at line 75) >> # 'POD2MAN_EXE = /usr/bin/pod2man >> # POD2MAN = $(PERL) -we '%m=@ARGV;for (keys %m){' \ >> # -e 'next if -e $$m{$$_} && -M $$m{$$_} < -M $$_ && -M $$m{$$_} < -M >> "";' \ # -e 'print "Manifying $$m{$$_}\n"; $$m{$$_} =~ s/::/./g;' \ >> # -e 'system(qq[$$^X ].q["-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" >> $(POD2MAN_EXE) ].qq[$$_>$$m{$$_}])==0 or warn "Couldn\047t install >> $$m{$$_}\n";' \ # -e 'chmod(oct($(PERM_RW))), $$m{$$_} or warn "chmod >> $(PERM_RW) $$m{$$_}: $$!\n";}' # >> manifypods : pure_all foo >> # noecho$(POD2MAN) \ >> # foo \ >> # 1' >> # doesn't match '(?-xism:POD2MAN_EXE = -S pod2man)' >> # Looks like you failed 2 tests of 17. > What happens if you apply this patch and run it? It seems to me it'll > generate a more reliable failure, which is what the test is supposed to catch. > -- c > --- lib/ExtUtils/~MM_Cygwin.t Sun Dec 16 11:02:04 2001 > +++ lib/ExtUtils/MM_Cygwin.tSun Dec 16 11:07:31 2001 > @@ -70,11 +70,16 @@ > $args->{MAN3PODS} = { foo => 1 }; > my $out = tie *STDOUT, 'FakeOut'; > my $res = $args->manifypods(); > -like( $$out, qr/could not locate your pod2man/, > - '... should warn if pod2man cannot be located' ); > -like( $res, qr/POD2MAN_EXE = -S pod2man/, > - '... should use default pod2man target' ); > -like( $res, qr/pure_all.+foo/, '... should add MAN3PODS targets' ); > + > +{ > + # try to trip warning on line 53 > + local *MM::perl_script = sub { return }; > + like( $$out, qr/could not locate your pod2man/, > + '... should warn if pod2man cannot be located' ); > + like( $res, qr/POD2MAN_EXE = -S pod2man/, > + '... should use default pod2man target' ); > + like( $res, qr/pure_all.+foo/, '... should add MAN3PODS targets' ); > +} > $args->{PERL_SRC} = File::Spec->updir; > $args->{MAN1PODS} = { bar => 1 }; .../lib/ExtUtils/MM_Cygwin.ok 9/17# Failed test (../lib/ExtUtils/MM_Cygwin.t at line 73) # undef # doesn't match '(?-xism:could not locate your pod2man)' # Failed test (../lib/ExtUtils/MM_Cygwin.t at line 75) # 'POD2MAN_EXE = /usr/bin/pod2man # POD2MAN = $(PERL) -we '%m=@ARGV;for (keys %m){' \ # -e 'next if -e $$m{$$_} && -M $$m{$$_} < -M $$_ && -M $$m{$$_} < -M "";' \ # -e 'print "Manifying $$m{$$_}\n"; $$m{$$_} =~ s/::/./g;' \ # -e 'system(qq[$$^X ].q["-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" $(POD2MAN_EXE) ].qq[$$_>$$m{$$_}])==0 or warn "Couldn\047t install $$m{$$_}\n";' \ # -e 'chmod(oct($(PERM_RW))), $$m{$$_} or warn "chmod $(PERM_RW) $$m{$$_}: $$!\n";}' # manifypods : pure_all foo # noecho$(POD2MAN) \ # foo \ # 1' # doesn't match '(?-xism:POD2MAN_EXE = -S pod2man)' # Looks like you failed 2 tests of 17. .../lib/ExtUtils/MM_Cygwin.dubious Test returned status 2 (wstat 512, 0x200) DIED. FAILED tests 10-11 Failed 2/17 tests, 88.24% okay -- =^..^=mailto:[EMAIL PROTECTED]
[ANNOUNCE] Test::Simple/More/Builder/Tutorial 0.40
Big release here, folks. Lots of new stuff, knocked off a good chunk of the TODO list. http://www.pobox.com/~schwern/src/Test-Simple-0.40.tar.gz 0.40 Fri Dec 14 15:41:39 EST 2001 * isa_ok() now accepts unblessed references gracefully - Nick Clark found a bug with like() and a regex with % in it. - exit.t was hanging on 5.005_03 VMS perl. Test now skipped. - can_ok() would pass if no methods were given. Now fails. - isnt() diagnostic output format changed * Added some docs about embedding and extending Test::More * Added Test::More->builder * Added cmp_ok() * Added todo_skip() * Added unlike() - Piers pointed out that sometimes people override isa(). isa_ok() now accounts for that. Here's the juicy bits: isa_ok() Handles unblessed refs now -> isa_ok([], 'ARRAY'); Better diagnostics. not ok 1 - The object isa Bar # Failed test (-e at line 1) # The object isn't a 'Bar' its a 'Foo' cmp_ok() The is_op() thing I was talking about. Nick, no more need to lie awake at night worrying about testing numbers with is(). cmp_ok($some_horrendous_number, '==', $another_massive_number); # Failed test (-e at line 1) # got: 2420983.14598 # expected: 2420983.145981 In the == case the diagnostics force numeric context, so you can safely do things like: cmp_ok($!, '==', 5); # Failed test (-e at line 1) # got: 2 # expected: 5 cmp_ok($!, 'eq', "No such file or martian"); # Failed test (-e at line 1) # got: 'No such file or directory' # expected: 'No such file or martian' but it means you also get: cmp_ok("foo", '==', 5); # Failed test (-e at line 1) # got: 0 # expected: 5 which I think is the Right Thing. Thoughts? I've gone through some pains to make the diagnostic output come out just right, but I still think it looks a little ugly in the non 'eq' and '==' cases. cmp_ok(0, "&&", "foo")' # Failed test (-e at line 1) # '0' # && # 'foo' Let me know what you think. Test::More->builder Used to be to get access to the Test::Builder object underlying Test::Builder you'd just call Test::Builder->new. In order to cover my ass in case I discover that's a bad idea, Test::More->builder is now the official way to get at the underlying object. Though I just realized I left a bunch of Test::Builder->new calls in the tests. unlike() Opposite of like() todo_skip() Combines a todo test with skip's ability to jump whole blocks. Useful for when a todo test can't be run at all because it will die or otherwise cause havoc. Doesn't come up all that often, but I found myself needing it a few times in the core tests. -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One GOD made us funky!
Re: Untested modules update: There's more than we thought
Michael G Schwern <[EMAIL PROTECTED]> writes: > On Mon, Dec 17, 2001 at 08:12:43AM +, Piers Cawley wrote: >> >> What's wrong with >> >> >> >> ok ( eval { $foo->isa('Foo') } ); >> >> >> >> or even: >> >> >> >> ok (eval { ref($foo) && $foo->isa('Foo') }); >> > >> > As Kurt already pointed out, you can do: >> > >> > ok( UNIVERSAL::isa($foo, 'Foo') ); >> > >> > but if it fails you have no idea what $foo was. >> >> No you can't. Not if you've overridden isa anywhere. (Which is >> perfectly possible.) > > Ooooh, hadn't thought about that. I've done it myself a few times (to > make a delegation look like inheritance). Now I have to go fix > Test::More to deal with it. Ya know, I was literally just about to > release 0.40 and I HAD to go read my email first. > > Either way, your above ok() solutions still give you no failure > diagnostics, which is the whole point. Well, yes. At least the point about overridden isa didn't get lost... -- Piers "It is a truth universally acknowledged that a language in possession of a rich syntax must be in need of a rewrite." -- Jane Austen?
RE: [ANNOUNCE] Test::Simple/More/Builder/Tutorial 0.40
-BEGIN PGP SIGNED MESSAGE- Moin, On 17-Dec-01 Michael G Schwern tried to scribble about: > Big release here, folks. Lots of new stuff, knocked off a good chunk > of the TODO list. > http://www.pobox.com/~schwern/src/Test-Simple-0.40.tar.gz > > 0.40 Fri Dec 14 15:41:39 EST 2001 What about the problem that can_ok() doesn't increase the testcount number by the number of methods, but only by one? Contradicts the doc (and the changelog seems to contradict v0.17, since in v.017 it did increase by 1, too), also makes it hard to see whether can_ok() really does some looping or simple prints "ok $test\n"; Please make can_ok() increase the testcount by the number of methods. Thanx in advance! Tels - -- perl -MDev::Bollocks -e'print Dev::Bollocks->rand(),"\n"' heterogeneously establish 24/7 methodologies http://bloodgate.com/perl My current Perl projects PGP key available on http://bloodgate.com/tels.asc or via email -BEGIN PGP SIGNATURE- Version: 2.6.3i Charset: latin1 iQEVAwUBPB3Mg3cLPEOTuEwVAQFRxwf8D6ZiBToj2WrXDDgdsXNzrrMELnzEwsOf Ru3XsTD6w6d7g3DnjIWfLzP6/+OSUZ07CKbZx+Sr6FZwyKgYjzrJNgoAUDz8Ajfv 0HUgTEZjSnzc/DyXiUlMJIpmVOi6RMLKf15Qf2w3la1O8xoaYkDy96sc+YmAHUIc XNXyBmkH8eqy2Sh3WOBobljsNmiA505Jl3LzFgNIFMelyMkzkJSWIUnxSr/Ti9S3 eRV4R7katGrZL/TKrqI2kiN3MZFi3dpgTmBKE3iwscTFeJNaopWTgexT/oav2gcw gQaOfKwxB9aERzmxZuXxINCH67Y69vK0nzUhLmk3073DgjRVy4vBjg== =VnZr -END PGP SIGNATURE-
ANNOUNCE Pod::Coverage 0.09
The URL http://unixbeard.net/~richardc/lab/Pod-Coverage/Pod-Coverage-0.09.tar.gz has entered CPAN as file: $CPAN/authors/id/R/RC/RCLAMP/Pod-Coverage-0.09.tar.gz size: 9823 bytes md5: 0044c9f6fc7c913cad526c451f33be07 Changes since the last installment: Fixed a typo in mstevens' name (oopsie) Added C based on an email exchange. Modified the import form so that if given one argument it's assumed to be the package. From a suggestion by Mark Fowler. Changed tracing to use optimisable constants. Added why_unrated. Coming soon: The itch to allow documentation in a parent class to be counted in the coverage of the child has started to tingle (aka as making Pod::Coverage grok inheritance), so that'll be the main target of the next bunch of stuff. -- Richard Clamp <[EMAIL PROTECTED]>
Re: Untested modules update: There's more than we thought
"Kurt D. Starsinic" <[EMAIL PROTECTED]> writes: > On Dec 15, Dave Rolsky wrote: >> Ok, so that's a bit off the topic of "why use isa_ok()" but I just don't >> see why people seem to object to the use of Test::More in the core Perl >> tests. I can't see how it couldn't help improve the quality of the tests >> while providing a standardized way to do the things that all the tests do >> anyway. > > I, for one, don't object to the use of Test::More in the core Perl > tests. I'm just being responsibly skeptical about the promotion of many > different test harness modules with many different functions. It runs > the risk of _seeming_ like the People in Charge don't know what testing > is for, and of not providing effective guidance to those people writing > their first tests. > > I also think that we have a real testing problem, which is that it > isn't _trivially_ easy to run a huge test suite (like Alzabo's, or Perl's) > and to find out at the end which tests failed and what their output was. > 3000 lines and 20 minutes later, a message that 3 out of 1 tests > failed is not maximally useful. Greater variety of test functions is not > (IMNSHO) nearly as important as addressing that. This is one of the things that the PerlUnit test framework does reasonably well, but I definitely wouldn't recommend it for the perl test suite as it does some vaguely hairy stuff with OO and is definitely designed for testing rather higher level constructs than perl ops etc. Note to self. Polish the docs for PerlUnit and make a new release already. -- Piers "It is a truth universally acknowledged that a language in possession of a rich syntax must be in need of a rewrite." -- Jane Austen?
Re: [ANNOUNCE] Test::Simple/More/Builder/Tutorial 0.40
On Mon, Dec 17, 2001 at 11:48:34AM +0100, Tels wrote: > What about the problem that can_ok() doesn't increase the testcount number > by the number of methods, but only by one? Like I said, I tried it that way, didn't like it and changed the behavior. Found myself having trouble keeping track of the test count as @methods changed size. The docs are now explicit about can_ok counting as a single test. They also offer an alternative if you want the multiple increment behavior: No matter how many @methods you check, a single can_ok() call counts as one test. If you desire otherwise, use: foreach my $meth (@methods) { can_ok('Foo', $meth); } That'll fail even if @methods is empty, the test count will be wrong. > Contradicts the doc (and the changelog seems to contradict v0.17, since in > v.017 it did increase by 1, too), also makes it hard to see whether can_ok() > really does some looping or simple prints "ok $test\n"; The bug with can_ok() succeeding with no @methods has been fixed. Trust your test library. Or at least trust that things will be fixed rapidly. :) > Please make can_ok() increase the testcount by the number of methods. Couldn't now even if I wanted to. Been around too long, would break too many tests. -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One Stupid am I? Stupid like a fox!
[ANNOUNCE] Test 1.19 license change and mod_perl bug fixes
Stas Bekman found a problem with the globals in Test.pm when run under mod_perl (ie. persistently). Test::More probably has the same problem. Also, the license has been changed from Artistic-only to same as Perl. http://www.pobox.com/~schwern/src/Test-1.19.tar.gz 2001-12-17 Michael G Schwern <[EMAIL PROTECTED]> * Release 1.19 - Resetting globals for mod_perl testing (thanks to Stas Bekman) - License change to be same as perl's -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One I'm spanking my yacht.
[ANNOUNCE] Test::Harness 2.00_05 (RC 3)
http://www.pobox.com/~schwern/src/Test-Harness-2.00_05.tar.gz Things look nice. This release contains only minor fixes, except on VMS where _04 exploded nicely. Should be 100% now, let me know otherwise. I'm trying to get rid of that extra newline in the output. t/00compile ok Its now safe to put -T on your tests in VMS. 2.00_05 Mon Dec 17 22:08:02 EST 2001 * Wasn't filtering @INC properly when a test is run with -T, caused the command line to be too long on VMS. VMS should be 100% now. - Little bug in the skip 'various reasons' logic. - Minor POD nit in 5.004_04 - Little speling mistak -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One Hold on while I slip into something a little more naked.