Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I was surprised by my test results on Travis-CI, where my module failed on 5.16, 5.18, and 5.20, but not on the versions above or below those.

Doing some digging, it's because of the way that stat works on an in-memory filehandle: on most versions, it gives a warning in the unopened subcategory of the io warnings category, so I set up my module to trap on that warning, and die with a more meaningful message to the end-user, which should help them avoid the problem. But when it ran on multiple versions on Travis-CI, I found that 5.16-5.20 apparently do not give that (or any) warning, but still result in the empty list for the in-memory filehandle.

The issue can be simply replicated with the one-liner SSCCE (shown in both windows/berrybrew and linux/perlbrew) in the spoiler below.

I found a workaround (see second spoiler below), but I was curious, so I skimmed the perldelta for 5.16 and 5.22, but couldn't find a mention of the unopened-filehandle warning changing in either of those versions. So I guess the wisdom I am seeking: does anyone have insight as to why the warning disappeared in 5.16, but came back in 5.22? Was it intentional (and if so, why try removing it, and why re-instate it)? Or was it an accidental bug (if so, why wasn't it mentioned, or did I just not notice)?

*workaround =

And thank you: while working on the earlier issues -- figuring out that in-memory filehandle's don't stat right, but give the misleading "unopened filehandle" warning, even though Scalar::Util::openhandle() shows it as open; and trying to get the __WARN__ handler correct -- I thought I was going to need to SoPW, but developing a SSCCE showed me the problem. So thanks for the Rubber duck that you didn't even know you provided, too. :-)


In reply to stat on in-memory filehandle warns inconsistently across perl versions by pryrt

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-03-28 17:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found