File::...process(3pm)
okay bestie, welcome to File::...process(3pm) β the page from User Contributed Perl Documentation. She's a little Perl module with big main-character energy, and we're gonna get you fluent in her whole deal. π
β¨
π NAME π
File::Flock::Subprocess β file locking with flock in a subprocess. That's the whole vibe: flock locking, but the locking lives in a subprocess. π¦
β¨ SYNOPSIS β¨
Here's the demo reel, exactly as written β no cap, every call is here:
use File::Flock::Subprocess;
lock($filename);
lock($filename, 'shared');
lock($filename, undef, 'nonblocking');
lock($filename, 'shared', 'nonblocking');
unlock($filename);
lock_rename($oldfilename, $newfilename)
my $lock = new File::Flock '/somefile';
$lock->unlock();
$lock->lock_rename('/new/file');
forget_locks();
That's use File::Flock::Subprocess;, then all the locking, unlocking, rename, and forget-locks moves. π
πΈ DESCRIPTION πΈ
okay so the tea is: this module is a wrapper around File::Flock that starts a subprocess and does the locking in the subprocess with File::Flock. The whole point? To handle operating systems (eg: Solaris) that do not retain locks across a call to fork(). Literally iconic problem-solving. π
Here's the part to keep on your radar: the sub-process for this is created with fork() when File::Flock::Subprocess is compiled. The author tried to minimize the side-effects of calling fork() by calling it early and by using POSIX::_exit() to quit, but it is still worth being aware of. So yeah β lowkey important. The author suggests loading File::Flock::Subprocess early. π«Ά
Want it to auto-detect when this is needed? Use File::Flock::Forking. For the details of the API, read the docs for File::Flock. iykyk. π
π«Ά ERRATA π«Ά
Any errors reported by the locking proxy that File::Flock::Subprocess starts will be reported as "Compilation Failed" errors because the proxy is started in a BEGIN{} block. So if you see that, don't panic β it's the proxy being a little extra at compile time. π
π LICENSE π
Copyright (C) 2013 Google, Inc. This module may be used/copied/etc on the same terms as Perl itself. That's the legal tea, bestie β short and sweet. π
Catch you later! This page is from perl v5.42.0, dated 2015-04-17, and its manual name is File::...process(3pm). Byeee ππ
π¦ where this page comes from
- opensuse-leap 16.0: perl-File-Flock 2014.01-bp160.1.11 Β· Artistic-1.0 or GPL-1.0+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms