Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: A flock question

by duelafn (Vicar)
on Oct 26, 2011 at 17:43 UTC ( #933953=note: print w/replies, xml ) Need Help??


in reply to A flock question

Disable warnings in the eval

#!/usr/bin/perl -w use strict; use warnings; use 5.010; use Fcntl qw/ O_WRONLY O_CREAT LOCK_EX LOCK_NB /; my $result = sysopen my $handle, "abc", O_WRONLY | O_CREAT; close $handle; eval { no warnings; $result = flock $handle, LOCK_EX | LOCK_NB }; if ($@) { say "------$@------"; } say "Done: ", $result ? "Success" : "Failed";

Good Day,
    Dean

Replies are listed 'Best First'.
Re^2: A flock question
by ikegami (Pope) on Oct 26, 2011 at 18:19 UTC
    no warnings 'closed';
    would be more appropriate.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://933953]
help
Chatterbox?
[haukex]: You can put it in SOPW, but use <readmore> tags
[haukex]: Also you might want to label it "code review"
[haukex]: Unless you have specific questions, in which case SSCCE's are much better
[cbeckley]: Excellent, thank you.
[cbeckley]: CUFP is more appropriate for stuff that's finished^h^h^h^h more advanced state of completeness?

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2017-03-24 15:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (304 votes). Check out past polls.