You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by My Alias <my...@yahoo.com> on 2000/06/25 21:56:29 UTC

Re: Footer.pm - Thanks

G.W.,

Thanks for the help with my question.  I meant to send
a note yesterday, but to be honest, couldn't remember
if I actually sent it.  So wanted to be safe rather
than ungrateful.

Regarding the points you made, I will need to look
into them a bit more  before I really know if I'm
running things the right way.  I kind of followed a
cook-book and got this thing working, and to be
honest, I really am not sure what I've got (mod_perl
or Apache::Registry).  :)

Specifically, the only module i've tried so far is the
Footer.pm, and it in fact was installed into:
/usr/local/apache/lib/perl/Apache.

As for the "bit" about cgi-bin, I did not know that it
would make a difference, so I just used it as an
example.  Actually, I have in the httpd.conf file the
following:

    Alias /db-bin/ "/home/httpd/db-bin/"
    <Location "/db-bin">
      SetHandler      perl-script               
      PerlHandler     Apache::Registry
      PerlSendHeader  On        
      Options         +ExecCGI 
    </Location>

#   <Location "/db-bin">
#     SetHandler      perl-script               
#     PerlHandler     Apache::Footer            
#   </Location>

## Commented out as the CGI.pm won't parse otherwise.

If you still happen to be reading this, I'd sure
appreciate a quick note if anything obvious jumps out
at you regarding directories (above).  I'm in the
process of trying to understand why my "stuff" fails
under "use strict;" (vars, redefined subroutines,
etc.) and then I'll try and go for the Footer.  But if
it's a simple one, would love to knock it out and have
some uniform footers. :)

Thanks again for your help.

-Brett


As for the 
--- "G.W. Haywood" <ge...@www.jubileegroup.co.uk> wrote:
> Hi there,
> 
> On Sat, 24 Jun 2000, My Alias wrote:
> 
> >   <Location /cgi-bin>
> >     SetHandler perl-script
> >     PerlHandler Apache::Footer
> >   </Location>
> > 
> > and restarted the server.
> > 
> > Now, what used to be sent out as html is sent out
> > looking like:
> > 
> > #!/usr/bin/perl -w
> > use strict;
> > blah,
> > blah,
> > 
> > ------------
> > 
> > I'm using CGI.pm and Apache::Registry.
> > What did I miss?  
> 
> I can't see anything about Apache::Registry in your
> message except the
> bit where you claim to be using it.  Without seeing
> your entire Apache
> configuration I'm not _sure_ you're doing this, but
> I think you are
> trying to have your <Location cgi-bin> handled BOTH
> by mod_perl AND by
> mod_cgi.  I don't think you really want that.  You
> want some other
> Location such as <cgi-perl> for your mod_perl stuff,
> so you keep
> cgi-bin for old CGI scripts and stuff like that.  To
> keep it clean, I
> wouldn't even use Registry on things in there.
> 
> So for example for mod_perl stuff you might say:
> 
> Alias /perl/ /usr/local/apache/cgi-perl/
> <Location /perl>
>   SetHandler perl-script
>   PerlHandler Apache::Footer
> </Location>
> 
> and for Apache::Registry stuff:
> 
> Alias /registry/ /usr/local/apache/cgi-registry/
> <Location /perl>
>   SetHandler perl-script
>   PerlHandler Apache::Registry
> </Location>
> 
> The `Location' /perl/ doesn't really exist, it's
> just a URI that
> triggers Apache to look for things in the directory
> (in this case)
> /usr/local/apache/cgi-perl/.  Then when it's time to
> serve the content
> Apache notices that there's a handler installed for
> that location, the
> handler being mod_perl.  When it's handling requests
> for stuff to be
> served from that location, mod_perl gets the
> instruction to call
> Apache::Footer.  Apache::Footer just modifies the
> file and sends it on
> its way.  Similarly for Registry (presumably what
> used to be your CGI)
> scripts.  There's nothing wrong with the example in
> the Eagle Book.
> 
> 73,
> Ged.
> 


__________________________________________________
Do You Yahoo!?
Get Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/

Re: Footer.pm - Thanks

Posted by "G.W. Haywood" <ge...@www.jubileegroup.co.uk>.
Hi again,

On Sun, 25 Jun 2000, My Alias wrote:

> I really am not sure what I've got (mod_perl
> or Apache::Registry).  :)

Looking at what you have below, anything from <Location "/db-bin"> is
configured to be served by mod_perl which in turn calls a Perl handler
in Apache::Registry (.../Apache/Registry.pm) which in its turn runs
your Perl scripts in db-bin if it can.  If you commented that bit out
and uncommented the other bit then Apache would still tell mod_perl to
serve things from that <Location> but mod_perl would then be looking
for a subroutine called `handler' in a module called `Footer.pm' in
`.../Apache'.  I don't know what the `...' is because I can't see that
bit of the config - if it's there.  If it isn't there then Apache
won't know what to do about it.  You need something that tells Perl
where to look for your modules.  There can be several places.  It's
in the Guide.

> Actually, I have in the httpd.conf file the following:
> 
>   Alias /db-bin/ "/home/httpd/db-bin/"
>   <Location "/db-bin">                   <-- These bits tell Apache that
>     SetHandler      perl-script          <-- mod_perl is the handler and
>     PerlHandler     Apache::Registry <-- This bit tells mod_perl that it is
>     PerlSendHeader  On               to run sub handler in Apache/Registry.pm
>     Options         +ExecCGI 
>   </Location>
> 
> # <Location "/db-bin">                   <-- These bits tell Apache that
> #   SetHandler      perl-script          <-- mod_perl is the handler and
> #   PerlHandler     Apache::Footer   <-- This bit tells mod_perl that it is
> # </Location>                        to run sub handler in Apache/Footer.pm

You don't want both the bits above in the config file and uncommented.
They would give conflicting information to mod_perl about what is to
handle requests for resources from that Location.  It's a little bit
confusing that there are apparently two handlers.  The real handler as
far as Apache is concerned in a mod_perl system is in mod_perl.c which
Doug wrote.  But its job is just to pass control to a Perl subroutine
which you wrote.  By convention it is called `handler' but you can in
fact choose a different name if you tell mod_perl in the config.
Don't bother unless you have a good reason (like understanding what
the dickens is going on:).

> Specifically, the only module i've tried so far is the
> Footer.pm, and it in fact was installed into:
> /usr/local/apache/lib/perl/Apache.

Try putting 

use lib "/usr/local/apache/lib/perl/Apache";
print STDERR "Running startup.pl\n";

in the BEGIN block of your startup.pl so that you know it's getting
compiled.  

> I'm in the process of trying to understand why my "stuff" fails
> under "use strict;" (vars, redefined subroutines, etc.)

That a whole different can of worms.  You need to understand what the
symbol table is, what a package is, and the difference between normal
Perl variables and lexically scoped variables.  Amongst other things.
Way Off Topic for this list but mail me privately if you don't mind
waiting for your replies - I get a lot of mail and I'm very busy.

73,
Ged.