Web Servers on Unix and Linux - Apache: Perl's @INC as seen by CGI script?

This is Interesting: Free IT Magazines  
Home > Archive > Web Servers on Unix and Linux > June 2004 > Apache: Perl's @INC as seen by CGI script?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Apache: Perl's @INC as seen by CGI script?
bill

2004-05-30, 10:48 am




This is a question about Apache and the PERL variable @INC.

A CGI script, when it is run in the "usual" way (i.e. some usually
remote client requests it through some server), generally sees a
different environment from what the same script would see if one were
to run it locally via the command line. Therefore, the results of the
local command

% PERL -le 'print "@INC"'

most likely would not reflect the PERL variable @INC that a CGI
script actually sees during usual operation.

One way to get the desired @INC would be to write a brief CGI script
that prints out "@INC", and point one's browser to this script.

But is there a direct way to get the same information locally from
the (Apache) webserver?

Thank you much!

-bill
David Efflandt

2004-05-30, 10:48 am

On Wed, 26 May 2004 19:46:36 +0000 (UTC), bill <please_post@nomail.edu> wrote:
>
> This is a question about Apache and the PERL variable @INC.
>
> A CGI script, when it is run in the "usual" way (i.e. some usually
> remote client requests it through some server), generally sees a
> different environment from what the same script would see if one were
> to run it locally via the command line. Therefore, the results of the
> local command
>
> % PERL -le 'print "@INC"'
>
> most likely would not reflect the PERL variable @INC that a CGI
> script actually sees during usual operation.
>
> One way to get the desired @INC would be to write a brief CGI script
> that prints out "@INC", and point one's browser to this script.
>
> But is there a direct way to get the same information locally from
> the (Apache) webserver?


Probably IF you can log onto the actual apache server. What might not be
apparent is that your web directories may be remote mounted on it, and you
may not have login access to the apache box itself.

We ran into something like that when my ISP added a newer version of Perl
at /usr/bin/perl (with older version at /usr/local/bin/perl) and we
compiled SpamAssassin to use that PERL (/usr/bin/perl Makefile.PL ...).
SpamAssassin running in our home dir remote mounted on smtp server would
not work for actual mail, until newer PERL was added to the smtp server.

--
David Efflandt - All spam ignored http://www.de-srv.com/
Dan Wilga

2004-06-02, 11:13 am

On Wed, 26 May 2004 19:46:36 +0000 (UTC), bill <please_post@nomail.edu>
wrote:
>
> This is a question about Apache and the PERL variable @INC.
>
> A CGI script, when it is run in the "usual" way (i.e. some usually
> remote client requests it through some server), generally sees a
> different environment from what the same script would see if one were
> to run it locally via the command line. Therefore, the results of the
> local command
>
> % PERL -le 'print "@INC"'
>
> most likely would not reflect the PERL variable @INC that a CGI
> script actually sees during usual operation.
>
> One way to get the desired @INC would be to write a brief CGI script
> that prints out "@INC", and point one's browser to this script.
>
> But is there a direct way to get the same information locally from
> the (Apache) webserver?


If you have your server set up to use the perl-status module part of
mod_perl, you can use:

http://yourserver.com/perl-status?inc

and @INC appears at the bottom of the page. Otherwise, try this CGI
script (untested):

#!/usr/bin/perl

$inc = join( "\n", @INC );
print "Status: 200\nContent-type: text/plain\n\n$inc";

--
Dan Wilga dwilga-MUNGE@mtholyoke.edu
** Remove the -MUNGE in my address to reply **
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com