Data::Message - Parse and Reconstruct RFC2822 Compliant Messages
use Data::Message; my $message = Data::Message->new(join('',<>), fold => 1); print $message->header("Customer-ID"); print $message->body;
This module is a generic interface to dealing with RFC2822 compliant messages. Email is the most common example of messages in this format, but not the only one. HTTP requests and responses are also sent and received in this format. Many other systems rely on storing or sending information with a header of key/value pairs followed by an optional body.
Email::Simple is so good at parsing this format, and so fast, this module inherits from it. Changes to the interface are only prevelant in options provided to the constructor
new(). For any other interface usage documentation, please see Email::Simple.
Data::Message is a subclass of
Email::Simple, its mixins will work with this package. For example, you may use
Email::Simple::Creator to aid in the creation of
Data::Message objects from scratch.
my $message = Data::Message->new(join( '', <> ), fold => 1, grouchy => 1);
The first argument is a scalar value containing the text of the payload to be parsed. Subsequent arguments are passed as key/value pairs.
fold, which is false by default, will tell
Data::Message if it should fold headers. If given a true value, headers longer than 78 characters will be folded.
grouchy, which is false by default, will instruct
Data::Message to complain loudly if non-ascii characters are used as header names, when setting headers via
grouchy is true, calls to
header_set() should be wrapped in
eval as they may die.
Casey West, <email@example.com>.
Copyright (c) 2004 Casey West. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.