Errno
Native Rust implementation built into the interpreter. Runtime: PP. See original documentation for the full Perl reference.
Provides system errno constants for Linux. In real Perl, Errno.pm is
auto-generated from system headers. We provide the same constants via
native Rust implementation using the libc crate.
The module exports constant subs like ENOENT(), EACCES(), etc. that
return the errno integer value. It also provides TIEHASH, FETCH,
STORE, EXISTS, FIRSTKEY, NEXTKEY methods for the %! tied hash.
Functions
EPERM, ENOENT, ESRCH, … (errno constants)
Each errno name is a constant sub returning its integer value.
Over 100 Linux errno constants are provided (see ERRNO_CONSTANTS).
use Errno qw(ENOENT EACCES);
if ($! == ENOENT) { ... }
EXISTS
Checks whether a given name is a known errno constant.
if (exists $!{ENOENT}) { ... }
FETCH
Looks up an errno constant by name through the tied %! hash.
my $val = $!{ENOENT}; # returns 2
FIRSTKEY
Returns the first errno constant name. Used by each %! and keys %!.
my $first = (keys %!)[0]; # "EPERM"
NEXTKEY
Returns the next errno constant name after a given key. Drives hash
iteration over %!.
while (my ($k, $v) = each %!) { ... }
TIEHASH
Ties the %! hash to the Errno module. Called implicitly by the runtime.
tie %!, 'Errno';