allyc has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks,
I am after a bit of advise with writing scripts that will work with Apache::Registry under mod_perl and the name spaces that it uses.
I am currently creating an application that I want to be able to execute as CGI and also with Apache::Registry but I am having problems accessing the main name space.
I currently have the following :
index.pl use strict; # Add the path to the Module to @INC use lib 'C:/inetpub/wwwroot/Altest/AlsModules'; # Load the Module, and Export has %FormData use AlCommon; # Set the Application Details our %ApplicationDetails; $ApplicationDetails{Name} = 'Test App'; $ApplicationDetails{Version} = '1.0'; $ApplicationDetails{Comments} = 'This is my Test App'; # Display the ApplicationAbout function AlCMSCommon->ApplicationAbout(); # End AlCommon.pm package AlCommon; use strict; use Exporter; our $VERSION = 1.00; our @ISA = qw(Exporter); our @EXPORT = qw(AlsTemplateBuilder); our @EXPORT_OK = qw(%FormData); sub ApplicationAbout { print “About Application :\n”; foreach my $AboutItem (qw(Name Version Comments)) { print $AboutItem = $main::ApplicationDetails{$AboutItem}\n”; } }
This works fine when run as CGI, but fails with Apache::Registry. I think the problem is that Apache::Registry gives the main package a new package name and so a different name space. I can use caller to get the name space where the hash is located, but I cant work out how to use that to get access to the the data.
Has any one done anything like this in the past, or have any pointers that might help me?
Thanks! Al
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Apache::Registry and main package
by edan (Curate) on Oct 30, 2004 at 18:11 UTC | |
by allyc (Scribe) on Oct 31, 2004 at 00:09 UTC | |
|
Re: Apache::Registry and main package
by ikegami (Patriarch) on Oct 30, 2004 at 19:35 UTC |