Re: use_ok w/version numbers

2002-07-01 Thread Rafael Garcia-Suarez

Andy Lester wrote in perl-qa :
> I can do this:
> 
> use PHP::Session 0.10;
> 
> to ensure a version number, but I can't do this:
> 
> use_ok( 'PHP::Session', '0.10' );

The optional args to use_ok are for imports, not for version numbers.

[...]
> Before I go digging into a patch, is this something that we even want to
> allow?  I know I'd like to allow it, because I'd like to have one .t
> file that ensures that I have proper module prereqs for my entire source
> tree.

You can do :

use_ok("PHP::Session");
ok(PHP::Session->VERSION(0.10),'PHP::Session version >= 0.10 loaded');

or much cleaner, wrap the call to VERSION in an eval {} (it'll die
if the required version is not present.)



use_ok w/version numbers

2002-07-01 Thread Andy Lester

I can do this:

use PHP::Session 0.10;

to ensure a version number, but I can't do this:

use_ok( 'PHP::Session', '0.10' );

because I get this error:

alester@flr4[~/tw/Dev]$ more Modules.t
#!/usr/bin/perl -w

use strict;
use Test::More tests => 1;

use_ok( 'PHP::Session', '0.10' );


alester@flr4[~/tw/Dev]$ perl Modules.t
1..1
not ok 1 - use PHP::Session;
# Failed test (Modules.t at line 6)
# Tried to use 'PHP::Session'.
# Error:  Can't locate object method "require_version" via package "PHP::Session" 
(perhaps you forgot to load "PHP::Session"?) at 
/usr/local/lib/perl5/5.6.1/Exporter/Heavy.pm line 105.
# Looks like you failed 1 tests of 1.



Before I go digging into a patch, is this something that we even want to
allow?  I know I'd like to allow it, because I'd like to have one .t
file that ensures that I have proper module prereqs for my entire source
tree.

xoxo,
Andy


-- 
'Andy Lester[EMAIL PROTECTED]
 Programmer/author  petdance.com
 Daddy  parsley.org/quinn   Jk'=~/.+/s;print((split//,$&)
[unpack'C*',"n2]3%+>\"34.'%&.'^%4+!o.'"])