Apache-Perl: mod_perl error

Jayce^ jason at infogenix.com
Fri Feb 4 14:49:05 MST 2005

On Friday 04 February 2005 02:31 pm, Ryan Nielsen wrote:
> 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. 

Of course, you've made an excellent choice is software, how could we *not* be 
nice :)

First question.  Are you using full mod_perl handlers (I'm guessing not by the 
description I read).  Or are you using something like Apache::Registry, or 

Knowing this will help some.

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

This is where you should build a package probably, very similar in writing to 
your library, but it will give you some assistance with namespacing, which 
could possibly be an issue.

Also, instead of just loading it in each file, you'll be able to load the file 
at startup, and use shared memory to your advantage.
> [<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.

Yes, just copying code is a bad idea, and you are seeing why.  Perl makes it 
easy for that to be unecessary.
What places are you reading? There are a couple of excellent books that I 
would suggest if you are getting into mod_perl programming.

Practical mod_perl (oreilly)
mod_perl developers cookbook (sams)
Writing Apache Modules in Perl and C (oreilly) the eagle book

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

Now, did you name your package 'Apache' ?  or are you requiring it in at that 
level?  Just offhand, this comes to mind.  Without revealing anything 
'important' could we know some of the file/subroutine names (in case there is 
a clash?)

Also, do you get any warnings on startup? Specifically perl code warnings?  
What version of apache/perl? 
Are you using a templating kit?

These questions should help form an answer best fitting your setup.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://plug.org/pipermail/plug/attachments/20050204/7e9beecc/attachment.bin 

More information about the PLUG mailing list