Apache-Perl: mod_perl error

Jayce^ jason at infogenix.com
Fri Feb 4 16:59:38 MST 2005


On Friday 04 February 2005 04:06 pm, Ryan Nielsen wrote:
> In the httpd.conf file for the <IfModule mod_perl.c> section is says
> PerlHandler Apache::Registry.  So, I am assuming that is what I am using.

Yeah.  Apache::Registry is a module to easily allow well formed cgi's (use 
strict) to run under mod_perl, with a great speed improvement.  Not as good 
as a pure handler, but very good (just like mod_php, mod_python, etc work).

> I'll need to read more into packages.  It is somewhat confusing to me
> right now as to how to use them in perl.  

Fairly easy, and something that could be covered in a perl mongers meeting.  
There are good perldocs written to help out.  perldoc perlootoot for one.

> What do you mean load the file 
> at startup?  I thought that was what the require statement was doing.

I mean apache startup,  It's a slightly advanced topic for mod_perl 
performance tuning, but something you'll look into later :)

Oh, and a 'require' is loaded at run time, whereas a 'use' is at compile time 
(unless inside and eval block, of course :) ).

> I currently own:
> Deitel's Perl How to Program
> O'Reilly's Programming Perl

k, you'll likely want a mod_perl specific one, to help with that.  Also, the 
new oreilly "learning perl objects and references' would be a good book, 
since you are learning packages and stuff.

> I don't have a package.  Is that the real problem here?  I am sure there
> aren't any name conflicts, unless there is some naming convention rule I
> don't know about.

Well, you do, without knowing.  A perl script is always package main, and when 
you require a module, it becomes a part of main::.  Apache::Registry wraps 
your entire script in a handler{} routine, and brings that into the apache 
space.  

> Again, this "startup" is new to me.  Do you mean when I first open the
> page.  That would be when the script is run, correct?

Actually, when you first start apache. so startup == apache starting, and 
loading your code.  Oh, and you *are* restarting apache after you make 
changes to your code right?  Either that or learning and using 
Apache::Restart?

> I will read up on packages, and see if I can resolve the issue with a
> using a package designation for my require statement.

ok, those answers helped understand where you are, so that's good.

Basic things to check first.  You are using strict pragma, right?  You are 
restarting apache? 

-- 
Jayce^
-------------- 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/a490dea6/attachment.bin 


More information about the PLUG mailing list