perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Cars <ste...@snowfall.se>
Subject Re: Problems when using require or modules..
Date Tue, 25 Mar 2003 14:07:24 GMT
I've made it an object.... but when doing this it just works for the 
first request to the server not the following 10-12 times then i works 
again and then it stops working 10-12 times. I guess this has something 
todo with the different httpd processes.... How should I do this instead 
?  Is it possible to create the $db in some startup script and make that 
object global to all embperl pages ??
[!
$db = Snowfall::Database3->new();       

!]


Gerald Richter wrote:

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