=encoding euc-jp =head1 NAME =begin original Fatal - Replace functions with equivalents which succeed or die =end original Fatal - 関数を、成功しなければ die する等価物に置き換える =head1 SYNOPSIS use Fatal qw(open close); open(my $fh, "<", $filename); # No need to check errors! use File::Copy qw(move); use Fatal qw(move); move($file1, $file2); # No need to check errors! sub juggle { . . . } Fatal->import('juggle'); =head1 BEST PRACTICE =begin original B pragma.> Please use L in preference to C. L supports lexical scoping, throws real exception objects, and provides much nicer error messages. =end original B プラグマによって古いものになりました。> C よりも L を使ってください。 L はレキシカルスコープに対応し、実例外オブジェクトを投げ、 遥かによいエラーメッセージを提供します。 =begin original The use of C<:void> with Fatal is discouraged. =end original Fatal での C<:void> の仕様は非推奨です。 =head1 DESCRIPTION =begin original C provides a way to conveniently replace functions which normally return a false value when they fail with equivalents which raise exceptions if they are not successful. This lets you use these functions without having to test their return values explicitly on each call. Exceptions can be caught using C. See L and L for details. =end original C provides a way to conveniently replace functions which normally return a false value when they fail with equivalents which raise exceptions if they are not successful. This lets you use these functions without having to test their return values explicitly on each call. Exceptions can be caught using C. See L and L for details. (TBT) =begin original The do-or-die equivalents are set up simply by calling Fatal's C routine, passing it the names of the functions to be replaced. You may wrap both user-defined functions and overridable CORE operators (except C, C, C, or any other built-in that cannot be expressed via prototypes) in this way. =end original The do-or-die equivalents are set up simply by calling Fatal's C routine, passing it the names of the functions to be replaced. You may wrap both user-defined functions and overridable CORE operators (except C, C, C, or any other built-in that cannot be expressed via prototypes) in this way. (TBT) =begin original If the symbol C<:void> appears in the import list, then functions named later in that import list raise an exception only when these are called in void context--that is, when their return values are ignored. For example =end original If the symbol C<:void> appears in the import list, then functions named later in that import list raise an exception only when these are called in void context--that is, when their return values are ignored. For example (TBT) use Fatal qw/:void open close/; # properly checked, so no exception raised on error if (not open(my $fh, '<', '/bogotic') { warn "Can't open /bogotic: $!"; } # not checked, so error raises an exception close FH; =begin original The use of C<:void> is discouraged, as it can result in exceptions not being thrown if you I call a method without void context. Use L instead if you need to be able to disable autodying/Fatal behaviour for a small block of code. =end original The use of C<:void> is discouraged, as it can result in exceptions not being thrown if you I call a method without void context. Use L instead if you need to be able to disable autodying/Fatal behaviour for a small block of code. (TBT) =head1 DIAGNOSTICS =over 4 =item Bad subroutine name for Fatal: %s =begin original You've called C with an argument that doesn't look like a subroutine name, nor a switch that this version of Fatal understands. =end original You've called C with an argument that doesn't look like a subroutine name, nor a switch that this version of Fatal understands. (TBT) =item %s is not a Perl subroutine =begin original You've asked C to try and replace a subroutine which does not exist, or has not yet been defined. =end original You've asked C to try and replace a subroutine which does not exist, or has not yet been defined. (TBT) =item %s is neither a builtin, nor a Perl subroutine =begin original You've asked C to replace a subroutine, but it's not a Perl built-in, and C couldn't find it as a regular subroutine. It either doesn't exist or has not yet been defined. =end original You've asked C to replace a subroutine, but it's not a Perl built-in, and C couldn't find it as a regular subroutine. It either doesn't exist or has not yet been defined. (TBT) =item Cannot make the non-overridable %s fatal =begin original You've tried to use C on a Perl built-in that can't be overridden, such as C or C, which means that C can't help you, although some other modules might. See the L section of this documentation. =end original You've tried to use C on a Perl built-in that can't be overridden, such as C or C, which means that C can't help you, although some other modules might. See the L section of this documentation. (TBT) =item Internal error: %s =begin original You've found a bug in C. Please report it using the C command. =end original You've found a bug in C. Please report it using the C command. (TBT) =back =head1 BUGS =begin original C clobbers the context in which a function is called and always makes it a scalar context, except when the C<:void> tag is used. This problem does not exist in L. =end original C clobbers the context in which a function is called and always makes it a scalar context, except when the C<:void> tag is used. This problem does not exist in L. (TBT) =begin original "Used only once" warnings can be generated when C or C is used with package filehandles (eg, C). It's strongly recommended you use scalar filehandles instead. =end original "Used only once" warnings can be generated when C or C is used with package filehandles (eg, C). It's strongly recommended you use scalar filehandles instead. (TBT) =head1 AUTHOR =begin original Original module by Lionel Cons (CERN). =end original 元のモジュールは Lionel Cons (CERN)。 =begin original Prototype updates by Ilya Zakharevich . =end original プロトタイプの更新は Ilya Zakharevich 。 =begin original L support, bugfixes, extended diagnostics, C support, and major overhauling by Paul Fenwick =end original L 対応、バグ修正、診断メッセージの拡張、C 対応、 大幅なオーバーホールは Paul Fenwick 。 =head1 LICENSE This module is free software, you may distribute it under the same terms as Perl itself. =head1 SEE ALSO =begin original L for a nicer way to use lexical Fatal. =end original レキシカルに Fatal をつかうよりよい方法である L。 =begin original L for a similar idea for calls to C and backticks. =end original C と逆クォートに関する似たようなアイデアである L。 =cut