hesco has asked for the wisdom of the Perl Monks concerning the following question:
That code begins like so:cat /home/hesco/lib/perl/ETC/etc/vote2009.mbox | formail -s | /home/he +sco/lib/perl/ETC/parse_email.pl
and if I pipe that cat output to less instead of through my filter, I get what appears to be an email. How is it that value would be uninitialized?#!/usr/bin/perl use strict; use warnings; use Data::Dumper; use lib qw( /home/hesco/lib/perl ); use parser; my $email = $ARGV[0]; my($start,$to,$name,$pid,$key); open('EMAIL','>','/tmp/email_throw_away'); print EMAIL $email; # <--- error here ??? close(EMAIL);
So next I copied my .mbox file to itself, giving it a new extension of .sample, and edit the .sample so that it contains ONLY a single email, dropped the formail invocation from my pipe and try this:
yielding the same result:cat /home/hesco/lib/perl/ETC/etc/vote2009.sample | /home/hesco/lib/per +l/ETC/parse_email.pl
And now I am really confused.Use of uninitialized value $email in print at /home/hesco/lib/perl/ETC +/parse_email.pl line 13.
-- Hugh
UPDATE:
mortiz, zwon: So you are right. This seems to work much better:
Now to figure out why my formail -s is only giving me the first email in the mbox file. Thanks folks!cat /home/hesco/lib/perl/ETC/etc/vote2009.mbox | formail -s | /home/he +sco/lib/perl/ETC/parse_email.pl -
Never mind on that. formail -s expects the filter as an argument to the -s switch, not to pipe STDOUT to the filter. Issue resolved with:
cat /home/hesco/lib/perl/ETC/etc/vote2009.mbox | formail -s /home/hesc +o/lib/perl/ETC/parse_email.pl -
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: filter denies existence of input
by moritz (Cardinal) on Aug 22, 2009 at 15:43 UTC | |
|
Re: filter denies existence of input
by zwon (Abbot) on Aug 22, 2009 at 15:45 UTC | |
|
Re: filter denies existence of input
by dsheroh (Monsignor) on Aug 23, 2009 at 10:25 UTC |