Subject: | Can't lazy-load the module at run-time |
I'm trying to lazy-load various modules only if I need them. I only need
OggVorbis support, for example, when operating on an actual .ogg file.
This reduces startup time and means that users don't need OggVorbis code
present if they're not operating on such files.
I can do this, and it works:
$ perl
use Ogg::Vorbis::Header;
Ogg::Vorbis::Header->load( "/dev/null" );
(it just returns undef, as expected).
If I try this instead:
$ perl
eval "use Ogg::Vorbis::Header;";
Ogg::Vorbis::Header->load( "/dev/null" );
Undefined subroutine &Ogg::Vorbis::Header::_new called at
/usr/lib/perl5/Ogg/Vorbis/Header.pm line 29.
One or more DATA sections were not processed by Inline.
I've tried various other variations on this theme - require/import,
etc... All of them result in the same error.
I suspect it's a problem relating to the use of Inline::C code; the
above technique works fine with the Ogg::Vorbis::Header::PurePerl module.
For reference:
$ perl --version
This is perl, v5.8.8 built for i486-linux-gnu-thread-multi
$ perl -mInline -e 'print $Inline::VERSION;'
0.44
$ perl -mOgg::Vorbis::Header -e 'print $Ogg::Vorbis::Header::VERSION;'
0.03
Perhaps is there any way to fix this?
--
Paul Evans