blib/lib/CGI/Test/Input/Custom.pm

filter: Statementstmt 54.5% 24 / 44 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 46.1% 6 / 13 Podpod 100% 4 / 4 totaltotal 52.3% 34 / 65 CC 4 SCAR 13.7
CC
4
Cov
50%
_firstdef
12.0
new
6.0
set_mime_type
2.0
CRAP 3.9
↑ Summary
1 package CGI::Test::Input::Custom;
2  
3 1 our $VERSION = '0.03';
4  
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Encode qw(encode);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use base 'CGI::Test::Input';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 0 ▶sub _firstdef {
Subroutine _firstdef: not called CC=3 SCAR=24.8
13 0 ▶ defined && return $_ for @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $_ and return $_ 0 0 0
14 0 undef;
15 }
16  
17 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
18 0 my ($class, %args) = @_;
19 0 my $this = bless {}, $class;
20 0 $this->_init;
21 0 $this->{_ctic_mime_type} = _firstdef(delete $args{-mime_type}, 'application/octet-stream');
22 0 $this->{_data_decoded} = _firstdef(delete $args{-content}, '');
23 0 $this->{_encoding} = _firstdef(delete $args{-encoding}, 'utf8');
24 0 ▶ %args and croak "unsupported constructor argument(s) ".join(', ', keys %args);
Branch: 1 branch
BranchTrueFalseTotal
%args and croak('unsupported constructor argument(s) ' . join(", ", keys %args)) 0 0 0
25 0 $this->{stale} = 1;
26 0 $this;
27 }
28  
29 1 *make = \&new;
30  
31 1 for (qw(widget field file file_now)) {
32 4 my $m = "add_$_";
33 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
34 0 ▶ *$m = sub { croak "method '$m' is not supported by ".__PACKAGE__." objects" };
Subroutine __ANON__: not called CC=1 SCAR=1.2
35 }
36  
37 0 ▶sub set_mime_type {
Subroutine set_mime_type: not called CC=1 SCAR=6.9
Pod documented
38 0 my ($this, $type) = @_;
39 0 $this->{_ctic_mime_type} = $type;
40 }
41  
42 0 ▶sub mime_type { shift->{_ctic_mime_type} }
Subroutine mime_type: not called CC=1 SCAR=6.9
Pod documented
43  
44 0 ▶sub _build_data {
Subroutine _build_data: not called CC=1 SCAR=6.9
45 0 my $this = shift;
46 encode($this->{_encoding}, $this->{_data_decoded})
47 0 }
48  
49 0 ▶sub add_content {
Subroutine add_content: not called CC=1 SCAR=6.9
Pod documented
50 0 my $this = shift;
51 0 $this->{_data_decoded} .= join('', @_);
52 0 $this->{stale} = 1;
53 }
54  
55  
56  
57 1 1;
58 __END__
↑ Summary