perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@discerning.com
Subject RE: universal @INC?
Date Fri, 06 Apr 2007 04:59:03 GMT

On Thu, 5 Apr 2007 08:02:11 +0200, "Gerald Richter - ECOS GmbH" <richter@ecos.de> said:
> > 
> > It seems that if I do
> >    [! use lib '/whatever/wherever'; !]
> > in one file, it doesn't help when i do
> >    [! use MyModule; !]
> > in another file.
> > So what is the best way to set @INC so it applies to everything?
> > 
> 
> If you use mod_perl, than you should put it in a startup.pl that you 
> include with PerlRequire in your httpd.conf.
> 
> For CGI, just include it in the embpcgi.pl

It seems another solution is to do a "SetEnv PERL5LIB ..."
in .htaccess which works for both CGI and mod_perl.

> > Also, is there any way to import symbols so that they are 
> > available everywhere without qualification?
> > So I would do this in myfuncs.epl :
> >   [! use MyModule qw(func1 $VAR1); !]
> > and then I do elsewhere
> >   [! Execute 'myfuncs.epl' !]
> >   [+ func1() +]
> > 
> 
> You could use Embperl_Top_include to include some code at the top of 
> every page, for example some use statements.
> 
> You can also use Execute ({inputfile => '...', import => 1}) to import 
> subs that are declared va [$sub$]

Instead I'm now doing Execute ({inputfile => '...', package => __PACKAGE__})
which has the benefit (or deficit for perhaps other cases) that it'll get
all symbols, not just the [$sub$] symbols.

-mda

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message