lib/Badger/Codec.pm

filter: Statementstmt 83.3% 10 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 71.4% 5 / 7 Podpod 100% 4 / 4 totaltotal 82.6% 19 / 23 CC 1 SCAR 2.5
CC
1
Cov
83%
encode
2.0
decode
2.0
BEGIN
1.0
CRAP 1.3
« lib/Badger/Codec/JSON.pm ↑ Summary lib/Badger/Codec/Encoding.pm »
1 #========================================================================
2 #
3 # Badger::Codec
4 #
5 # DESCRIPTION
6 # Base class codec providing a generic API for encoding/decoding data.
7 #
8 # AUTHOR
9 # Andy Wardley <abw@wardley.org>
10 #
11 #========================================================================
12  
13 package Badger::Codec;
14  
15 use Badger::Class
16 21 version => 0.01,
17 debug => 0,
18 base => 'Badger::Base',
19 21 ▶ utils => 'UTILS';
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 sub encode {
22 0 ▶ shift->not_implemented;
Subroutine encode: not called CC=1 SCAR=6.9
Pod documented
23 }
24  
25 sub decode {
26 0 ▶ shift->not_implemented;
Subroutine decode: not called CC=1 SCAR=6.9
Pod documented
27 }
28  
29  
30 # This is the "brute force and ignorance" approach to creating stand-alone
31 # subroutines. They get the job done, albeit at the overhead of an extra
32 # method call. Subclasses can do something better, like exporting existing
33 # subrefs directly.
34  
35 sub encoder {
36 3 ▶ my $self = shift;
Subroutine encoder: called CC=1 SCAR=0.0
Pod documented
37 3 ▶ return sub { $self->encode(@_) };
Subroutine __ANON__: called CC=1 SCAR=0.0
38 }
39  
40 sub decoder {
41 3 ▶ my $self = shift;
Subroutine decoder: called CC=1 SCAR=0.0
Pod documented
42 3 ▶ return sub { $self->decode(@_) };
Subroutine __ANON__: called CC=1 SCAR=0.0
43 }
44  
45 21 1;
46  
47  
48 __END__
« lib/Badger/Codec/JSON.pm ↑ Summary lib/Badger/Codec/Encoding.pm »