Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Urgent Help required with PERL CGI

by Anonymous Monk
on Dec 24, 2012 at 13:23 UTC ( #1010187=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am writing a CGI script.. When i run it through web browser, The values of variables present in my environment doesn't appear.. How to get the value of my local (not cgi variables) variables displayed through browser.

Comment on Urgent Help required with PERL CGI
Re: Urgent Help required with PERL CGI
by Corion (Pope) on Dec 24, 2012 at 13:27 UTC

    Your web server is running your CGI script as a different user than "your user", and/or it does not set up your login environment.

    Also see Get default login environment and the discussion that follows it.

      Can you elaborate more.. On luking the discussion u suggested ,n running first script there, got my boot_server as dd851c2n10.. Please elaborate more n provide me the solution. Very tired of trying all possible things

        You don't tell us what things you tried and how they failed for you. Also, you don't tell us what relevance boot_server has.

        Maybe you want to read the whole referenced thread to learn how to import values from a shell script into your Perl script? As an alternative, you can make your webserver launch a shell script which sets up your environment and then executes your Perl CGI script.

Re: Urgent Help required with PERL CGI
by blue_cowdawg (Monsignor) on Dec 24, 2012 at 15:46 UTC
        The values of variables present in my environment doesn't appear.. How to get the value of my local (not cgi variables) variables displayed through browser.

    This comes as no surprise to me and as Corion and others have pointed out CGI usually runs as its own userid. For instance on Apache based web environments the userid can be one of but not limited to:

    • apache
    • httpd
    • web
    • www
    • www-data
    • www-user
    • nobody
    • noaccess
    • nofiles
    with the last three given in descending order of likelihood in my experience. My own hosting environment that I rent out uses the same account as the person renting space. Makes my life much easier.

    My advise to you is to never count on your personal account's environment to be available to you in a CGI script. When writing CGI I either hardcode what I need (not the ideal) or I set up a configuration file (better) with what I need. If you use FindBin to find where the script is running from and if your configuration file is in a directory related to where the script is being run you can easily open that configuration file and populate what you need to run the CGI.

    Hope this helps...


    Peter L. Berghold -- Unix Professional
    Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg
Re: Urgent Help required with PERL CGI
by Anonymous Monk on Dec 24, 2012 at 21:07 UTC
    The monastery needs a troll filter with any node containing the words "urgent help" sent to /dev/null.
      It does have a troll filter - the original person who approved it, and Consider requests.
      A Monk aims to give answers to those who have none, and to learn from those who know more.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1010187]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (11)
As of 2014-09-16 16:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (33 votes), past polls