line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Haineko::E; |
2
|
1
|
|
|
1
|
|
133651
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
50
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
4
|
1
|
|
|
1
|
|
1070
|
use Class::Accessor::Lite; |
|
1
|
|
|
|
|
1362
|
|
|
1
|
|
|
|
|
8
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
my $rwaccessors = [ |
7
|
|
|
|
|
|
|
'file', # (String) Path to the module file which an error occurred. |
8
|
|
|
|
|
|
|
'line', # (Integer) line number |
9
|
|
|
|
|
|
|
'mesg', # (ArrayRef) Reply messages |
10
|
|
|
|
|
|
|
]; |
11
|
|
|
|
|
|
|
my $roaccessors = []; |
12
|
|
|
|
|
|
|
my $woaccessors = []; |
13
|
|
|
|
|
|
|
Class::Accessor::Lite->mk_accessors( @$rwaccessors ); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
16
|
6
|
|
|
6
|
1
|
16633
|
my $class = shift; |
17
|
6
|
|
100
|
|
|
28
|
my $argvs = shift || return undef; |
18
|
5
|
|
|
|
|
28
|
my $param = { |
19
|
|
|
|
|
|
|
'file' => undef, |
20
|
|
|
|
|
|
|
'line' => undef, |
21
|
|
|
|
|
|
|
'mesg' => [], |
22
|
|
|
|
|
|
|
}; |
23
|
5
|
|
|
|
|
18
|
chomp $argvs; |
24
|
|
|
|
|
|
|
|
25
|
5
|
100
|
|
|
|
60
|
if( $argvs =~ m|\A(.+)\s+at\s+(.+)\s+line\s+(\d+)[.]\z| ) { |
26
|
|
|
|
|
|
|
# Error message at /path/to/file line 22. |
27
|
4
|
|
|
|
|
20
|
$param->{'file'} = $2; |
28
|
4
|
|
|
|
|
11
|
$param->{'line'} = $3; |
29
|
4
|
|
|
|
|
15
|
$param->{'mesg'} = __PACKAGE__->p( $1 ); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
} else { |
32
|
1
|
|
|
|
|
4
|
my $c = [ caller ]; |
33
|
1
|
|
|
|
|
3
|
$param->{'file'} = $c->[1]; |
34
|
1
|
|
|
|
|
3
|
$param->{'line'} = $c->[2]; |
35
|
1
|
|
|
|
|
4
|
$param->{'mesg'} = __PACKAGE__->p( $1 ); |
36
|
|
|
|
|
|
|
} |
37
|
5
|
|
|
|
|
84
|
return bless $param, __PACKAGE__; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub p { |
41
|
6
|
|
|
6
|
0
|
9
|
my $class = shift; |
42
|
6
|
|
100
|
|
|
29
|
my $argvs = shift || return []; |
43
|
4
|
|
|
|
|
21
|
my $error = []; |
44
|
|
|
|
|
|
|
|
45
|
4
|
|
|
|
|
9
|
chomp $argvs; |
46
|
4
|
100
|
|
|
|
25
|
if( $argvs =~ m|\A(Can't locate .+\s)(in\s[@]INC\s.+)\z| ) { |
47
|
|
|
|
|
|
|
# Can\'t locate Haineko/SMTPD/Relay/Neko.pm in @INC (@INC contains: /tmp...) |
48
|
1
|
|
|
|
|
5
|
$error = [ $1, $2 ]; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
} else { |
51
|
3
|
|
|
|
|
41
|
$error = [ split( "\n", $argvs ) ]; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
4
|
|
|
|
|
13
|
for my $e ( @$error ) { |
55
|
5
|
|
|
|
|
21
|
$e =~ s|\A\s*||; |
56
|
5
|
|
|
|
|
165
|
$e =~ s|\s*\z||; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
4
|
|
|
|
|
13
|
return $error; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub message { |
63
|
8
|
|
|
8
|
1
|
31988
|
my $self = shift; |
64
|
8
|
|
|
|
|
23
|
my $mesg = q(); |
65
|
|
|
|
|
|
|
|
66
|
8
|
50
|
|
|
|
11
|
return q() unless scalar @{ $self->{'mesg'} }; |
|
8
|
|
|
|
|
40
|
|
67
|
8
|
|
|
|
|
11
|
$mesg .= join( "\n", @{ $self->{'mesg'} } ); |
|
8
|
|
|
|
|
25
|
|
68
|
8
|
|
|
|
|
37
|
$mesg .= sprintf( " at %s", $self->{'file'} ); |
69
|
8
|
|
|
|
|
24
|
$mesg .= sprintf( " line %d.", $self->{'line'} ); |
70
|
|
|
|
|
|
|
|
71
|
8
|
|
|
|
|
35
|
return $mesg; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub text { |
75
|
8
|
|
|
8
|
1
|
14
|
my $self = shift; |
76
|
8
|
50
|
|
|
|
11
|
return q() unless scalar @{ $self->{'mesg'} }; |
|
8
|
|
|
|
|
25
|
|
77
|
8
|
|
|
|
|
12
|
return join( ' ', @{ $self->{'mesg'} } ); |
|
8
|
|
|
|
|
36
|
|
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
81
|
|
|
|
|
|
|
__END__ |