.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Throwable 3pm" .TH Throwable 3pm "2023-09-26" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Throwable \- a role for classes that can be thrown .SH "VERSION" .IX Header "VERSION" version 1.001 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 4 \& package Redirect; \& # NOTE: Moo can also be used here instead of Moose \& use Moose; \& with \*(AqThrowable\*(Aq; \& \& has url => (is => \*(Aqro\*(Aq); .Ve .PP \&...then later... .PP .Vb 1 \& Redirect\->throw({ url => $url }); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Throwable is a role for classes that are meant to be thrown as exceptions to standard program flow. It is very simple and does only two things: saves any previous value for \f(CW$@\fR and calls \f(CW\*(C`die $self\*(C'\fR. .PP Throwable is implemented with Moo, so you can stick to Moo or use Moose, as you prefer. .SH "PERL VERSION" .IX Header "PERL VERSION" This library should run on perls released even a long time ago. It should work on any version of perl released in the last five years. .PP Although it may work on older versions of perl, no guarantee is made that the minimum required version will not be increased. The version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl. .SH "ATTRIBUTES" .IX Header "ATTRIBUTES" .SS "previous_exception" .IX Subsection "previous_exception" This attribute is created automatically, and stores the value of \f(CW$@\fR when the Throwable object is created. This is done on a \fIbest effort basis\fR. \f(CW$@\fR is subject to lots of spooky action-at-a-distance. For now, there are clearly ways that the previous exception could be lost. .SH "METHODS" .IX Header "METHODS" .SS "throw" .IX Subsection "throw" .Vb 1 \& Something::Throwable\->throw({ attr => $value }); .Ve .PP This method will call new, passing all arguments along to new, and will then use the created object as the only argument to \f(CW\*(C`die\*(C'\fR. .PP If called on an object that does Throwable, the object will be rethrown. .SS "new_with_previous" .IX Subsection "new_with_previous" .Vb 1 \& die Something::Throwable\->new_with_previous({ attr => $value }); .Ve .PP Constructs an exception object and return it, while trying to make sure that any values in $@ are safely stored in \f(CW\*(C`previous_exception\*(C'\fR without being stomped by evals in the construction process. .PP This is more reliable than calling \f(CW\*(C`new\*(C'\fR directly, but doesn't include the forced \f(CW\*(C`die\*(C'\fR in \f(CW\*(C`throw\*(C'\fR. .SH "AUTHORS" .IX Header "AUTHORS" .IP "\(bu" 4 Ricardo \s-1SIGNES\s0 .IP "\(bu" 4 Florian Ragwitz .SH "CONTRIBUTORS" .IX Header "CONTRIBUTORS" .IP "\(bu" 4 Arthur Axel 'fREW' Schmidt .IP "\(bu" 4 Brian Manning .IP "\(bu" 4 Brian Manning .IP "\(bu" 4 Christian Walde .IP "\(bu" 4 Dagfinn Ilmari Mannsåker .IP "\(bu" 4 Dave Rolsky .IP "\(bu" 4 David E. Wheeler .IP "\(bu" 4 Graham Knop .IP "\(bu" 4 Jeffrey Ryan Thalhammer .IP "\(bu" 4 Justin Hunter .IP "\(bu" 4 Matt S Trout .IP "\(bu" 4 Olaf Alders .IP "\(bu" 4 Ricardo Signes .IP "\(bu" 4 Toby Inkster .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2022 by Ricardo \s-1SIGNES.\s0 .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.