Re: Untested modules update: There's more than we thought

2001-12-17 Thread Michael G Schwern

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



HELP: mod_perl and Apache::Cookie

2001-12-17 Thread Philip M. Gollucci

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: [ANNOUNCE] Test::Harness 2.00 release candiate 2

2001-12-17 Thread Abe Timmerman

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;'



Re: HELP: mod_perl and Apache::Cookie

2001-12-17 Thread Michael G Schwern

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
snip

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

2001-12-17 Thread Gerrit P. Haase

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]




[ANNOUNCE] Test::Simple/More/Builder/Tutorial 0.40

2001-12-17 Thread Michael G Schwern

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

2001-12-17 Thread Piers Cawley

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

2001-12-17 Thread Tels

-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

2001-12-17 Thread Richard Clamp

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 Cexamples/script-covered 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: [ANNOUNCE] Test::Simple/More/Builder/Tutorial 0.40

2001-12-17 Thread Michael G Schwern

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

2001-12-17 Thread Michael G Schwern

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)

2001-12-17 Thread Michael G Schwern

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.