blib/lib/JSON/Pointer/Exception.pm

filter: Statementstmt 100% 32 / 32 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 13 / 13 Podpod 100% 7 / 7 totaltotal 100% 52 / 52 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/JSON/Pointer/Context.pm ↑ Summary
1 package JSON::Pointer::Exception;
2  
3 16 ▶use 5.008_001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 16 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 16 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 use overload (
7 16 q|""| => "to_string"
8 16 ▶);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 16 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
11 16 ▶use Exporter qw(import);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 16 our $VERSION = '0.06';
14 16 our @EXPORT_OK = qw(
15 ERROR_INVALID_POINTER_SYNTAX
16 ERROR_POINTER_REFERENCES_NON_EXISTENT_VALUE
17 );
18  
19 16 our %EXPORT_TAGS = (
20 all => [ @EXPORT_OK ],
21 );
22  
23 19 ▶sub ERROR_INVALID_POINTER_SYNTAX { 1; }
Subroutine ERROR_INVALID_POINTER_SYNTAX: called CC=1 SCAR=0.0
Pod documented
24 74 ▶sub ERROR_POINTER_REFERENCES_NON_EXISTENT_VALUE { 2; }
Subroutine ERROR_POINTER_REFERENCES_NON_EXISTENT_VALUE: called CC=1 SCAR=0.0
Pod documented
25  
26 16 our %MESSAGE_BUNDLES = (
27 ERROR_INVALID_POINTER_SYNTAX()
28 => "Invalid pointer syntax (pointer: %s)",
29 ERROR_POINTER_REFERENCES_NON_EXISTENT_VALUE()
30 => "A pointer that references a non-existent value (pointer: %s)",
31 );
32  
33 sub new {
34 12 ▶ my ($class, %opts) = @_;
Subroutine new: called CC=1 SCAR=0.0
Pod documented
35 12 $opts{context}->last_error($opts{code});
36 bless {
37 code => $opts{code},
38 context => $opts{context},
39 12 } => $class
40 }
41  
42 sub throw {
43 12 ▶ Carp::croak(shift->new(@_));
Subroutine throw: called CC=1 SCAR=0.0
Pod documented
44 }
45  
46 sub code {
47 6 ▶ shift->{code};
Subroutine code: called CC=1 SCAR=0.0
Pod documented
48 }
49  
50 sub context {
51 6 ▶ shift->{context};
Subroutine context: called CC=1 SCAR=0.0
Pod documented
52 }
53  
54 sub to_string {
55 15 ▶ my $self = shift;
Subroutine to_string: called CC=1 SCAR=0.0
Pod documented
56 15 sprintf($MESSAGE_BUNDLES{$self->{code}}, $self->{context}{pointer});
57 }
58  
59 16 1;
60 __END__
« blib/lib/JSON/Pointer/Context.pm ↑ Summary