wertert has asked for the wisdom of the Perl Monks concerning the following question:

Hi All

Has anyone come across this

Making C(test7.pl.c) for test7.pl! /opt/DKBperl/bin/perl -I/opt/DKBperl/lib/sun4-solaris -I/opt/DKBperl/l +ib -I/opt/DKBperl/lib/site_perl/sun4-s olaris -I/opt/DKBperl/lib/site_perl -I. -MO=CC,-otest7.pl.c test7.pl test7.pl syntax OK No definition for sub Storable::store No definition for sub Storable::store (unable to autoload) No definition for sub Storable::retrieve No definition for sub Storable::retrieve (unable to autoload) Compiling C(test7) for test7.pl! /opt/DKBperl/bin/perl -I/opt/DKBperl/lib/sun4-solaris -I/opt/DKBperl/l +ib -I/opt/DKBperl/lib/site_perl/sun4-s olaris -I/opt/DKBperl/lib/site_perl -I. /tmp/test7.pl.tst gcc -O -I/opt/DKBperl/lib/sun4-solaris/CORE /opt/DKBperl/lib/sun4-sol +aris/auto/Fcntl/Fcntl.so /opt/DKBperl/ lib/site_perl/sun4-solaris/auto/Storable/Storable.so -o test7 test7.pl +.c -L/opt/DKBperl/lib/sun4-solaris/CO RE -lperl -lsocket -lnsl -ldl -lm -lc -lcrypt
when running perlcc ? It seems to happen when I use any number of cpan modules. In the example I'm using Storable. I have my own modules which seem ok. The compile finishes but when I run the exe I just get
./test Undefined subroutine &AutoLoader::AUTOLOAD called at /opt/DKBperl/lib/ +site_perl/sun4-solaris/Storable.pm lin e 120.
No sure what is going wrong here but the compile looks unhappy. I've been on this one for 2 days and it's getting me down. Any ideas ?

Replies are listed 'Best First'.
Re: unable to autoload when using perlcc
by IlyaM (Parson) on Nov 27, 2001 at 16:16 UTC
    AFAIK perlcc still is very experimental. I haven't seen it work for any of my script which are more complex than "hello, world".
Re (tilly) 1: unable to autoload when using perlcc
by tilly (Archbishop) on Nov 27, 2001 at 23:45 UTC
    perlcc may be experimental, but even if it was pretty reliable, the above would still be a big issue.

    AUTOLOAD is often used for dynamic delayed loading of functionality. That speeds up scripts because they do not have to compile functionality they may not use. But it means that even when the script has finished loading, there is no easy way to tell how much more it has to compile.

    The best workaround is to have a module you load that doesn't do anything useful, but deliberately makes calls that exercise all of the functionality which would need to be loaded. Then they get autoloaded in time to be compiled by perlcc. This may be somewhat trial and error.

    You will have (not can, but will) related problems with functionality loaded on demand with require, and with any module which creates open socket connections (eg to a database) upon loading.