1Throwable(3) User Contributed Perl Documentation Throwable(3)
2
3
4
6 Throwable - a role for classes that can be thrown
7
9 version 0.102080
10
12 package Redirect;
13 use Moose;
14 with 'Throwable';
15
16 has url => (is => 'ro');
17
18 ...then later...
19
20 Redirect->throw({ url => $url });
21
23 Throwable is a role for classes that are meant to be thrown as
24 exceptions to standard program flow. It is very simple and does only
25 two things: saves any previous value for $@ and calls "die $self".
26
28 previous_exception
29 This attribute is created automatically, and stores the value of $@
30 when the Throwable object is created.
31
33 throw
34 Something::Throwable->throw({ attr => $value });
35
36 This method will call new, passing all arguments along to new, and will
37 then use the created object as the only argument to "die".
38
39 If called on an object that does Throwable, the object will be
40 rethrown.
41
43 · Ricardo SIGNES <rjbs@cpan.org>
44
45 · Florian Ragwitz <rafl@debian.org>
46
48 This software is copyright (c) 2010 by Ricardo SIGNES.
49
50 This is free software; you can redistribute it and/or modify it under
51 the same terms as the Perl 5 programming language system itself.
52
53
54
55perl v5.12.1 2010-07-27 Throwable(3)