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

Re^2: How do I tell if a handle is open for writing?

by dragonchild (Archbishop)
on Feb 28, 2006 at 18:38 UTC ( #533452=note: print w/ replies, xml ) Need Help??


in reply to Re: How do I tell if a handle is open for writing?
in thread How do I tell if a handle is open for writing?

I'm trying to extend this to a comparable readable() function.

sub readable { my $fh = shift; (O_RDONLY | O_RDWR) & fcntl( $fh, F_GETFL, my $slush); } for (qw/ > < >> +< +> /) { open my $fh, $_, 'foo' or warn $! and next; print "$_\t", readable($fh)? 'readable.': 'not readable.', $/; } __END__ > not readable. < not readable. >> not readable. +< readable. +> readable.
Huh??!

My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?


Comment on Re^2: How do I tell if a handle is open for writing?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (18)
As of 2014-04-16 15:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (432 votes), past polls