perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gerald Richter" <rich...@ecos.de>
Subject Re: embperl and require
Date Fri, 16 Jan 2004 05:11:49 GMT
embperl and require>I'm pretty new to embperl.  I noticed a behavior that is
>different from that of perl.  When I use [- require('somefile.pl') -]
>in an embperl script, I get "Error in Perl code: Can't locate config.pl in
@INC
>"  where @INC contains the current directory '.' and my script that calls
require
>is in the same directory as somefile.pl.  This works as a perl cgi but not
in embperl.
>Can anyone explain to me why this doesn't work?  I'm running embperl 2 on
mod_perl

Embperl 2 does not change to the diretory of the script. You can get the
directory with

$r -> component -> cwd ;

where $r is the Embperl request record which you get when you write

$r = shift ;

at the top of your page. So

[-
$r = shift ;
require $r -> component -> cwd . '/somefile.pl' ;
-]

Does what you want.

Gerald


--------------------------------------------------------------
Gerald Richter     ecos electronic communication services gmbh
IT-Securitylösungen * dynamische Webapplikationen * Consulting

Post:       Tulpenstrasse 5          D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de          Voice:   +49 6133 939-122
WWW:        http://www.ecos.de/      Fax:     +49 6133 939-333
--------------------------------------------------------------
|
|   ECOS BB-5000 Firewall- und IT-Security Appliance: www.bb-5000.info
|
+-------------------------------------------------------------


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


Mime
View raw message