Courriel

 view release on metacpan or  search on metacpan

lib/Courriel.pm  view on Meta::CPAN

    my $sep_idx;

    # We want to ignore mbox message separators - this is a pretty lax parser,
    # but we may find broken lines. The key is that it starts with From
    # followed by space, not a colon.
    ${$text} =~ s/^From\s+.+$Courriel::Helpers::LINE_SEP_RE//;

    # Some broken emails may split the From line in an arbitrary spot
    ${$text} =~ s/^[^:]+$Courriel::Helpers::LINE_SEP_RE//g;

    if ( ${$text} =~ /^(.+?)($Courriel::Helpers::LINE_SEP_RE)\g{2}/s ) {
        $header_text = $1 . $2;
        $sep_idx     = ( length $header_text ) + ( length $2 );
    }
    else {
        return ( 0, Courriel::Headers::->new );
    }

    my $headers = Courriel::Headers::->parse(
        text => \$header_text,
    );



( run in 0.257 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )