line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
10
|
|
|
10
|
|
697438
|
use 5.014; |
|
10
|
|
|
|
|
53
|
|
2
|
10
|
|
|
10
|
|
74
|
use strict; |
|
10
|
|
|
|
|
29
|
|
|
10
|
|
|
|
|
202
|
|
3
|
10
|
|
|
10
|
|
56
|
use warnings; |
|
10
|
|
|
|
|
20
|
|
|
10
|
|
|
|
|
227
|
|
4
|
|
|
|
|
|
|
|
5
|
10
|
|
|
10
|
|
53
|
use Carp (); |
|
10
|
|
|
|
|
26
|
|
|
10
|
|
|
|
|
142
|
|
6
|
10
|
|
|
10
|
|
45
|
use Scalar::Util (); |
|
10
|
|
|
|
|
25
|
|
|
10
|
|
|
|
|
633
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package results; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
11
|
|
|
|
|
|
|
our $VERSION = '0.005'; |
12
|
|
|
|
|
|
|
|
13
|
10
|
|
|
10
|
|
4532
|
use Exporter::Shiny qw( err is_result ok ok_list ); |
|
10
|
|
|
|
|
42743
|
|
|
10
|
|
|
|
|
74
|
|
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
|
|
|
|
|
2717
|
ERR_CLASS => 'Result::Err', |
22
|
|
|
|
|
|
|
OK_CLASS => 'Result::Ok', |
23
|
|
|
|
|
|
|
OK_LIST_CLASS => 'Result::OkList', |
24
|
10
|
|
|
10
|
|
1079
|
}; |
|
10
|
|
|
|
|
25
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub err { |
27
|
47
|
50
|
|
47
|
1
|
11185
|
Carp::croak("Void context forbidden here") unless defined wantarray; |
28
|
47
|
|
|
|
|
234
|
ERR_CLASS->new( @_ ); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub is_result { |
32
|
4
|
100
|
66
|
4
|
1
|
82363
|
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
|
299536
|
Carp::croak("Void context forbidden here") unless defined wantarray; |
39
|
56
|
|
|
|
|
271
|
OK_CLASS->new( @_ ); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub ok_list { |
43
|
1
|
50
|
|
1
|
1
|
5051
|
Carp::croak("Void context forbidden here") unless defined wantarray; |
44
|
1
|
|
|
|
|
16
|
OK_LIST_CLASS->new( @_ ); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |