suaveant has asked for the wisdom of the Perl Monks concerning the following question:

Ok... this is one of the strangest problems I have ever run across.

I have an in-house fastcgi-type code all in perl.
When the environment data has been gathered from the incoming call I assign it to the local environment with the code %ENV = %env I am running across a problem where ONE of the fastcgis fails from this. But it is not this directly... any IO that happens afterwards seems to end the program, with an exit value of 512 (2). A print to STDOUT dead. A file open, dead. Nedermeyer, DEAD!

Does anybody have any idea what the heck could be causing this? If I remove the ENV line, it works, if I change it to a for loop assignment, this FCGI succeeds, but another fails.

And WHERE is the exit value of 2 coming from?

Can anyone point me in a direction to start?

                - Ant
                - Some of my best work - (1 2 3)

Replies are listed 'Best First'.
Re: %ENV problem?
by ikegami (Patriarch) on Aug 26, 2004 at 21:06 UTC
    And WHERE is the exit value of 2 coming from?
    That's the exit value die() sets. Have you checked your error logs for a die() message?
      Haha.. duh. The thing that was really screwing me up was that I redirect STDERR through the log function that was dying...

      Also, the die message was screwed up, didn't display the line number or anything, so it was throwing me off.

      Thanks, that let me find it.

                      - Ant
                      - Some of my best work - (1 2 3)

        If the text message for the die command ends with a newline, it won't print out a line number. Consider the following:
        #!/usr/bin/perl if (@ARGV) { die "There was a command line parameter"; } else { die "No command line stuff here.\n"; }

        When called with perl filename.pl the message is "No command line stuff here." When called with perl filename.pl foo the output is "There was a command line parameter at filename.pl line 4."