Re: Test::More::can_ok when using AutoLoader

2002-09-02 Thread Michael G Schwern

On Sat, Aug 31, 2002 at 02:05:53PM +0200, Elizabeth Mattijsen wrote:
> >$ perl -Mblib -wle 'use AutoExample;  print "Yes" if 
> >AutoExample->can("foo")'
> >Using /home/schwern/tmp/AutoExample/blib
> >Yes
> 
> Hmmm... I'm doing BEGIN { use_ok( 'Thread::Pool' ) }...  Maybe there is a 
> difference there...

Hmmm.  Shouldn't be a difference.

> Ok, so it _should_ work.  I'll see if I can boil this down and create a 
> bugreport if I can.


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/
Perl Quality Assurance  <[EMAIL PROTECTED]> Kwalitee Is Job One
Out of ammunition.  God save the King.



Re: Test::More::can_ok when using AutoLoader

2002-08-31 Thread Elizabeth Mattijsen

At 02:38 PM 8/30/02 -0700, Michael G Schwern wrote:
>On Fri, Aug 30, 2002 at 04:01:11PM +0200, Elizabeth Mattijsen wrote:
> > Is there an easy way to check methods, whose loading is deferred with
> > AutoLoader, with the can_ok() check?
>Nope.  You have to create stubs.  The AutoLoader module should do this
>automatically for you assuming you've gone through the full build process
>and AutoSplit has had a chance to do it's job.

That's been done.  So I was wondering why it didn't find them...


>$ Makefile.PL
>Writing Makefile for AutoExample
>$ make
>cp lib/AutoExample.pm blib/lib/AutoExample.pm
>AutoSplitting blib/lib/AutoExample.pm (blib/lib/auto/AutoExample)
>$ cat blib/lib/auto/AutoExample/autosplit.ix
># Index created by AutoSplit for blib/lib/AutoExample.pm
>#(file acts as timestamp)
>package AutoExample;
>sub foo  ;
>1;

Yep, that all is the same as in my situation for the Thread::Pool package.


>$ perl -Mblib -wle 'use AutoExample;  print "Yes" if AutoExample->can("foo")'
>Using /home/schwern/tmp/AutoExample/blib
>Yes

Hmmm... I'm doing BEGIN { use_ok( 'Thread::Pool' ) }...  Maybe there is a 
difference there...



Ok, so it _should_ work.  I'll see if I can boil this down and create a 
bugreport if I can.


Liz




Re: Test::More::can_ok when using AutoLoader

2002-08-30 Thread Michael G Schwern

On Fri, Aug 30, 2002 at 04:01:11PM +0200, Elizabeth Mattijsen wrote:
> Is there an easy way to check methods, whose loading is deferred with 
> AutoLoader, with the can_ok() check?

Nope.  You have to create stubs.  The AutoLoader module should do this
automatically for you assuming you've gone through the full build process
and AutoSplit has had a chance to do it's job.

$ Makefile.PL
Writing Makefile for AutoExample

$ make
cp lib/AutoExample.pm blib/lib/AutoExample.pm
AutoSplitting blib/lib/AutoExample.pm (blib/lib/auto/AutoExample)

$ cat blib/lib/auto/AutoExample/autosplit.ix 
# Index created by AutoSplit for blib/lib/AutoExample.pm
#(file acts as timestamp)
package AutoExample;
sub foo  ;
1;

$ perl -Mblib -wle 'use AutoExample;  print "Yes" if AutoExample->can("foo")'
Using /home/schwern/tmp/AutoExample/blib
Yes

$ perl -Ilib  -wle 'use AutoExample;  print "Yes" if AutoExample->can("foo")'
Can't locate auto/AutoExample/autosplit.ix in @INC (@INC contains: lib 
/usr/local/lib/perl/5.6.1 /usr/local/share/perl/5.6.1 /usr/lib/perl5 /usr/share/perl5 
/usr/lib/perl/5.6.1 /usr/share/perl/5.6.1 /usr/local/lib/site_perl .) at 
/usr/share/perl/5.6.1/AutoLoader.pm line 147.
 at lib/AutoExample.pm line 5


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/
Perl Quality Assurance  <[EMAIL PROTECTED]> Kwalitee Is Job One
It's Mainline Heroin time!



Test::More::can_ok when using AutoLoader

2002-08-30 Thread Elizabeth Mattijsen

Is there an easy way to check methods, whose loading is deferred with 
AutoLoader, with the can_ok() check?  Or would some magic need to be added 
to AutoLoader.pm?

Currently, you get an error that the subroutines do not exist.


Liz