in reply to Re^2: CGI, STDIN and chomp problem: bug?
in thread CGI, STDIN and chomp problem: bug?

As was mentioned before, CGI scripts normally don't read from STDIN directly, so it's usually not a pressing issue, but I'd ask the CGI maintainer to localize $/ anyway before changing it.

If it's really a bug mainly depends on your definition of bug.

Replies are listed 'Best First'.
Re^4: CGI, STDIN and chomp problem: bug?
by Not_a_Number (Prior) on Jul 15, 2007 at 15:21 UTC
    I'd ask the CGI maintainer to localize $/ anyway before changing it...

    Actually, I took tye's advice above and looked at the CGI.pm source code. Unless I'm very much mistaken, $/ is modified only twice:

    1. On line 489:

    local($/) = "\n";

    where the change is safely localised within a sub, and

    2. On lines 3602-3607:

    my($old); ($old,$/) = ($/,$CRLF); # read a CRLF-delimited line # Some stuff $/ = $old; # restore old line separator

    where it is restored to its former value.

    So, as tye intimated, my problem seems to have nothing to do with the non-localisation of changes to $/ in CGI.pm.