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


In reply to Apache::Registry and main package by allyc

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.