I don't know if this will help.  I know very litlle about mod perl, but most
of the people on this list don't seem to answer questions from beginners.
I think you might try adding:
use subs qw(main);
in the top of your script.
or instead of
main() use &main()
There are situations where you can't use main() without the & and I think it
has to do with predeclaring the sub which use subs will remedy.  let me know
if this helps.
If that doesn't work, you will probably need to make the lib a package and
import it into your fetch.pl program.
Kindof new to that as well and havn't experimented much with it.

Does anyone know of a news group that answers mod perl questions?
cya
jm


----- Original Message -----
From: "Peter Pilsl" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, October 23, 2001 5:48 PM
Subject: namespace-troubles


> I run into deep namespacetroubles I understand onyl vaguely and I cant
workaround:
>
> I have a script running under mod_perl that is called via two domains.
>
> www1.domain.at/
> www2.domain.at/sub/
>
> both of the above addresses lead to the very same script (its the same
> file on the disk, not a copy). When I call the first adress all is
> working fine, but as soon as I call the second adress I get a
> server-error.  Restarting apache and I try the second first: running
> fine, but as soon as I call the first: server-error.
>
> The log reveals:
>
> Undefined subroutine &Apache::ROOTwww1_2domain_2eat::main called at
> /data/public/stage2/fetch.pl line 9.
>
> or
>
> Undefined subroutine
> &Apache::ROOTwww2_2edomain_2eat::editeinstieg::main called at
> /data/public/stage2/fetch.pl line 9.
>
> my script is structured like that:
> ----fetch.pl:
> require fetch.lib.pl
> main();
> -----
>
> ---fetch.lib.pl:
> sub main{
>
> do everthing here
>
> }
> 1;
> ----
>
> As far I can see, the second call does not load the lib anymore, cause
> it was already loaded on the first call. Unfortunately it was loaded
> to a different namespace, so the script doesnt find it.
>
> What can I do ? I need this different domains, cause the script-action
> depends on the calling domain.
>
> The reason why I splitted in script/lib is a document at apache.org
> that recommends this to avoid a nested-sub-problem under mod_perl.
>
> I wonder if providing the lib-file as module (use instead of require)
> would be a solution, but I guess not.  Can the above problem occure
> with modules too ? If two scripts call the same module, is it only
> loaded on the first call and the second script fails ??
>
> thnx,
> peter
>
>
> --
> mag. peter pilsl
>
> phone: +43 676 3574035
> fax  : +43 676 3546512
> email: [EMAIL PROTECTED]
> sms  : [EMAIL PROTECTED]
>
> pgp-key available

Reply via email to