Are you using Apache::Registry or another handler?
Perl scripts should run without any modifications with under
mod_perl/Apache::Registry
if it's setup right. What are you trying to do?
Try using perl directly.
I personally only have modules and use "use" instead of require.
I then export symbols into the calling packages namespace using
exporter.
You can make your module like this
-- start file ---
# Package Declaration
package yourPackageOrLibraryName;
# Exporter Module used to export names from this module
use Exporter;
#--------------------------------------------------------------------
# Inherit from Exporter module
# to put symbols in calling packages
# namespace, put symbols ( names of functions ) in @EXPORT array
# you can put functions in the @EXPORT_OK array but you have
# to specify explicitly those routines with the use statment in the
# calling package
#--------------------------------------------------------------------
# Here you put your inherted modules in the @ISA array
# We need to Inherted from Exporter to easily export symbols
@ISA=('Exporter');
# @EXPORT_OK array allows us to selectively specify in the use
# which symbols to import
# for example in the ::main package
# use yourPackageOrLibraryName('func1', 'func2');
# @EXPORT will export all symbols when you in the using module
# do not include any symbols for example
# use yourPackageOrLibraryName;
@EXPORT = ('parse', 'header', 'end_html', 'html_head', 'side_bar');
# put subroutines & other symbols below
-- end file --
Or do OO library
#--------------------------------------------------------------------------------------------------------------
package myPackage;
#--------------------------------------------------------------------------------------------------------------
use DBI;
use cgiutils;
#--------------------------------------------------------------------------------------------------------------
# Constructor
#--------------------------------------------------------------------------------------------------------------
sub new
{
my($pkg, $name, $age) = @_;
# must return blessed refrence
return bless( { "field1" => "value" }, $pkg );
}
#--------------------------------------------------------------------------------------------------------------
# Destructor
#--------------------------------------------------------------------------------------------------------------
sub DESTROY
{
my $obj = shift;
$obj->{"dbh"}->dissconnect();
}
#--------------------------------------------------------------------------------------------------------------
sub foo
{
}
--- snip ---
then use it in another module like the main module like so
use MyPackage;
$obj = new MyPackage();
Tyler
Tyler Bird
UVSC - Continuing Education
>>> [EMAIL PROTECTED] 02/04/05 2:31 PM >>>
I'm running some perl based web pages with apache-perl on a Debian
Sarge
box. I'm pretty new to it all, so be nice. I have used *require* to
include a file, consisting of a bunch of my subroutines, to my main
code. I use the same *require* statement in a few files, and it
references the same subroutine file. At times I get the following
error, while trying to navigate to the linked files that have the
*require *statement:
[<Date>] [error] Undefined subroutine
&Apache::ROOT::perl::<path>::<file>_2epl::<subroutine> called at
<path><file> line ##.\n
Previously, I have simply replicated the subroutines and added them to
the actual files, without the *require* statement. I am finally fed up
with editing each subroutine and having incosistent code, so I am
trying
to resolve this issue. I have tried to read up on this, but can't seem
to get it through my thick skull.
I can use the subroutine file on another system ( same setup, except
for
the apache package is just apache: no mod_perl integration ). What is
the difference, and how is it possible to make this work. Or am I just
doing it totally wrong.
TIA
.===================================.
| This has been a P.L.U.G. mailing. |
| Don't Fear the Penguin. |
| IRC: #utah at irc.freenode.net |
`==================================='
.===================================.
| This has been a P.L.U.G. mailing. |
| Don't Fear the Penguin. |
| IRC: #utah at irc.freenode.net |
`==================================='