1PPI::Exception(3) User Contributed Perl Documentation PPI::Exception(3)
2
3
4
6 PPI::Exception - The PPI exception base class
7
9 use PPI::Exception;
10
11 my $e = PPI::Exception->new( 'something happened' );
12 $e->throw;
13
14 PPI::Exception->new( message => 'something happened' )->throw;
15 PPI::Exception->throw( message => 'something happened' );
16
18 All exceptions thrown from within PPI will be instances or derivations
19 of this class.
20
22 new $message | message => $message, ...
23 Constructs and returns a new "PPI::Exception" object.
24
25 A message for the exception can be passed, either as a string or as
26 "message => $message". The message is available via the "message"
27 method.
28
29 throw
30 If called on a "PPI::Exception" object, throws the object. If called
31 on the class name, uses the arguments to construct a "PPI::Exception"
32 and then throw it.
33
34 Each time the object is thrown, information from the Perl <caller(0)>
35 call is saved and made available via the "callers" method.
36
37 This method never returns.
38
39 message
40 Returns the exception message passed to the object's constructor, or a
41 default message.
42
43 callers
44 Returns a listref, each element of which is a listref of caller(0)
45 information. The returned listref can be empty.
46
47
48
49perl v5.38.0 2023-09-22 PPI::Exception(3)