Folder/MH.pm

filter: Statementstmt 97.3% 37 / 38 Branchbran 56.2% 9 / 16 Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 8 / 8 Podpod 100% 1 / 1 totaltotal 83.8% 57 / 68 CC 11 SCAR 17.0
CC
11
Cov
84%
_what_is_there
9.6
next_message
4.1
BEGIN
1.0
CRAP 5.5
« Folder/Maildir.pm ↑ Summary Folder.pm »
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 package Email::Folder::MH;
4 # ABSTRACT: reads raw RFC822 mails from an mh folder
5 1 $Email::Folder::MH::VERSION = '0.859';
6 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use IO::File;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Email::Folder::Reader;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use parent 'Email::Folder::Reader';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 #pod =head1 SYNOPSIS
12 #pod
13 #pod This isa Email::Folder::Reader - read about its API there.
14 #pod
15 #pod =head1 DESCRIPTION
16 #pod
17 #pod It's yet another email folder reader! It reads MH folders.
18 #pod
19 #pod =cut
20  
21 sub _what_is_there {
22 1 ▶ my $self = shift;
Subroutine _what_is_there: called CC=8 SCAR=22.6
23 1 my $dir = $self->{_file};
24  
25 1 ▶ croak "$dir does not exist" unless (-e $dir);
Branch: 1 branch
BranchTrueFalseTotal
unless -e $dir 0 1 1
26 1 ▶ croak "$dir is not a directory" unless (-d $dir);
Branch: 1 branch
BranchTrueFalseTotal
unless -d $dir 0 1 1
27  
28 1 my @messages;
29 1 ▶ opendir(DIR,"$dir") or croak "Could not open '$dir'";
Branch: 1 branch
BranchTrueFalseTotal
opendir DIR, "$dir" or croak("Could not open '${dir}'") 0 1 1
30 1 foreach my $file (readdir DIR) {
31 6 ▶ if ($^O eq 'VMS'){
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq 'VMS') { } 0 6 6
32 0 ▶ next unless $file =~ /\A\d+\.\Z/;
Branch: 1 branch
BranchTrueFalseTotal
unless $file =~ /\A\d+\.\Z/ 0 0 0
33 } else {
34 6 ▶ next unless $file =~ /\A\d+\Z/;
Branch: 1 branch
BranchTrueFalseTotal
unless $file =~ /\A\d+\Z/ 2 4 6
35 }
36 4 push @messages, "$dir/$file";
37 }
38  
39 1 $self->{_messages} = \@messages;
40 }
41  
42 sub next_message {
43 5 ▶ my $self = shift;
Subroutine next_message: called CC=4 SCAR=14.0
Pod documented
44 5 ▶ my $what = $self->{_messages} || $self->_what_is_there;
Condition66%2/3
$self->{'_messages'} || $self->_what_is_there
l!l&&r!l&&!r
410
MC/DC0%0/2
$self->{'_messages'} || $self->_what_is_there
$self->{'_messages'} $self->_what_is_there
Truth table66%2/3
A || B
A= $self->{'_messages'}B= $self->_what_is_there
ABresult
1X1
011
000
45  
46 5 ▶ my $file = shift @$what or return;
Branch: 1 branch
BranchTrueFalseTotal
my $file = shift @$what or return 1 4 5
47 4 local *FILE;
48 4 ▶ open FILE, $file or croak "couldn't open '$file' for reading";
Branch: 1 branch
BranchTrueFalseTotal
open FILE, $file or croak("couldn't open '${file}' for reading") 0 4 4
49 4 join '', <FILE>;
50 }
51  
52 1 1;
53  
54 __END__
« Folder/Maildir.pm ↑ Summary Folder.pm »