You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Jean-Christophe Boggio <em...@thefreecat.org> on 2009/10/19 12:45:40 UTC

sub BEGIN in embperl ?

Hello,

I wish to "use" some library that is not located on the PATH so
I try this kind of code inside my base.epl :

sub BEGIN {
	my $script = $ENV{SCRIPT_FILENAME};
	$script =~ s/^(.*)\/.*?$/$1/;
	push @INC,$script;
	push @INC,"$script/..";
}

But it does not seem to work. How should I do this (what is
the right way of doing this with embperl) ?

Maybe some hardcoded use lib "xxx" inside startup.pl ?

Thanks for your help !

-- 
Jean-Christophe Boggio                       -o)
embperl@thefreecat.org                       /\\
Independant Consultant and Developer        _\_V

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


Re: sub BEGIN in embperl ?

Posted by Jean-Christophe Boggio <em...@thefreecat.org>.
Dirk Melchers a écrit :
> We 'use lib "xxx"' in our startup.pl and that works.
> 
> But be careful: the used libs are only compiled once and available in 
> all websites (if you use "mod_perl") - so namespaces of your modules 
> should be different to avoid "funny" things...

I see what you mean by "funny" things, thanks for the tip, I probably would have
slipped on that.

Have a nice day,

-- 
Jean-Christophe Boggio                       -o)
embperl@thefreecat.org                       /\\
Independant Consultant and Developer        _\_V

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


Re: sub BEGIN in embperl ?

Posted by Dirk Melchers <me...@nureg.de>.
Hi,

Am 19.10.2009 um 12:45 schrieb Jean-Christophe Boggio:

> Hello,
>
> I wish to "use" some library that is not located on the PATH so
> I try this kind of code inside my base.epl :
>
> sub BEGIN {
> 	my $script = $ENV{SCRIPT_FILENAME};
> 	$script =~ s/^(.*)\/.*?$/$1/;
> 	push @INC,$script;
> 	push @INC,"$script/..";
> }
>
> But it does not seem to work. How should I do this (what is
> the right way of doing this with embperl) ?
>
> Maybe some hardcoded use lib "xxx" inside startup.pl ?


We 'use lib "xxx"' in our startup.pl and that works.

But be careful: the used libs are only compiled once and available in  
all websites (if you use "mod_perl") - so namespaces of your modules  
should be different to avoid "funny" things...



With best regards,


Dirk Melchers
/// IT/Software-Entwicklung ///

-- 
NUREG GmbH ///
Dorfäckerstraße 31 | 90427 Nürnberg | Germany
Tel. +49-911-32002-256 | Fax +49-911-32002-299
Mobil +49-172-9354670 | www.nureg.de
Nürnberg HRB 22653 | USt.ID DE 814 685 653
Geschäftsführer: Michael Schmidt, Stefan Boas


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