Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: Can't decompress zlib compression stream with Compress:Zlib

by BrowserUk (Patriarch)
on Oct 04, 2016 at 12:26 UTC ( [id://1173245]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Can't decompress zlib compression stream with Compress:Zlib
in thread Can't decompress zlib compression stream with Compress:Zlib

I removed 'use strict' and 'use warnings' because they throw up a load of unrelated error messages

“Big mistake. Big. Huge. I have to go shopping now.” :)

The $y is a typo and should be $zlib.

Yup ... (not quite sure how 'y', is a "typo" of 'zlib'; but whatever...) Exactly (part of) what strict & warnings saves you from.

  • Comment on Re^3: Can't decompress zlib compression stream with Compress:Zlib

Replies are listed 'Best First'.
Re^4: Can't decompress zlib compression stream with Compress:Zlib
by Anonymous Monk on Oct 04, 2016 at 12:30 UTC

    Not such a big mistake, I hope.

    I can post a 5000-line script with 'use strict' or a 200-line script without it, but it won't get us any closer to discovering why Compress::Zlib->inflate does not work.

      Please try to work on your script and reduce it to the relevant 200 lines. Posting working code is highly important because the code is not just for our admiration but also so that we can run it locally to reproduce the situation and failure. If you require guesswork on our part, that makes it much more unlikely that we can reproduce your situation.

      Also, very often, while reducing your large script to a short, self-contained example, you find the source of your error yourself.

        Forgive me, but after switching the $y > $zlib typo, the script works (or doesn't work, in this case) exactly as intended. I'm running it in a terminal window right now.

        Does it not work for anyone else?

        Perhaps your meaning was something like 'please reduce Net::Telnet to the relevant 200 lines without remove use strict'.

        I'd be happy to be proven wrong, but I doubt that is possible.

      I can post a 5000-line script with 'use strict' or a 200-line script without it

      Are you seriously saying that you think it would require you to add 4800 lines -- +2500% -- to make your code strict and warnings compliant?

      If so, wow. Where on earth did you get such a grossly mistaken impression?

      Once I corrected s/$y/$zlib/, I ran perl -C on your code and got:

      C:\test>perl -c junk1.pl Global symbol "$EINTR" requires explicit package name at junk1.pl line + 133. Global symbol "$EINTR" requires explicit package name at junk1.pl line + 134. Global symbol "$EINTR" requires explicit package name at junk1.pl line + 177. Global symbol "$EINTR" requires explicit package name at junk1.pl line + 178. junk1.pl had compilation errors.

      So then I added our $EINTR; at the top and got:

      C:\test>perl -c junk1.pl junk1.pl syntax OK

      And if your response to corion is correct and making the first change (which strict & warnings would have found for you), and your code worked, then is typing one extra line to make your code S&M compliant too much work to save you "months" of frustration?


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
      In the absence of evidence, opinion is indistinguishable from prejudice.

        You seem to have misunderstood. To reduce 5000+ lines of code to 200, I used Net::Telnet as a base class, rather than including all 6168 lines of Net::Telnet code in my original post.

        I'm not the author of Net::Telnet, so I'm not in a position to easily explain its deficiencies, if any, if we add 'use' directives to the original code.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1173245]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-24 21:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found