Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Distinguishing a filehandle for an in-memory string

by ikegami (Pope)
on May 18, 2018 at 03:34 UTC ( #1214811=note: print w/replies, xml ) Need Help??


in reply to Distinguishing a filehandle for an in-memory string

What you want to know is whether it's a system file handle or not. You can use fileno for that. It returns -1 for file handles that aren't system file handles (such as the in-memory string handles).

  • Comment on Re: Distinguishing a filehandle for an in-memory string

Replies are listed 'Best First'.
Re^2: Distinguishing a filehandle for an in-memory string
by jrw (Monk) on May 18, 2018 at 11:36 UTC
    I noticed this, but I saw somewhere in a comment or in some piece of documentation that it says something like "currently returns -1", which made me think that that is not a reliable way to check. But maybe it's as reliable as checking for "scalar" in the list of IO layers?

      Checking for an in-memory handle is not what you want to check for. It's only one kind of Perl file handle that's not a system file handle.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2020-12-01 00:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?