parse body mime message

J

jcharth

Hello I am downloading a mime from a web server using lwp
my $fullpage = $ua->request($req)->as_string;
then i was trying to extract the text body of the mesage using MIME
tools but i cant seem get this to work
when i do
$parser->parse_data($fullpage)
i get
Can't use string ("MIME::parser") as a HASH ref while "strict refs" in
use at /usr/lib/perl5/site_perl/5.8.0/MIME/Parser.pm line 279.

not sure what i am doing wrong
thanks.
 
P

Paul Lalli

Hello I am downloading a mime from a web server using lwp
my $fullpage = $ua->request($req)->as_string;
then i was trying to extract the text body of the mesage using MIME
tools but i cant seem get this to work
when i do
$parser->parse_data($fullpage)
i get
Can't use string ("MIME::parser") as a HASH ref while "strict refs" in
use at /usr/lib/perl5/site_perl/5.8.0/MIME/Parser.pm line 279.

not sure what i am doing wrong

Neither are we, and it's pretty hard to guess without seeing the
*actual* code. I refuse to believe that those two simple lines are
enough to cause the error. Please post a SHORT but COMPLETE script
that demonstrates the error you're having. Also, please read the
Posting Guidelines for this group, which would have told you to do that
in the first place.

Paul Lalli
 
M

Mark Clements

Hello I am downloading a mime from a web server using lwp
my $fullpage = $ua->request($req)->as_string;
then i was trying to extract the text body of the mesage using MIME
tools but i cant seem get this to work
when i do
$parser->parse_data($fullpage)
i get
Can't use string ("MIME::parser") as a HASH ref while "strict refs" in
use at /usr/lib/perl5/site_perl/5.8.0/MIME/Parser.pm line 279.

not sure what i am doing wrong
thanks.
How have you created $parser?

use strict;
use warnings;

use MIME::parser;

my $parser = MIME::parser->new();

would be usual (see perldoc MIME::parser).

Have you done something like:

mark@owl:~$ cat testmimeparser.pl
use strict;
use warnings;

use MIME::parser;

my $parser = "MIME::parser";

$parser->parse_data("this is not a test");
mark@owl:~$ perl testmimeparser.pl
Can't use string ("MIME::parser") as a HASH ref while "strict refs" in
use at /usr/share/perl5/MIME/Parser.pm line 279.

As Paul says, you need to check out the posting guidelines - you haven't
given us much to go on.

Mark
 
J

jcharth

Looks like something is fishy in my perl module

#!/usr/bin/perl

use MIME::parser;
my $parser = "MIME::parser";

#$parser->parse_data("$fullpage");
$parser->parse_data("fullpage");

#dump_entity($parser);


Content-type:text/plain

Can't use string ("MIME::parser") as a HASH ref while "strict refs" in
use at /usr/lib/perl5/site_perl/5.8.0/MIME/Parser.pm line 279.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,262
Messages
2,571,056
Members
48,769
Latest member
Clifft

Latest Threads

Top