Hi,
I am trying to "clean up" some code using perlcritc and am running across the error that one should use the 3 argument version of open().

Generally this is pretty straight forward except in this case:

if (! open ($XML, "xsltproc $xslt $controlFile|")) { .... }
I know what is going on, xsltproc converts the file pointed to be $controlFile, this goes to stdout and the "|" at the end redirects, such that I end up with $XML being a file handle pointing to the converted file content.

Now the not so pretty version of this would be for me to call xlstproc and send the output to a temporary file and then use the temporary file in an open statement with 3 arguments. However, I am thinking there is a more compact way of doing this that appeases perlcritic and does not require me to write a temporary file to disk.


Help is appreciated.
Thanks,
Robert

In reply to clean up to PBP for open by rjschwei

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.