| 1 | |||||||||||
| 2 | 18 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 18 | ▶ | use Mail::Mbox::MessageParser; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 18 | ▶ | use FileHandle; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 18 | ▶ | die unless @ARGV == 1; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 7 | |||||||||||
| 8 | 18 | my $output_filename = shift @ARGV; | |||||||||
| 9 | |||||||||||
| 10 | 18 | my $fileHandle = new FileHandle; | |||||||||
| 11 | 18 | $fileHandle->open('-'); | |||||||||
| 12 | |||||||||||
| 13 | 18 | ParseFile($output_filename); | |||||||||
| 14 | |||||||||||
| 15 | 15 | exit; | |||||||||
| 16 | |||||||||||
| 17 | ################################################################################ | ||||||||||
| 18 | |||||||||||
| 19 | sub ParseFile | ||||||||||
| 20 | { | ||||||||||
| 21 | 18 | ▶ | my $output_filename = shift; | ||||||||
|
Subroutine
ParseFile: called CC=4 SCAR=13.9
| |||||||||||
| 22 | |||||||||||
| 23 | 18 | my $file_handle = new FileHandle; | |||||||||
| 24 | 18 | ▶ | $file_handle->open('-') or die $!; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | |||||||||||
| 26 | 18 | my $output_file_handle = new FileHandle(">$output_filename"); | |||||||||
| 27 | 18 | binmode $output_file_handle; | |||||||||
| 28 | |||||||||||
| 29 | my $folder_reader = | ||||||||||
| 30 | new Mail::Mbox::MessageParser( { | ||||||||||
| 31 | 'file_name' => undef, | ||||||||||
| 32 | 'file_handle' => $file_handle, | ||||||||||
| 33 | 'enable_cache' => 0, | ||||||||||
| 34 | 'enable_grep' => 0, | ||||||||||
| 35 | 'debug' => $ENV{TEST_VERBOSE}, | ||||||||||
| 36 | 18 | } ); | |||||||||
| 37 | |||||||||||
| 38 | 15 | ▶ | die $folder_reader unless ref $folder_reader; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | |||||||||||
| 40 | 15 | print $output_file_handle $folder_reader->prologue(); | |||||||||
| 41 | |||||||||||
| 42 | 15 | ▶ | while (!$folder_reader->end_of_file()) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | { | ||||||||||
| 44 | 75 | my $email_text = $folder_reader->read_next_email(); | |||||||||
| 45 | 75 | print $output_file_handle $$email_text; | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 15 | close $output_file_handle; | |||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | ################################################################################ | ||||||||||