Subject: | ARF 0.003 bug |
Date: | Tue, 19 May 2009 10:02:11 +0200 (CEST) |
To: | bug-Email-ARF [...] rt.cpan.org |
From: | Tomas Macek <maca02 [...] atlas.cz> |
Hi, I've tried to develop a script using Email::ARF::Report.
This is my perl script:
-------------------------------
use strict;
use warnings;
use Email::ARF::Report;
my $text = "";
while (<>) {
$text .= $_;
}
# print $text . "\n";
my $report = Email::ARF::Report->new($text) or die "not arf message:
$!\n";
if (!$report->field) {
print "not arf report\n";
exit 0;
}
print $report->arf_version . "\n";
print $report->field('feedback-type') . "\n";
print $report->field('feedback-agent') . "\n";
print $report->field('received-date')."\n";
print $report->field('source-ip')."\n";
--------------------------------------
If I run this with as "arf-test.pl < mail.txt", where mail.txt contains
proper ARF compliant message, everything works.
If I run this with some other text (here it is a C program source for
example), something goes wrong:
----------------------
./test-arf.pl < program.c
Use of uninitialized value in concatenation (.) or string at
/usr/lib/perl5/site_perl/5.8.3/Email/ARF/Report.pm line 75, <> line 61.
non-ARF content type '' on ARF report source at ./arf-test.pl line 16
----------------------
Nor the test "... or die ..." nor the "if (!$report->field) catches the
exception.
Tomas