| 1 | 3 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 2 | 3 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | package Email::Folder::Reader; | ||||||||||||||||||||
| 4 | # ABSTRACT: reads raw RFC822 mails from a box | ||||||||||||||||||||
| 5 | 3 | $Email::Folder::Reader::VERSION = '0.859'; | |||||||||||||||||||
| 6 | 3 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | #pod =head1 SYNOPSIS | ||||||||||||||||||||
| 9 | #pod | ||||||||||||||||||||
| 10 | #pod use Email::Folder::Reader; | ||||||||||||||||||||
| 11 | #pod my $box = Email::Folder::Reader->new('somebox'); | ||||||||||||||||||||
| 12 | #pod print $box->messages; | ||||||||||||||||||||
| 13 | #pod | ||||||||||||||||||||
| 14 | #pod or, as an iterator | ||||||||||||||||||||
| 15 | #pod | ||||||||||||||||||||
| 16 | #pod use Email::Folder::Reader; | ||||||||||||||||||||
| 17 | #pod my $box = Email::Folder::Reader->new('somebox'); | ||||||||||||||||||||
| 18 | #pod while ( my $mail = $box->next_message ) { | ||||||||||||||||||||
| 19 | #pod print $mail; | ||||||||||||||||||||
| 20 | #pod } | ||||||||||||||||||||
| 21 | #pod | ||||||||||||||||||||
| 22 | #pod =head1 METHODS | ||||||||||||||||||||
| 23 | #pod | ||||||||||||||||||||
| 24 | #pod =head2 new($filename, %options) | ||||||||||||||||||||
| 25 | #pod | ||||||||||||||||||||
| 26 | #pod your standard class-method constructor | ||||||||||||||||||||
| 27 | #pod | ||||||||||||||||||||
| 28 | #pod =cut | ||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | sub new { | ||||||||||||||||||||
| 31 | 11 | ▶ | my $class = shift; | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||||||||||||
| 32 | 11 | ▶ | my $file = shift || croak "You must pass a filename"; | ||||||||||||||||||
|
Condition33%1/3
shift() || croak('You must pass a filename')
MC/DC0%0/2
shift() || croak('You must pass a filename')
shift()
croak('You must pass a filename')
Truth table33%1/3
A || B
A= shift()B= croak('You must pass a filename')
| |||||||||||||||||||||
| 33 | 11 | bless { eval { $class->defaults }, | |||||||||||||||||||
| 34 | @_, | ||||||||||||||||||||
| 35 | _file => $file }, $class; | ||||||||||||||||||||
| 36 | } | ||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | #pod =head2 ->next_message | ||||||||||||||||||||
| 39 | #pod | ||||||||||||||||||||
| 40 | #pod returns the next message from the box, or false if there are no more | ||||||||||||||||||||
| 41 | #pod | ||||||||||||||||||||
| 42 | #pod =cut | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | ▶ | sub next_message { | |||||||||||||||||||
|
Subroutine
next_message: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 45 | } | ||||||||||||||||||||
| 46 | |||||||||||||||||||||
| 47 | #pod =head2 ->messages | ||||||||||||||||||||
| 48 | #pod | ||||||||||||||||||||
| 49 | #pod Returns all the messages in a box | ||||||||||||||||||||
| 50 | #pod | ||||||||||||||||||||
| 51 | #pod =cut | ||||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | sub messages { | ||||||||||||||||||||
| 54 | 9 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
messages: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 55 | |||||||||||||||||||||
| 56 | 9 | my @messages; | |||||||||||||||||||
| 57 | 9 | ▶ | while (my $message = $self->next_message) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 58 | 52 | push @messages, $message; | |||||||||||||||||||
| 59 | } | ||||||||||||||||||||
| 60 | 9 | return @messages; | |||||||||||||||||||
| 61 | } | ||||||||||||||||||||
| 62 | |||||||||||||||||||||
| 63 | 3 | 1; | |||||||||||||||||||
| 64 | |||||||||||||||||||||
| 65 | __END__ | ||||||||||||||||||||