Mail-MboxParser

 view release on metacpan or  search on metacpan

MboxParser/Mail.pm  view on Meta::CPAN


    # body needs the "Content-type: ... boundary=" stuff
    # in order to decide which lines are part of signature and
    # which lines are not (ie denote a MIME-part)
    my $bound; 

    # particular entity desired?
    # we need to read the header of this entity then :-(
    if (defined $num) {		
	my $ent = $self->get_entities($num);
	if ($bound = $ent->head->get('content-type')) {
	    $bound =~ /boundary="(.*)"/; $bound = $1;
	}
	return Mail::MboxParser::Mail::Body->new($ent, $bound, $self->{ARGS});
    }
	
    # else
    if ($bound = $self->header->{'content-type'}) { 
	$bound =~ /boundary="(.*)"/; $bound = $1;
    }	
    return ref $self->{TOP_ENTITY} eq 'MIME::Entity' 
	? Mail::MboxParser::Mail::Body->new($self->{TOP_ENTITY}, $bound, $self->{ARGS})
	: Mail::MboxParser::Mail::Body->new(scalar $self->get_entities(0), $bound, $self->{ARGS});
}

# ----------------------------------------------------------------

=over 4

t/testbox  view on Meta::CPAN

has implemented.

*) my $mime = Mail::Message::Head::Field->new(
      Content-Type => 'text/plain', charset => 'US-ASCII');
   my $mime = Mail::Message::Head::Field->new(
       'Content-Type: text/plain; charset=US-ASCII');
   my $mime = Mail::Message::Head::Field->new(
       Content-Type => 'text/plain; charset=US-ASCII');

*) my $name    = $mime->field;
   => content-type           [lowercased]

*) my $content = $mime->content;
   => 'text/plain; charset=US-ASCII'

*) my $value   = $mime->value;
   => 'text/plain'

*) my $charset = $mime->option('charset');
   => US-ASCII



( run in 1.489 second using v1.01-cache-2.11-cpan-524268b4103 )