I'm sorry, but your english is hard to understand. Let me re-phrase, and you tell me if I have misinterpreted anything.
You have a perl program that needs to extract some information from the beginning of a file in a .zip. As this script is on a production system, you cannot install additional modules that might make this easier. The script as written passes perlcritic, but dies on the croak line for the pipe close. Removing the croak statement (obviously) makes the error disappear, but then it won't pass perlcritic. You believe that the code as written results in a memory leak of some sort, apparent when a large (>10GB) is being unzipped. Does this sound correct?
Given your source (thank you for formatting it properly), I have a couple of general comments:
- In your croak statement, you should be using $!, not $ERRNO. This should give you more info on why the close is failing
- Unfortunately, $! will only give you the error associated with the close. unzip uses its exit status to identify any reason it had for failure, but I don't think you can get this from the close
- You do realize that by using -c instead of -p, it will print the file name before it prints the file data? Your parsing routine does not seem to take this into account.
fnord
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.