line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
10
|
|
|
10
|
|
687942
|
use 5.014; |
|
10
|
|
|
|
|
53
|
|
2
|
10
|
|
|
10
|
|
61
|
use strict; |
|
10
|
|
|
|
|
22
|
|
|
10
|
|
|
|
|
203
|
|
3
|
10
|
|
|
10
|
|
46
|
use warnings; |
|
10
|
|
|
|
|
26
|
|
|
10
|
|
|
|
|
238
|
|
4
|
|
|
|
|
|
|
|
5
|
10
|
|
|
10
|
|
47
|
use Carp (); |
|
10
|
|
|
|
|
27
|
|
|
10
|
|
|
|
|
138
|
|
6
|
10
|
|
|
10
|
|
46
|
use Scalar::Util (); |
|
10
|
|
|
|
|
14
|
|
|
10
|
|
|
|
|
591
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package results; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
11
|
|
|
|
|
|
|
our $VERSION = '0.004'; |
12
|
|
|
|
|
|
|
|
13
|
10
|
|
|
10
|
|
4504
|
use Exporter::Shiny qw( err is_result ok ok_list ); |
|
10
|
|
|
|
|
42350
|
|
|
10
|
|
|
|
|
75
|
|
14
|
|
|
|
|
|
|
our @EXPORT = qw( err ok ); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
require Result::Err; |
17
|
|
|
|
|
|
|
require Result::Ok; |
18
|
|
|
|
|
|
|
require Result::OkList; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
use constant { |
21
|
10
|
|
|
|
|
2626
|
ERR_CLASS => 'Result::Err', |
22
|
|
|
|
|
|
|
OK_CLASS => 'Result::Ok', |
23
|
|
|
|
|
|
|
OK_LIST_CLASS => 'Result::OkList', |
24
|
10
|
|
|
10
|
|
1085
|
}; |
|
10
|
|
|
|
|
19
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub err { |
27
|
47
|
50
|
|
47
|
1
|
12039
|
Carp::croak("Void context forbidden here") unless defined wantarray; |
28
|
47
|
|
|
|
|
226
|
ERR_CLASS->new( @_ ); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub is_result { |
32
|
4
|
100
|
66
|
4
|
1
|
79099
|
Scalar::Util::blessed( $_[0] ) |
33
|
|
|
|
|
|
|
and $_[0]->can( 'DOES' ) |
34
|
|
|
|
|
|
|
and $_[0]->DOES( 'Result::Trait' ) |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub ok { |
38
|
56
|
50
|
|
56
|
1
|
280167
|
Carp::croak("Void context forbidden here") unless defined wantarray; |
39
|
56
|
|
|
|
|
245
|
OK_CLASS->new( @_ ); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub ok_list { |
43
|
1
|
50
|
|
1
|
1
|
5514
|
Carp::croak("Void context forbidden here") unless defined wantarray; |
44
|
1
|
|
|
|
|
13
|
OK_LIST_CLASS->new( @_ ); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |