perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kee Hinckley <naz...@somewhere.com>
Subject Re: use lib in EmbperlObject
Date Fri, 16 Aug 2002 12:35:13 GMT
At 7:25 AM +0200 8/16/02, Gerald Richter wrote:
>  > >>  Is there any way to put a "use lib" command in a called routine (e.g.
>>  >>  [- Execute({ isa => 'SiteInit.html' }); -]) and have it impact later
>>  >>  "use" commands?
>
>use lib is global, because it affects the global @ISA, so it doesn't matter
>where you put it, it will affect all use statements that are executed after
>the use lib.

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, 
/sw/lib/perl5, /System/Library/Perl/darwin, /System/Library/Perl, 
/Library/Perl/darwin, /Library/Perl, /Network/Library/Perl/darwin, 
/Network/Library/Perl, ., /usr/local/apache/, 
/usr/local/apache/lib/perl
index.html: /usr/local/PureMessaging/lib, /sw/lib/perl5/darwin, 
/sw/lib/perl5, /System/Library/Perl/darwin, /System/Library/Perl, 
/Library/Perl/darwin, /Library/Perl, /Network/Library/Perl/darwin, 
/Network/Library/Perl, ., /usr/local/apache/, 
/usr/local/apache/lib/perl

The second time gives me:
Template.html: /sw/lib/perl5/darwin, /sw/lib/perl5, 
/System/Library/Perl/darwin, /System/Library/Perl, 
/Library/Perl/darwin, /Library/Perl, /Library/Perl, 
/Network/Library/Perl/darwin, /Network/Library/Perl, 
/Network/Library/Perl, ., /usr/local/apache/, 
/usr/local/apache/lib/perl
index.html: /sw/lib/perl5/darwin, /sw/lib/perl5, 
/System/Library/Perl/darwin, /System/Library/Perl, 
/Library/Perl/darwin, /Library/Perl, /Library/Perl, 
/Network/Library/Perl/darwin, /Network/Library/Perl, 
/Network/Library/Perl, ., /usr/local/apache/, 
/usr/local/apache/lib/perl

And if instead of just printing @INC, I try using something that is 
at that location, it never works.  First time or any other.

Moving the use lib to Template.html doesn't help.  Nor does moving it 
and changing it to [-.  It has to be in the same file as the "use 
mylibrary" statement.


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.
-- 

Kee Hinckley - Somewhere.Com, LLC
http://consulting.somewhere.com/

I'm not sure which upsets me more: that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.

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


Mime
View raw message