Directly changing the body

Vic Norton <[email protected]> Mon, 7 Feb 2005 15:58:20 -0500
Newsgroups gmane.comp.lang.perl.modules.mail-box
Message-ID <p06210206be2d85142a62@[192.168.1.100]>
I'm not sure what I did (Re: Directly changing To & From field in the 
header). I think I tested the Gilles construction on the wrong 
letter. In any case now

my $tofield = Mail::Message::Field->new(
    To => "\"Vic\" <norton\@dacor.net> (comment)"
);
$msg->head->reset('To', $tofield);
$msg->print;

works fine.

So my second question is this. How can one replace the body of a 
single-part message on the fly?

Regards,

Vic

At 7:48 PM +0100 2/6/05, Gilles wrote:
>
>>  $msg->head->reset('To', "\"Vic\" <norton\@dacor.net>");  # problem here
>>
>>  What is wrong with this example. Why can't I
>>  reset the 'To' field. I get the error message
>>
>>  Error: File Complete.pm; Line 172:
>>    Can't call method "clone" without a package or object reference
>
>The arguments to "reset" are
>  1. the name of the field (a string)
>  2. a list of "Mail::Message::Field" objects (*not* a string)
>
>So, the following works:
>
>$msg->head->reset( 'To', Mail::Message::Field->new( 'To', "\"Vic\" 
><norton\@dacor.net>") ) ;
>
>
>Best regards,
>Gilles