perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gerald Richter" <rich...@ecos.de>
Subject Re: use lib in EmbperlObject
Date Thu, 22 Aug 2002 05:08:20 GMT
>
> Here's what I have:
>
> SiteInit.html
> [! use lib "/usr/local/PureMessaging/lib"; !]
> Template.html
> [- Execute({ isa => 'SiteInit.html' }); -]
> Template.html: [+ join(", ", @INC) +]<br>
> [- Execute('*') -]
> index.html
> index.html: [+ join(", ", @INC) +]<br>
>
> Running that the first time gives me:
> Template.html: /usr/local/PureMessaging/lib, /sw/lib/perl5/darwin,
>
> The second time gives me:
> Template.html: /sw/lib/perl5/darwin, /sw/lib/perl5,
>
> And if instead of just printing @INC, I try using something that is
> at that location, it never works.  First time or any other.
>

The first time it should work, because the @INC path is correct.

I remeber something that maybe mod_perl is reseting the @INC array after the
request. That would explain why the path has gone on the second request.

> Moving the use lib to Template.html doesn't help.  Nor does moving it
> and changing it to [-.

The Execute ({isa => }) is always only executed on the first run and [- -]
blocks in it get's never executed, unless they are inside a sub and the sub
is called.

> It has to be in the same file as the "use
> mylibrary" statement.
>

Assuming that mod_perl reseting the @INC, you either have to do it in a file
that really get's executed on every request or put it in the startup.pl
file.

>
> On a related topic.  If I do a "use somelibrary" in a template, and
> it imports some functions into the name space, it would be nice to be
> able to use them in the files that are using that template.

Because of the different namespaces of those files this won't work, sorry.

Gerald


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------



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


Mime
View raw message