Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

elysch (9482)

elysch
  (email not shown publicly)
+ -

  Comment: Last mail not saved (Score 1) on 2009.11.09 14:20

by elysch on 2009.11.09 14:20 (#71073)
Attached to: Codestorm
Hi. I discovered the script stores mails every time it encounters a mail beginning (^From ). So, the last e-mail is not stored since there is no "NEXT" mail. I fixed moving:

        if ( length( $message ) > 0 ) {
                $message_count++;
                $file = $file_base . sprintf( "%02d", $file_i );
                #print "Got message # $message_count - appending to $file ...\n";
                if ( $need_to_write_init ) {
                        #write_initial_msg( $file );
                        $need_to_write_init = 0;
                }

                open( SPLIT, ">>$file" ) || die "Cannot append to $file: $!";
                print SPLIT $message;
                close( SPLIT );
        }

to a function called save_msg and calling it where the code was, and ALSO before

close( MBOX );

Note that I'm ignoring the variables scope, since I'm in a hurry, but I shouldn't have.

Feel free to ask if you want me to post my script.

Ely.

Read More 3 comments
Comments: 3