Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Email-ARF CPAN distribution.

Report information
The Basics
Id: 46206
Status: rejected
Priority: 0/
Queue: Email-ARF

People
Owner: Nobody in particular
Requestors: maca02 [...] atlas.cz
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



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
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #46206] ARF 0.003 bug
Date: Tue, 19 May 2009 07:59:26 -0400
To: Tomas Macek via RT <bug-Email-ARF [...] rt.cpan.org>
From: Ricardo SIGNES <rjbs [...] cpan.org>
* Tomas Macek via RT <bug-Email-ARF@rt.cpan.org> [2009-05-19T04:02:40] Show quoted text
> my $report = Email::ARF::Report->new($text) or die "not arf message: > $!\n"; > if (!$report->field) { > print "not arf report\n"; > exit 0; > } > > [ ... ] > > Nor the test "... or die ..." nor the "if (!$report->field) catches the > exception.
I'm confused by your expectations. If you pass a non-ARF report to Email::ARF::Report->new, it throws an exception. To catch exceptions, you must use eval{}. my $report = eval { Email::ARF::Report->new($text) }; unless ($report) { print "not an arf report ($@)\n"; exit 0; } -- rjbs
Subject: Re: [rt.cpan.org #46206] ARF 0.003 bug
Date: Tue, 19 May 2009 14:21:06 +0200
To: bug-Email-ARF [...] rt.cpan.org
From: Tomáš Macek <maca02 [...] atlas.cz>
On Tue, 19 May 2009 13:59:46 +0200, Ricardo SIGNES via RT <bug-Email-ARF@rt.cpan.org> wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=46206 > > > * Tomas Macek via RT <bug-Email-ARF@rt.cpan.org> [2009-05-19T04:02:40]
>> my $report = Email::ARF::Report->new($text) or die "not arf message: >> $!\n"; >> if (!$report->field) { >> print "not arf report\n"; >> exit 0; >> } >> >> [ ... ] >> >> Nor the test "... or die ..." nor the "if (!$report->field) catches the >> exception.
> I'm confused by your expectations. If you pass a non-ARF report to > Email::ARF::Report->new, it throws an exception. To catch exceptions, > you must > use eval{}. > > my $report = eval { Email::ARF::Report->new($text) }; > unless ($report) { > print "not an arf report ($@)\n"; > exit 0; > } > >
Uff, sorry, I expected to recive undefined variable $report, did not know I must use eval. Excuse me my unknowledge please!