rdhoggan has asked for the wisdom of the Perl Monks concerning the following question:
I am developing a script for parsing email attachments with XML data in them. The script runs just fine when there is only one message in the inbox but breaks when there is more than one. The error message is as follows:</>
Can't call method "XMLin" on unblessed reference at new_test.pl line 126.
As can be seen in the following code snippet, I have tried a couple of different things including using bless but I am not sure what the problem is.
foreach my $msgnum (keys %$msgnums) { print "Parsing email...\n"; #Get current messgae and create MIME object $lines = $pop3->get($msgnum); $current = join('', @$lines); $parsed = Email::MIME->new($current); #For each part in the message, extract the xml data foreach $part ($parsed->parts) { if (($part->{ct}->{discrete} eq 'application') && ($pa +rt->{ct}->{composite} eq 'plain')) { $xmlData = $part->body; #print $xmlData; #$xml = $xml->XMLin($xmlData); } } #For each extracted part of the xml data, parse the xml $xml = $xml->XMLin($xmlData); print "Component Data\n"; .... }
Any help would be greatly appreciated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Unblessed Reference Error, XMLin
by bart (Canon) on Apr 09, 2012 at 20:06 UTC | |
|
Re: Unblessed Reference Error, XMLin
by Anonymous Monk on Apr 09, 2012 at 21:53 UTC |