perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gerald Richter" <rich...@ecos.de>
Subject Re: Problems when using require or modules..
Date Sat, 15 Mar 2003 08:39:49 GMT


> I have read that FAQ, but the source havn't changed!
>

Yes, but the problem is the same. You include mylib.pl in multiple embperl
pages. Each Emperl page runs in it's own namespace and the lib is compiled
in the namespace of the page where it is first required. The second page
will not reload the lib and therefore it is not available in it's namespace.

Either start your lib with a package statement (e.g. package mylib ; ) and
call it with a package name (e.g. mylib::getsql) or use do instead of
require (which is much less efficent). There other possibilies (e.g. make it
an object), but these two are the easiest.

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
--------------------------------------------------------------
|
|   Besuchen Sie uns auf der CeBIT vom 12. - 19. März 2003
|   Messe Hannover * Halle 17 * Stand F 36
|   http://www.cebit.de/
|
+-------------------------------------------------------------


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


Mime
View raw message