MIME-Structure

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

bin/message-content-types
bin/parse-mail
CHANGES
lib/MIME/Structure.pm
Makefile.PL
MANIFEST
MANIFEST.SKIP
META.yml
README
t/00-use.t
t/01-parse.t

lib/MIME/Structure.pm  view on Meta::CPAN

                # @context is (..., $parent, $entity)
                # or ($parent, $entity) if in header of a part of message
                # or ($entity) if in message header itself
                my $entity = $context[-1];
                my $parent;
                my $level = $entity->{'level'} = @context - 1;
                if (@context > 1) {
                    # Current entity is $context[-1]
                    $parent = $entity->{'parent'} = $context[-2];
                }
                my ($content_type) = @{ $fields->{'content-type'} || [] };
                if (!defined $content_type) {
                    if ($parent && "$parent->{'type'}/$parent->{'subtype'}" eq 'multipart/digest') {
                        $content_type = 'message/rfc822'
                    }
                    else {
                        $content_type = 'text/plain; charset=us-ascii';
                    }
                }
                my ($type, $subtype, $type_params) = parse_content_type($content_type);
                $entity->{'type'}        = $type;

lib/MIME/Structure.pm  view on Meta::CPAN

=item B<concise_structure>

    $parser->parse;
    print $parser->concise_structure;
    # e.g., '(multipart/alternative:0 (text/html:291) (text/plain:9044))'

Returns a string showing the structure of a message, including the content
type and offset of each entity (i.e., the message and [if it's multipart] all
of its parts, recursively).  Each entity is printed in the form:

    "(" content-type ":" byte-offset [ " " parts... ")"

Offsets are B<byte> offsets of the entity's header from the beginning of the
message.  (If B<parse()> was called with an I<offset> parameter, this is added
to the offset of the entity's header.)

N.B.: The first offset is always 0.

=back

=head1 BUGS



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