in reply to Re^3: Mail::Message->get('received') failing
in thread Mail::Message->get('received') failing

Sorry, its just that I've been so frustrated by this and my code is so simple I am virtually certain the problem is in the Mail::Message code somewhere.
#!/usr/bin/perl -w use strict; use Mail::Message; use Data::Dumper; my $msg=Mail::Message->read(\*STDIN); my $head=Mail::Message::Head->new(); my $from=$msg->from; my @to=$msg->to; my @subject=$msg->subject; my @recv=$head->get('received'); print(Dumper(@recv),"\n");

Replies are listed 'Best First'.
Re^5: Mail::Message->get('received') failing
by Fletch (Bishop) on Nov 12, 2008 at 19:30 UTC

    You construct a brand new Mail::Message::Head instance which has no connection to the existing message in $msg that you've read in. It's not surprising that it contains no headers. Perhaps if you try my $head = $msg->head() it'll be more matching your expectations?

    (See, I told you showing actual code would help. :)

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

      I guess I have to stop assuming purported working examples really work. I was puzzled by that too but I thought the 'new' function internally to the package already had what it needed from the 'read'. I'll give it a try.
      Yep. That did it. I'm giving up on googled examples. I guess when I have a question, I'll ask instead. Thanks again.