I'm sorry, Doctor, I wasn't clear enough. I only get the pain when I do *this*, ouch.

CGI scripts don't read input interactively from users so the "bug" here is your "bug" of trying to use CGI.pm along with stuff that clearly won't work in a CGI script.

No, I doubt CGI.pm is changing $/. Have you looked at the source code? My guess is that CGI.pm is doing binmode on STDIN (which it makes some sense for it to do).

Now, if you want to actually explain why you think it makes sense to combine CGI.pm with interactive input, for example, by telling us more about what you are trying to do, then we could probably tell you the proper way to prevent this problem.

No, setting $/ like you did is not the proper way, actually. Please take a look at what $/ is set to when you don't use CGI.pm. And try not to be confused by the unfortunate wording of perlport. :)

- tye        


In reply to Re^3: CGI, STDIN and chomp problem: bug? (input) by tye
in thread CGI, STDIN and chomp problem: bug? by Not_a_Number

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.