Mail::...:POSIX(3pm)

πŸ’– Mail::...:POSIX β€” the manual, but make it make sense πŸ’–

okay bestie, welcome to the Mail::...:POSIX page from User Contributed Perl Documentation. yes the title is literally abbreviated like that, no I will not be explaining why. let's get into it πŸŽ€


✨ NAME ✨

Mail::Box::Locker::POSIX β€” lock a folder using kernel file-locking 🫢


πŸ‘‘ INHERITANCE πŸ‘‘

Mail::Box::Locker::POSIX
  is a Mail::Box::Locker
  is a Mail::Reporter

so it's giving nepo baby but in the cute way, the lineage is real πŸ’…


⭐ SYNOPSIS ⭐

See Mail::Box::Locker

that's it. that's the synopsis. go read the parent, the parent ate πŸ’€


🌸 DESCRIPTION 🌸

so basically, this locker object gets made by the folder to grab an exclusive lock on the file that holds the data, and it does that using the kernel's POSIX facilities. the lock lives on a separate file-handle to the folder file β€” NOT the handle that's actually reading. main character lock, different handle, no crossover ✨

WARNING: not all platforms support POSIX locking (via fcntl) and even the ones that do, they don't all do it the same way. this implementation does not use XS to access the structure of fcntl(). it is better to use the ::FcntlLock which does. and no, this implementation doesn't know the struct either β€” it "guesses" the location of the bytes. guessing. the bytes. ma'am. 😭

Extends "DESCRIPTION" in Mail::Box::Locker.


πŸ’… METHODS πŸ’…

Extends "METHODS" in Mail::Box::Locker.


πŸŽ€ Constructors πŸŽ€

Extends "Constructors" in Mail::Box::Locker.

$class->new(%options)

Inherited, see "METHODS" in Mail::Box::Locker.

here's the option rundown, with where each one comes from and what it defaults to:

  • expires β€” defined in Mail::Box::Locker β€” default 1 hour
  • file β€” defined in Mail::Box::Locker β€” default undef
  • folder β€” defined in Mail::Box::Locker β€” default <C<undef>>
  • method β€” defined in Mail::Box::Locker β€” default POSIX
  • posix_file β€” no parent listed β€” default <C<undef>>
  • timeout β€” defined in Mail::Box::Locker β€” default 10

and now the options themselves, one by one, no skipping, we don't do that here 🫢

  • expires => $seconds
  • file => $file
  • folder => $folder
  • method => $name|CLASS|\@names
  • posix_file => FILENAME β€” Alternative name for "file", especially useful to avoid confusion when the multi-locker is used.
  • timeout => $seconds|'NOTIMEOUT'

πŸ¦‹ Attributes πŸ¦‹

Extends "Attributes" in Mail::Box::Locker.

  • $obj->expires( [SECONDS] ) β€” Inherited, see "Attributes" in Mail::Box::Locker
  • $obj->filename( [$filename] ) β€” Inherited, see "Attributes" in Mail::Box::Locker
  • $obj->folder( [$folder] ) β€” Inherited, see "Attributes" in Mail::Box::Locker
  • $obj->name() β€” Inherited, see "Attributes" in Mail::Box::Locker
  • $obj->timeout( [SECONDS] ) β€” Inherited, see "Attributes" in Mail::Box::Locker

πŸ”’ Locking πŸ”’

Extends "Locking" in Mail::Box::Locker.

  • $obj->hasLock() β€” Inherited, see "Locking" in Mail::Box::Locker
  • $obj->isLocked() β€” Inherited, see "Locking" in Mail::Box::Locker
  • $obj->lock() β€” Inherited, see "Locking" in Mail::Box::Locker
  • $obj->unlock() β€” Inherited, see "Locking" in Mail::Box::Locker

πŸ™ˆ Error handling πŸ™ˆ

Extends "Error handling" in Mail::Box::Locker.

  • $obj->AUTOLOAD() β€” Inherited, see "Error handling" in Mail::Reporter
  • $obj->notImplemented() β€” Inherited, see "Error handling" in Mail::Reporter

🧹 Cleanup 🧹

Extends "Cleanup" in Mail::Box::Locker.

  • $obj->DESTROY() β€” Inherited, see "Cleanup" in Mail::Box::Locker

🚨 DIAGNOSTICS 🚨

Error: class $package does not implement method $method. Fatal error: the specific $package (or one of its superclasses) does not implement this method where it should. This message means that some other related classes do implement this method however the class at hand does not. Probably you should investigate this and probably inform the author of the package. Cast by notImplemented()

Warning: folder $name already lockf'd. Cast by lock()

Fault: unable to check lock file $file for $folder: $! To check whether the $file is used to flock a $folder, the file must be opened. Apparently this fails, which does not mean that the folder is locked neither that it is unlocked. Cast by isLocked()

Fault: unable to open POSIX lock file $file for $folder: $! For POSIX style locking, a $folder it must be opened, which does not succeed for the specified reason. Cast by lock()

Fault: will never get a POSIX lock at $file for $folder: $! Tried to lock the $folder, but it did not succeed. The error code received from the OS indicates that it will not succeed ever, so we do not need to try again. Cast by lock()


🌈 SEE ALSO 🌈

This module is part of Mail-Box version 4.02, built on April 10, 2026. Website: http://perl.overmeer.net/CPAN/


πŸ’œ LICENSE πŸ’œ

For contributors see file ChangeLog.

This software is copyright (c) 2001-2026 by Mark Overmeer.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.


and that's the whole page bestie, you read all of it, slay πŸŽ€ the source on this one is perl v5.40.1 and it's dated 2026-05-09 β€” go forth and lock responsibly, ily πŸ’–βœ¨

πŸ“¦ where this page comes from