Mail::Box::Parser::Perl - reading messages from file using Perl


NAME

Mail::Box::Parser::Perl - reading messages from file using Perl


INHERITANCE

 Mail::Box::Parser::Perl
   is a Mail::Box::Parser
   is a Mail::Reporter


SYNOPSIS


DESCRIPTION

The Mail::Box::Parser::Perl implements parsing of messages in Perl. This may be a little slower than the C based parser Mail::Box::Parser::C, but will also work on platforms where no C compiler is available.


METHODS

Constructors

Mail::Box::Parser::Perl->new(OPTIONS)

 Option             Defined in       Default      
 file               L<Mail::Box::Parser>  undef        
 filename           L<Mail::Box::Parser>  <required>   
 fix_header_errors                   <false>      
 log                L<Mail::Reporter>  C<'WARNINGS'>
 mode               L<Mail::Box::Parser>  C<'r'>       
 trace              L<Mail::Reporter>  C<'WARNINGS'>
 trusted                             <false>

. file FILE-HANDLE

. filename FILENAME

. fix_header_errors BOOLEAN

When header errors are detected, the parsing of the header will be stopped. Other header lines will become part of the body of the message. Set this flag to have the erroneous line added to the previous header line.

. log LEVEL

. mode OPENMODE

. trace LEVEL

. trusted BOOLEAN

Is the input from the file to be trusted, or does it require extra tests. Related to Mail::Box::new(trusted).

The parser

$obj->fileChanged

See The parser in the Mail::Box::Parser manpage

$obj->filename

See The parser in the Mail::Box::Parser manpage

$obj->fixHeaderErrors([BOOLEAN])

If set to true, parsing of a header will not stop on an error, but attempt to add the erroneous this line to previous field. Without BOOLEAN, the current setting is returned.

Example:

 $folder->parser->fixHeaderErrors(1);
 my $folder = $mgr->open('folder', fix_header_errors => 1);

$obj->restart

See The parser in the Mail::Box::Parser manpage

$obj->start(OPTIONS)

See The parser in the Mail::Box::Parser manpage

$obj->stop

See The parser in the Mail::Box::Parser manpage

Parsing

$obj->bodyAsFile(FILEHANDLE [,CHARS [,LINES]])

See Parsing in the Mail::Box::Parser manpage

$obj->bodyAsList([,CHARS [,LINES]])

See Parsing in the Mail::Box::Parser manpage

$obj->bodyAsString([,CHARS [,LINES]])

See Parsing in the Mail::Box::Parser manpage

$obj->bodyDelayed([,CHARS [,LINES]])

See Parsing in the Mail::Box::Parser manpage

$obj->filePosition([POSITION])

See Parsing in the Mail::Box::Parser manpage

$obj->lineSeparator

See Parsing in the Mail::Box::Parser manpage

$obj->popSeparator

See Parsing in the Mail::Box::Parser manpage

$obj->pushSeparator(STRING|REGEXP)

See Parsing in the Mail::Box::Parser manpage

$obj->readHeader

$obj->readSeparator(OPTIONS)

See Parsing in the Mail::Box::Parser manpage

Internals

$obj->closeFile

See Internals in the Mail::Box::Parser manpage

$obj->defaultParserType([CLASS])

Mail::Box::Parser::Perl->defaultParserType([CLASS])

See Internals in the Mail::Box::Parser manpage

$obj->openFile(ARGS)

See Internals in the Mail::Box::Parser manpage

$obj->takeFileInfo

See Internals in the Mail::Box::Parser manpage

Error handling

$obj->AUTOLOAD

See Error handling in the Mail::Reporter manpage

$obj->addReport(OBJECT)

See Error handling in the Mail::Reporter manpage

$obj->defaultTrace([LEVEL]|[LOGLEVEL, TRACELEVEL]|[LEVEL, CALLBACK])

Mail::Box::Parser::Perl->defaultTrace([LEVEL]|[LOGLEVEL, TRACELEVEL]|[LEVEL, CALLBACK])

See Error handling in the Mail::Reporter manpage

$obj->errors

See Error handling in the Mail::Reporter manpage

$obj->log([LEVEL [,STRINGS]])

Mail::Box::Parser::Perl->log([LEVEL [,STRINGS]])

See Error handling in the Mail::Reporter manpage

$obj->logPriority(LEVEL)

Mail::Box::Parser::Perl->logPriority(LEVEL)

See Error handling in the Mail::Reporter manpage

$obj->logSettings

See Error handling in the Mail::Reporter manpage

$obj->notImplemented

See Error handling in the Mail::Reporter manpage

$obj->report([LEVEL])

See Error handling in the Mail::Reporter manpage

$obj->reportAll([LEVEL])

See Error handling in the Mail::Reporter manpage

$obj->trace([LEVEL])

See Error handling in the Mail::Reporter manpage

$obj->warnings

See Error handling in the Mail::Reporter manpage

Cleanup

$obj->DESTROY

See Cleanup in the Mail::Reporter manpage

$obj->inGlobalDestruction

See Cleanup in the Mail::Reporter manpage


DIAGNOSTICS

Warning: File $filename changed during access.

When a message parser starts working, it takes size and modification time of the file at hand. If the folder is written, it checks wether there were changes in the file made by external programs.

Calling Mail::Box::update() on a folder before it being closed will read these new messages. But the real source of this problem is locking: some external program (for instance the mail transfer agent, like sendmail) uses a different locking mechanism as you do and therefore violates your rights.

Error: Package $package does not implement $method.

Fatal error: the specific package (or one of its superclasses) does not implement this method where it should. This message means that some other related classes do implement this method however the class at hand does not. Probably you should investigate this and probably inform the author of the package.

Warning: Unexpected end of header in $source: $line

While parsing a message from the specified source (usually a file name), the parser found a syntax error. According to the MIME specification in the RFCs, each header line must either contain a colon, or start with a blank to indicate a folded field. Apparently, this header contains a line which starts on the first position, but not with a field name.

By default, parsing of the header will be stopped. If there are more header lines after the erroneous line, they will be added to the body of the message. In case of new(fix_headers) set, the parsing of the header will be continued. The erroneous line will be added to the preceding field.


REFERENCES

See the MailBox website at http://perl.overmeer.net/mailbox/ for more details.


COPYRIGHTS

Distribution version 2.059. Written by Mark Overmeer (mark@overmeer.net) See the ChangeLog for other contributors.

Copyright (c) 2001-2003 by the author(s). All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

 Mail::Box::Parser::Perl - reading messages from file using Perl