开发者

Strange problem with Email::MIME - can't use string as a HASH ref

I'm having a strange problem with Email:MIME. I have the following code, which is intended to parse a MIME email message piped to it:

my $parsed = Email::MIME->new(<STDIN>);
print $parsed->body;

When I run this, either by piping a sample MIME email into it, or by setting my host to pipe new email to it and sending myself one, I get the following error on the first line:

> Can't use string ("Received: from
> servera02.tk2adsm") as a HASH ref
> while "strict refs" in use at
> /usr/lib/perl5/site_perl/5.8.8/Email/Simple.pm
> line 100, <STDIN> line 71.

The 开发者_开发问答line shown in the error varies according to the email but it is always the second line of the email content (so I'm really not very sure why it's claiming it's STDIN line 71). I've done some googling about this and it really seems to be unique to me - does anyone have any ideas?

I'm not a Perl expert by a long way, and I've never used Email::MIME, so I'm hoping this is something simple.

Chris


The documentation says that new() expects its argument to be a message in the form of a string. <STDIN> is an array (since an argument list is in list context).

Try converting the message to a string as you pass it: my $parsed = Email::MIME->new(join('', <STDIN>));


i mean you might not get the error if you turn off strict refs

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜