Mailing List Archive

'use' statement and search path.
Hello,

I had problem with the 'use' statement. It did not take the
'correct' search path:

My document structure looked like this:

.../test/foo.epl
.../test/Bar.pm
.../production/foo.epl
.../production/Bar.pm

foo.epl contained a 'use Bar.pm' statement. I expected 'test/foo.epl'
took 'test/Bar.pm', and 'production/foo.epl'
took 'production/Bar.pm', but it was not the case.

'test/foo.epl' arbitrary took 'production/Bar.pm' or 'test/Bar.pm'
as it saw convenient. The same thing happened to 'production/foo.epl'.

It seems to me this has something todo with caching as foo.epl load the
correct Bar.pm after I restart the httpd. But after
a few requests they start messing up.

What should I do to fix this problem?

Thanks in advance.
Nhan.


P.S: I am using Embperl 1.2.0 and mod_perl 1.21-2.


--
+ ----------------------------------------------------------+
| Nhan H. Trinh Phone: (972) 661 3292 x. 40 |
| ETC Inc. email: ntrinh@etctech.com |
+ ----------------------------------------------------------+
RE: 'use' statement and search path. [ In reply to ]
>
> I had problem with the 'use' statement. It did not take the
> 'correct' search path:
>
> My document structure looked like this:
>
> .../test/foo.epl
> .../test/Bar.pm
> .../production/foo.epl
> .../production/Bar.pm
>
> foo.epl contained a 'use Bar.pm' statement. I expected 'test/foo.epl'
> took 'test/Bar.pm', and 'production/foo.epl'
> took 'production/Bar.pm', but it was not the case.
>

What about reading

perldoc -f use

and

perldoc -f require

??

use searches @INC and never takes a filename, as require it loads a module
only once and will not reload if it's already in memory. So what you are
trying todo cannot work!

Also it is not possible to load two different modules into the same
namespace (same name after package), but this is a Perl problem and not
special for Embperl.

Gerald






> 'test/foo.epl' arbitrary took 'production/Bar.pm' or 'test/Bar.pm'
> as it saw convenient. The same thing happened to 'production/foo.epl'.
>
> It seems to me this has something todo with caching as foo.epl load the
> correct Bar.pm after I restart the httpd. But after
> a few requests they start messing up.
>
> What should I do to fix this problem?
>
> Thanks in advance.
> Nhan.
>
>
> P.S: I am using Embperl 1.2.0 and mod_perl 1.21-2.
>
>
> --
> + ----------------------------------------------------------+
> | Nhan H. Trinh Phone: (972) 661 3292 x. 40 |
> | ETC Inc. email: ntrinh@etctech.com |
> + ----------------------------------------------------------+
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
>
>



-------------------------------------------------------------
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
-------------------------------------------------------------
RE: 'use' statement and search path. [ In reply to ]
>
> My appology, I actually used "use Bar;". So my problem is name space.
> I wonder if it help hosting /test and /production by 2 separate httpd
> servers (on the same machine)?
>

Yes, (if you mean two sever processes, _not_ virtual servers) this would
help, because then you have two different perl interpreters.

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