Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Will these functions for use with Storable properly lock my file?

by davido (Cardinal)
on Aug 03, 2021 at 15:33 UTC ( [id://11135582]=note: print w/replies, xml ) Need Help??


in reply to Will these functions for use with Storable properly lock my file?

Storable supports advisory locking out of the box:

# Advisory locking use Storable qw(lock_store lock_nstore lock_retrieve) lock_store \%table, 'file'; lock_nstore \%table, 'file'; $hashref = lock_retrieve('file');

This is from the Storable POD. Could you use these tools to handle locking for you?


Dave

  • Comment on Re: Will these functions for use with Storable properly lock my file?
  • Download Code

Replies are listed 'Best First'.
Re^2: Will these functions for use with Storable properly lock my file?
by nysus (Parson) on Aug 03, 2021 at 21:33 UTC

    I had initially tried using the locking functions provided with Storable. Maybe I wasn't using them properly but the processes stomped all over one another. That's when I did some searching and decided to try out a semaphore file instead.

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar";
    $nysus = $PM . ' ' . $MCF;
    Click here if you love Perl Monks

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2026-01-14 14:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (118 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.