Mail-DMARC
view release on metacpan or search on metacpan
lib/Mail/DMARC/Report/Receive.pm view on Meta::CPAN
# Detect zip by magic bytes PK\x03\x04
if ( substr( $contents, 0, 4 ) eq "PK\x03\x04" ) {
my $xml;
IO::Uncompress::Unzip::unzip( \$contents, \$xml )
or croak "unzip failed: $IO::Uncompress::Unzip::UnzipError";
$self->_init_for_file($file);
return $self->handle_body($xml) ? 'aggregate' : undef;
}
# Detect XML by content (starts with optional BOM/whitespace then '<')
if ( $contents =~ /\A(?:\xef\xbb\xbf)?\s*</ ) {
$self->_init_for_file($file);
return $self->handle_body($contents) ? 'aggregate' : undef;
}
return $self->from_email_simple( Email::Simple->new($contents) );
}
sub _init_for_file( $self, $file ) {
$self->report->init();
( run in 1.373 second using v1.01-cache-2.11-cpan-c966e8aa7e8 )