in reply to Time::Format string that works in cli crashes cgi

FWIW, your CGI-script works fine here: perl v5.10.0, openSuSE 11.1, Time::Format 1.09. Works both - with root and non-privileged users.

However, It seams that Time::Format is checking if an XS version is available. Maybe it is crashes while doing so or while doing the parsing later on?

# Here we go through a bunch of tests to decide whether we can use the # XS module, or if we need to load and compile the perl-only # subroutines (which are stored in __DATA__). my $load_perlonly = 0; $load_perlonly = 1 if defined $Time::Format::NOXS && $Time::Format: +:NOXS;
Maybe adding
... BEGIN { $Time::Format::NOXS=1; } use Time::Format; ...
to your CGI helps?

Update: forgot to add: while doing the parsing later on
Update2: clarified, that Time::Format::NOXS had to be set prior to using the module.
Update3: Now, since this experiment was successful, it seems that the problem is correlated with the usage of the XS based module (or something depending on that).
Things you could try:

Replies are listed 'Best First'.
Re^2: Time::Format string that works in cli crashes cgi
by leocharre (Priest) on Jan 07, 2009 at 21:57 UTC

    Thank you Perlbotics!

    I placed

    BEGIN{ $Time::Format:: NOXS=1;} use Time::Format;

    And now it works! Now.. I see your explanation.. but .. still.. this is cryptic as all heck..

    Why does this crash via cgi but not cli???

      The error log would have a clue, probably permissions.
Re^2: Time::Format string that works in cli crashes cgi
by leocharre (Priest) on Jan 07, 2009 at 21:16 UTC

    Thank you.. But.. nah.. didn't make it work.

    GNU/Linux 2.6.15 FC5, perl v5.8.8, Time::Format 1.09, Apache 2.2.0

    Really weird, I wouldn't wish this on anyone- it took me a while to find where the code was bonking.. I mean a while while.

    No message but 'premature end of script headers', maybe that string is somehow triggering a print to STDOUT - but I don't see a character in cli output..