--- Jonathan Rockway [EMAIL PROTECTED] wrote:
OT, but 'ok.pm' is quite nice:
use Test::More tests = 1;
use ok 'My::Module'; # test runs at compile time
Oh, I really like that, but it still causes an issue for me. You see,
a lot of what I do is stuff like this:
my $CLASS;
BEGIN {
$CLASS = 'Customer';
use_ok $CLASS or die;
}
can_ok $CLASS, 'new';
ok my $cust = $CLASS-new, '... and we can call it';
isa_ok $cust, $CLASS, '... and the object it returns';
This means that if I need to refactor classes to better namespaces, I
merely change the $CLASS = line. With the lovely ok.pm module, I
still have the following clunky construct:
my $CLASS;
BEGIN {
$CLASS = 'Customer';
}
use ok $CLASS or die;
can_ok $CLASS, 'new';
ok my $cust = $CLASS-new, '... and we can call it';
isa_ok $cust, $CLASS, '... and the object it returns';
Those BEGIN blocks really annoy the hell out of me at times :(
Cheers,
Ovid
--
Buy the book - http://www.oreilly.com/catalog/perlhks/
Perl and CGI - http://users.easystreet.com/ovid/cgi_course/
Personal blog - http://publius-ovidius.livejournal.com/
Tech blog - http://use.perl.org/~Ovid/journal/