Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: open vs sysopen

by tomfahle (Priest)
on Jun 02, 2010 at 13:02 UTC ( #842755=note: print w/replies, xml ) Need Help??


in reply to open vs sysopen

As stated before sysopen comes with more precision than open.

sysopen helps avoiding race-conditions.

Consider the following snippet:

if (-e $file) { open(FH,">","$file") or die $!; }

It's a two step process:

  1. File test
  2. open

sysopen needs only one step (kind a simplistic, but you should get the message).

use Fcntl; sysopen(FH, $file, O_WRONLY|O_TRUNC|O_CREAT, 0600) or die $!;

HTH,
Thomas

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2016-09-28 07:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (520 votes). Check out past polls.