NAME

Mail::Builder::Attachment - Helper module for handling attachments from files

SYNOPSIS

use Mail::Builder;

my $attachment = Mail::Builder::Attachment('/home/guybrush/2007_10_11_invitation.pdf','invitation.pdf','application/pdf');
$attachment->name('party_invitation.pdf');
print $attachment->serialize;

DESCRIPTION

This is a simple module for handling attachments with Mail::Builder.

METHODS

Constructor

new

my $obj = Mail::Builder::Attachment->new(PATH[,NAME,MIME]);

Takes the path to the attached file on the local filesystem. Optionally takes the file name as it should be diplayed in the e-mail message and a mime type.

Public methods

compare

$obj->compara(OBJECT);
or 
$obj->compara(PATH);

Checks if two attachment objectscontain the same file. Returns true or false. The compare method does not check if the mime types and name attributes of the two objects are identical.

Instead of a Mail::Builder::Attachment::File object you can also pass a scalar value representing the path.

serialize

Returns the attachment as a MIME::Entity object.

Accessors

path

Accessor which takes/returns the path of the file on the filesystem. The file must be readable by the current uid.

name

Accessor which takes/returns the name of the file as displayed in the e-mail message. If no name is provided the filename will be extracted from the path attribute.

mime

Accessor which takes/returns the mime type of the file. If no mime type is provided the module tries to determine the correct mime type for the given filename extension. If this fails 'application/octet-stream' will be used.

Private methods

_get_mime

Try to determine the mime type by parsing the filename.

_get_name

Fetch the e-mail filename from the path attribute.

AUTHOR

Maroš Kollár
CPAN ID: MAROS
maros [at] k-1.com
http://www.k-1.com

1 POD Error

The following errors were encountered while parsing the POD:

Around line 190:

Non-ASCII character seen before =encoding in 'Maroš'. Assuming UTF-8