Ovid writes:

> 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 :(

Well don't have them then -- put the assignment in the use statement,
which is run at BEGIN time anyway:

  use Test::More tests => 1;
  my $CLASS;
  use ok $CLASS = 'DateTime';

Smylers

Reply via email to