lib/Badger/Codec/Encode.pm

filter: Statementstmt 100% 16 / 16 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 4 / 4 totaltotal 100% 27 / 27 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« lib/Badger/Codec/Base64.pm ↑ Summary lib/Badger/Codec/Storable.pm »
1 #========================================================================
2 #
3 # Badger::Codec::Encode
4 #
5 # DESCRIPTION
6 # A codec wrapper for Encode
7 #
8 # AUTHOR
9 # Andy Wardley <abw@wardley.org>
10 #
11 #========================================================================
12  
13 package Badger::Codec::Encode;
14  
15 use Badger::Class
16 2 ▶ version => 0.01,
Subroutine BEGIN: called CC=1 SCAR=0.0
17 2 base => 'Badger::Codec';
18  
19 2 ▶use Encode qw();
Subroutine BEGIN: called CC=1 SCAR=0.0
20 2 ▶use bytes;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 5 ▶sub encode {
Subroutine encode: called CC=1 SCAR=0.0
Pod documented
23 5 my $self = shift;
24 # No, really, it's OK. This isn't one of those kind of GOTOs.
25 # This is an Offically OK version of GOTO which is really a special
26 # kind of subroutine call. See: perldoc -f goto
27 5 goto &Encode::encode;
28 }
29  
30 5 ▶sub decode {
Subroutine decode: called CC=1 SCAR=0.0
Pod documented
31 5 my $self = shift;
32 # we use goto rather than a call because a) it's quicker (the call
33 # stack frame is re-used) and b) because the prototypes for encode()
34 # and decode() would require us to shift all the arguments off the
35 # stack in order to pass them to encode()/decode() in an orderly
36 # fashion, e.g. my ($enc, $data) = @_; Encode::encode($enc, $data)
37 # rather than: Encode::encode(@_); # not allowed - prototype mismatch
38 5 goto &Encode::decode;
39 }
40  
41 1 ▶sub encoder {
Subroutine encoder: called CC=1 SCAR=0.0
Pod documented
42 1 \&Encode::encode;
43 }
44  
45 1 ▶sub decoder {
Subroutine decoder: called CC=1 SCAR=0.0
Pod documented
46 1 \&Encode::decode;
47 }
48  
49 2 1;
50  
51  
52 __END__
« lib/Badger/Codec/Base64.pm ↑ Summary lib/Badger/Codec/Storable.pm »