blib/lib/XML/FOAF/ErrorHandler.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 6 | 14 | 42.8 |
branch | 0 | 6 | 0.0 |
condition | 0 | 2 | 0.0 |
subroutine | 2 | 5 | 40.0 |
pod | 0 | 3 | 0.0 |
total | 8 | 30 | 26.6 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package XML::FOAF::ErrorHandler; | ||||||
2 | 5 | 5 | 34 | use strict; | |||
5 | 10 | ||||||
5 | 222 | ||||||
3 | |||||||
4 | 5 | 5 | 28 | use vars qw( $ERROR ); | |||
5 | 11 | ||||||
5 | 1233 | ||||||
5 | |||||||
6 | 0 | 0 | 0 | sub new { bless {}, shift } | |||
7 | sub error { | ||||||
8 | 0 | 0 | 0 | 0 | my $msg = $_[1] || ''; | ||
9 | 0 | 0 | $msg .= "\n" unless $msg =~ /\n$/; | ||||
10 | 0 | 0 | if (ref($_[0])) { | ||||
11 | 0 | $_[0]->{_errstr} = $msg; | |||||
12 | } else { | ||||||
13 | 0 | $ERROR = $msg; | |||||
14 | } | ||||||
15 | 0 | return; | |||||
16 | } | ||||||
17 | 0 | 0 | 0 | 0 | sub errstr { ref($_[0]) ? $_[0]->{_errstr} : $ERROR } | ||
18 | |||||||
19 | 1; |