NAME
Errno::AnyString - put arbitrary strings in $!
VERSION
Version 0.01
SYNOPSIS
use Errno qw/ENOENT/;
use Errno::AnyString;
$! = "--my hovercraft is full of eels";
my $s = "$!"; # $s now contains "my hovercraft is full of eels"
open my $fh, "<", "/no/such/file";
$s = "$!"; # $s now contains "no such file or directory"
$! = "--the bells the bells";
my $s = "$!"; # $s now contains "the bells the bells"
my $saved_errno = $!;
$! = ENOENT;
$s = "$!"; # $s now contains "no such file or directory"
$! = $saved_errno;
$s = "$!"; # $s now contains "the bells the bells"
DESCRIPTION
Errno::AnyString
allows you to place an arbitrary error message in the special $!
variable, without disrupting $!
's ability to pick up the result of the next system call that sets errno
.
It is useful if you are writing code that reports errors by setting $!
, and none of the standard system error messages fit.
If Errno::AnyString
is loaded, $!
behaves as normal unless a custom error string has been set by assigning a string starting with --
to $!
. If a custom error string is set, it will be returned when $!
is evaluated as a string, and 458513437 will be returned when $!
is evaluated as a number, see ERRSTR_SET
below.
EXPORTS
Nothing is exported by default. The following are available for export.
ERRSTR_SET
ERRSTR_SET
is a numeric constant with the value 458513437. This is the value that will be obtained when $!
is evaluated in a numeric context while a custom error string is set.
AUTHOR
Dave Taylor, <dave.taylor.cpan at gmail.com>
BUGS AND LIMITATIONS
Please report any bugs or feature requests to bug- at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Errno::AnyString. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Errno::AnyString
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
SEE ALSO
COPYRIGHT & LICENSE
Copyright 2009 Dave Taylor, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.