1Mojo::Exception(3) User Contributed Perl Documentation Mojo::Exception(3)
2
3
4
6 Mojo::Exception - Exceptions With Context
7
9 use Mojo::Exception;
10 my $e = Mojo::Exception->new;
11
13 Mojo::Exception is a container for exceptions with context information.
14
16 Mojo::Exception implements the following attributes.
17
18 "line"
19 my $line = $e->line;
20 $e = $e->line([3, 'foo']);
21
22 The line where the exception occured.
23
24 "lines_after"
25 my $lines = $e->lines_after;
26 $e = $e->lines_after([[1, 'bar'], [2, 'baz']]);
27
28 Lines after the line where the exception occured.
29
30 "lines_before"
31 my $lines = $e->lines_before;
32 $e = $e->lines_before([[4, 'bar'], [5, 'baz']]);
33
34 Lines before the line where the exception occured.
35
36 "message"
37 my $message = $e->message;
38 $e = $e->message('Oops!');
39
40 Exception message.
41
42 "raw_message"
43 my $message = $e->raw_message;
44 $e = $e->raw_message('Oops!');
45
46 Raw unprocessed exception message.
47
48 "verbose"
49 my $verbose = $e->verbose;
50 $e = $e->verbose(1);
51
52 Activate verbose rendering.
53
55 Mojo::Exception inherits all methods from Mojo::Base and implements the
56 following new ones.
57
58 "new"
59 my $e = Mojo::Exception->new('Oops!');
60 my $e = Mojo::Exception->new('Oops!', $file);
61
62 Construct a new Mojo::Exception object.
63
64 "to_string"
65 my $string = $e->to_string;
66 my $string = "$e";
67
68 Render exception with context.
69
71 Mojolicious, Mojolicious::Guides, <http://mojolicious.org>.
72
73
74
75perl v5.12.3 2010-08-12 Mojo::Exception(3)