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

This is a discussion on Apache: Perl's @INC as seen by CGI script? within the Linux Web Servers forums, part of the Web Server and Related Forums category; This is a question about Apache and the Perl variable @INC. A CGI script, when it is run in the &...


Go Back   Usenet Forums > Web Server and Related Forums > Linux Web Servers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-26-2004
bill
 
Posts: n/a
Default Apache: Perl's @INC as seen by CGI script?




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
  #2 (permalink)  
Old 05-29-2004
David Efflandt
 
Posts: n/a
Default Re: Apache: Perl's @INC as seen by CGI script?

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/
  #3 (permalink)  
Old 06-02-2004
Dan Wilga
 
Posts: n/a
Default Re: Apache: Perl's @INC as seen by CGI script?

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 **
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:06 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0