Hoenie Luk wrote:
> Has anyone try to delay loading the Statistics module by
> using autouse? I
> can't get it to work.
> 
> The usual usage without autouse is this:
> use Statistics::Descriptive;
> $stat = Statistics::Descriptive::Sparse->new();
> 
> But if I autouse with this syntax:
> use autouse 'Statistics::Descriptive';
> $stat = Statistics::Descriptive::Sparse->new();
> 
> I get this error:
> Can't locate object method "new" via package
> "Statistics::Descriptive::Sparse" (
> perhaps you forgot to load "Statistics::Descriptive::Sparse"?) at
> C:\Perl\prog\b io1a\test.pl line 2.

I'm not that familiar with autouse, but it appears to be designed for those
modules that export functions, and not modules that are used OOP-style.

If you want to delay loading until you're ready to call new, you can do
this:

   eval "use Statistics::Descriptive";
   die $@ if $@;
   $stat = Statistics::Descriptive::Sparse->new();

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to