| 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
| |||||||||||||||||||||
| 26 | 1 | ▶ | croak "$dir is not a directory" unless (-d $dir); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | 1 | my @messages; | |||||||||||||||||||
| 29 | 1 | ▶ | opendir(DIR,"$dir") or croak "Could not open '$dir'"; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 30 | 1 | foreach my $file (readdir DIR) { | |||||||||||||||||||
| 31 | 6 | ▶ | if ($^O eq 'VMS'){ | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 32 | 0 | ▶ | next unless $file =~ /\A\d+\.\Z/; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 33 | } else { | ||||||||||||||||||||
| 34 | 6 | ▶ | next unless $file =~ /\A\d+\Z/; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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
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
| |||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 5 | ▶ | my $file = shift @$what or return; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 47 | 4 | local *FILE; | |||||||||||||||||||
| 48 | 4 | ▶ | open FILE, $file or croak "couldn't open '$file' for reading"; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 49 | 4 | join '', <FILE>; | |||||||||||||||||||
| 50 | } | ||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | 1 | 1; | |||||||||||||||||||
| 53 | |||||||||||||||||||||
| 54 | __END__ | ||||||||||||||||||||