develooper Front page | perl.perl5.porters | Postings from November 2003

Re: question about load_module

Thread Previous
Nick Ing-Simmons
November 10, 2003 14:13
Re: question about load_module
Message ID:
Jamie Le Tual <> writes:
>I created a module using "h2xs -n LoaderTest", then tacked the following 
>XSUB at the end:
>doLoad(SV *package_name)
>    load_module(0, package_name, Nullsv);

Where did you get that scheme from ?
If you do NOT specify PERL_LOADMOD_NOIMPORT in the flags slot,
you need to have a Nullsv to terminate the varargs list of args to 
pass to import.


  load_module(0, package_name, Nullsv, Barsv, Nullsv); // use Foo 'Bar';

  load_module(0, package_name, Nullsv, Nullsv); // use Foo;

  load_module(PERL_LOADMOD_NOIMPORT, package_name, Nullsv); // use Foo ();

Note that all the SVs you pass will be SvREFCNT_dec()ed by time call returns.

>I then had the idea of seeing if any clever people had already used 
>load_module, so I looked through the source of mod_perl. 

Why not the source of perl ?

>Seems they 
>build a "require %s" type of thing and eval_sv() that instead....
>is load_module broken? 

No ;-)

>Badly documented? 

Documented? what is that ;-)

>Am I such a clod that I've 
>missed something obvious?

The source ? Perl_vload_module() in op.c is not that opaque.

>Will work for clue,

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About