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.
Extends "DESCRIPTION" in Mail::Box::Parser.
METHODS
Extends "METHODS" in Mail::Box::Parser.
Constructors
Extends "Constructors" in Mail::Box::Parser.
- Mail::Box::Parser::Perl->new(%options)
-
-Option --Defined in --Default file undef filename <required> fix_header_errors Mail::Box::Parser <false> log Mail::Reporter 'WARNINGS' mode 'r' trace Mail::Reporter 'WARNINGS' trusted Mail::Box::Parser <false>
- file => FILE-HANDLE
-
Any
IO::File
orGLOB
file-handle which can be used to read the data from. In case this option is specified, thefilename
is informational only. - filename => FILENAME
-
The name of the file to be read.
- fix_header_errors => BOOLEAN
- log => LEVEL
- mode => OPENMODE
-
File-open mode, which defaults to
'r'
, which means `read-only'. Seeperldoc -f open
for possible modes. Only applicable when nofile
is specified. - trace => LEVEL
- trusted => BOOLEAN
Attributes
Extends "Attributes" in Mail::Box::Parser.
- $obj->defaultParserType( [$class] )
- Mail::Box::Parser::Perl->defaultParserType( [$class] )
-
Inherited, see "Attributes" in Mail::Box::Parser
- $obj->file()
- $obj->filename()
-
Returns the name of the file this parser is working on.
- $obj->fixHeaderErrors( [BOOLEAN] )
-
Inherited, see "Attributes" in Mail::Box::Parser
- $obj->logSettings()
-
Inherited, see "Attributes" in Mail::Reporter
- $obj->openMode()
- $obj->trusted()
-
Inherited, see "Attributes" in Mail::Box::Parser
Parsing
Extends "Parsing" in Mail::Box::Parser.
- $obj->bodyAsFile( $fh [$chars, [$lines]] )
-
Inherited, see "Parsing" in Mail::Box::Parser
- $obj->bodyAsList( [$chars, [$lines]] )
-
Inherited, see "Parsing" in Mail::Box::Parser
- $obj->bodyAsString( [$chars, [$lines]] )
-
Inherited, see "Parsing" in Mail::Box::Parser
- $obj->bodyDelayed( [$chars, [$lines]] )
-
Inherited, see "Parsing" in Mail::Box::Parser
- $obj->closeFile()
-
Close the file which was being parsed.
- $obj->fileChanged()
-
Returns whether the file which is parsed has changed after the last time takeFileInfo() was called.
- $obj->filePosition( [$position] )
-
Returns the location of the next byte to be used in the file which is parsed. When a $position is specified, the location in the file is moved to the indicated spot first.
- $obj->lineSeparator()
-
Inherited, see "Parsing" in Mail::Box::Parser
- $obj->openFile(%options)
-
[3.012] Open the file to be parsed.
- $obj->readHeader()
-
Inherited, see "Parsing" in Mail::Box::Parser
- $obj->restart(%options)
-
Restart the parser on a certain file, usually because the content has changed. The
%options
are passed to openFile(). - $obj->start(%options)
-
Start the parser by opening a file.
-Option--Default file undef
- $obj->stop()
-
Stop the parser, which will include a close of the file. The lock on the folder will not be removed (is not the responsibility of the parser).
- $obj->takeFileInfo()
-
Capture some data about the file being parsed, to be compared later.
Error handling
Extends "Error handling" in Mail::Box::Parser.
- $obj->AUTOLOAD()
-
Inherited, see "Error handling" in Mail::Reporter
- $obj->addReport($object)
-
Inherited, see "Error handling" in Mail::Reporter
- $obj->defaultTrace( [$level]|[$loglevel, $tracelevel]|[$level, $callback] )
- Mail::Box::Parser::Perl->defaultTrace( [$level]|[$loglevel, $tracelevel]|[$level, $callback] )
-
Inherited, see "Error handling" in Mail::Reporter
- $obj->errors()
-
Inherited, see "Error handling" in Mail::Reporter
- $obj->log( [$level, [$strings]] )
- Mail::Box::Parser::Perl->log( [$level, [$strings]] )
-
Inherited, see "Error handling" in Mail::Reporter
- $obj->logPriority($level)
- Mail::Box::Parser::Perl->logPriority($level)
-
Inherited, see "Error handling" in Mail::Reporter
- $obj->notImplemented()
-
Inherited, see "Error handling" in Mail::Reporter
- $obj->report( [$level] )
-
Inherited, see "Error handling" in Mail::Reporter
- $obj->reportAll( [$level] )
-
Inherited, see "Error handling" in Mail::Reporter
- $obj->trace( [$level] )
-
Inherited, see "Error handling" in Mail::Reporter
- $obj->warnings()
-
Inherited, see "Error handling" in Mail::Reporter
Cleanup
Extends "Cleanup" in Mail::Box::Parser.
- $obj->DESTROY()
-
Inherited, see "Cleanup" in Mail::Reporter
DIAGNOSTICS
- Warning: File $file 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 whether 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_header_errors) set, the parsing of the header will be continued. The erroneous line will be added to the preceding field.
SEE ALSO
This module is part of Mail-Message distribution version 3.018_001, built on August 21, 2025. Website: http://perl.overmeer.net/CPAN/
LICENSE
Copyrights 2001-2025 by [Mark Overmeer <markov@cpan.org>]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://dev.perl.org/licenses/