Abstract/MailInternet.pm

filter: Statementstmt 31.5% 12 / 38 Branchbran 8.3% 1 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 36.3% 4 / 11 Podpod 12.5% 1 / 8 totaltotal 26.0% 18 / 69 CC 8 SCAR 23.7
CC
8
Cov
26%
get_header
30.0
set_header
6.0
is_available
5.7
CRAP 10.7
↑ Summary Abstract.pm »
1 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 package Email::Abstract::MailInternet;
3 # ABSTRACT: Email::Abstract wrapper for Mail::Internet
4 3 $Email::Abstract::MailInternet::VERSION = '3.010';
5 3 ▶use Email::Abstract::Plugin;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶BEGIN { @Email::Abstract::MailInternet::ISA = 'Email::Abstract::Plugin' };
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 0 ▶sub target { "Mail::Internet" }
Subroutine target: not called CC=1 SCAR=6.9
Pod undocumented
9  
10 # We need 1.77 because otherwise headers unfold badly.
11 3 my $is_avail;
12 3 ▶sub is_available {
Subroutine is_available: called CC=3 SCAR=17.3
Pod documented
13 3 ▶ return $is_avail if defined $is_avail;
Branch: 1 branch
BranchTrueFalseTotal
if defined $is_avail 0 3 3
14 3 require Mail::Internet;
15 0 eval { Mail::Internet->VERSION(1.77) };
16 0 ▶ return $is_avail = $@ ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$@ ? : 0 0 0
17 }
18  
19 0 ▶sub construct {
Subroutine construct: not called CC=1 SCAR=6.9
Pod undocumented
20 0 require Mail::Internet;
21 0 my ($class, $rfc822) = @_;
22 0 Mail::Internet->new([ map { "$_\x0d\x0a" } split /\x0d\x0a/, $rfc822]);
23 }
24  
25 0 ▶sub get_header {
Subroutine get_header: not called CC=5 SCAR=34.0
Pod undocumented
26 0 my ($class, $obj, $header) = @_;
27 0 my @values = $obj->head->get($header);
28 0 ▶ return unless @values;
Branch: 1 branch
BranchTrueFalseTotal
unless @values 0 0 0
29  
30 # No reason to s/// lots of values if we're just going to return one.
31 0 ▶ $#values = 0 if not wantarray;
Branch: 1 branch
BranchTrueFalseTotal
unless wantarray 0 0 0
32  
33 0 chomp @values;
34 0 s/(?:\x0d\x0a|\x0a\x0d|\x0a|\x0d)\s+/ /g for @values;
35  
36 0 ▶ return wantarray ? @values : $values[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
37 }
38  
39 0 ▶sub get_body {
Subroutine get_body: not called CC=1 SCAR=6.9
Pod undocumented
40 0 my ($class, $obj) = @_;
41 0 join "", @{$obj->body()};
42 }
43  
44 0 ▶sub set_header {
Subroutine set_header: not called CC=2 SCAR=17.9
Pod undocumented
45 0 my ($class, $obj, $header, @data) = @_;
46 0 my $count = 0;
47 0 ▶ $obj->head->replace($header, shift @data, ++$count) while @data;
Branch: 1 branch
BranchTrueFalseTotal
@data and do { $obj->head->replace($header, shift @data, ++$count) } 0 0 0
48 }
49  
50 0 ▶sub set_body {
Subroutine set_body: not called CC=1 SCAR=6.9
Pod undocumented
51 0 my ($class, $obj, $body) = @_;
52 0 $obj->body( map { "$_\n" } split /\n/, $body );
53 }
54  
55 0 ▶sub as_string { my ($class, $obj) = @_; $obj->as_string(); }
Subroutine as_string: not called CC=1 SCAR=6.9
Pod undocumented
56  
57 3 1;
58  
59 #pod =head1 DESCRIPTION
60 #pod
61 #pod This module wraps the Mail::Internet mail handling library with an
62 #pod abstract interface, to be used with L<Email::Abstract>
63 #pod
64 #pod =head1 SEE ALSO
65 #pod
66 #pod L<Email::Abstract>, L<Mail::Internet>.
67 #pod
68 #pod =cut
69  
70 __END__
↑ Summary Abstract.pm »