line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
OpenFrame::WebApp::Error - base class for WebApp Errors. |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 SYNOPSIS |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# meant to be sub-classed: |
8
|
|
|
|
|
|
|
use OpenFrame::WebApp::Error::SomeClass; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# should export some error flags to your namespace |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use Error qw( :try ); |
13
|
|
|
|
|
|
|
try { |
14
|
|
|
|
|
|
|
throw OpenFrame::WebApp::Error::SomeClass( flag => eSomeError ); |
15
|
|
|
|
|
|
|
} catch OpenFrame::WebApp::Error::SomeClass with { |
16
|
|
|
|
|
|
|
my $e = shift; |
17
|
|
|
|
|
|
|
do { ... } if ($e->flag == eSomeError); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
package OpenFrame::WebApp::Error; |
24
|
|
|
|
|
|
|
|
25
|
3
|
|
|
3
|
|
27340
|
use utf8; |
|
3
|
|
|
|
|
12
|
|
|
3
|
|
|
|
|
22
|
|
26
|
3
|
|
|
3
|
|
80
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
89
|
|
27
|
3
|
|
|
3
|
|
13
|
use warnings::register; |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
411
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
our $VERSION = (split(/ /, ' $Revision: 1.3 $ '))[2]; |
30
|
|
|
|
|
|
|
|
31
|
3
|
|
|
3
|
|
15
|
use base qw( Error ); |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
678
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub new { |
34
|
2
|
|
|
2
|
1
|
55
|
my $class = shift; |
35
|
2
|
|
|
|
|
4
|
local $Error::Depth = $Error::Depth + 1; |
36
|
2
|
100
|
|
|
|
16
|
$class->SUPER::new(map { /^\-?flag$/ ? '-text' : $_; } @_); |
|
2
|
|
|
|
|
14
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# store flag in '-text' as it's hard-coded into Error.pm |
40
|
|
|
|
|
|
|
sub flag { |
41
|
3
|
|
|
3
|
1
|
1008
|
my $self = shift; |
42
|
3
|
100
|
|
|
|
9
|
if (@_) { |
43
|
1
|
|
|
|
|
4
|
$self->{-text} = shift; |
44
|
1
|
|
|
|
|
6
|
return $self; |
45
|
|
|
|
|
|
|
} else { |
46
|
2
|
|
|
|
|
13
|
return $self->{-text}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |