Re: Directly changing To & From field in the header

Gilles <[email protected]> Sun, 6 Feb 2005 19:48:54 +0100
Newsgroups gmane.comp.lang.perl.modules.mail-box
Message-ID <[email protected]>
 
> $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