You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Vladimir Ivaschenko <ha...@hazard.maks.net> on 2000/02/23 10:59:13 UTC

Embperl and do()

Hello.

I've been using do 'file' in my Embperl code to include some common files
between epl scripts (like, page url's, database passwords etc). However,
sometimes it seems that do 'file' doesn't load the file and the script
fails because variables don't have values they should have.

The code usually looks like:
[-
do 'location/common.pm';
Execute (location of common epl file);
-]

I don't use [! !] construct here because common.pm has variables values of
which can differ on various conditions.

Can someone point to the right direction? Should I use something else
instead of do - like Execute? The problem is that I want common.pm to be
loadable by normal Perl scripts/CGIs as well.

Thanks,
Vladimir

RE: Embperl and do()

Posted by Gerald Richter <ri...@ecos.de>.
Hello.
>
> I've been using do 'file' in my Embperl code to include some common files
> between epl scripts (like, page url's, database passwords etc). However,
> sometimes it seems that do 'file' doesn't load the file and the script
> fails because variables don't have values they should have.
>
> The code usually looks like:
> [-
> do 'location/common.pm';
> Execute (location of common epl file);
> -]
>
> I don't use [! !] construct here because common.pm has variables values of
> which can differ on various conditions.
>
> Can someone point to the right direction? Should I use something else
> instead of do - like Execute? The problem is that I want common.pm to be
> loadable by normal Perl scripts/CGIs as well.
>

This normaly happen, when there are error in common.pm. To catch these
errors add

[-
do 'location/common.pm';
die "error in common.pm: $@" if ($@) ;
Execute (location of common epl file);
-]

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 925151
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------