Re: Bug : Mail::Message::Head::FieldGroup::attach stringifies object
Mark Overmeer <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.mail-box |
|---|---|
| Organization | MARKOV Solutions |
| Message-ID | <[email protected]> |
* Timur I. Bakeyev ([email protected]) [040331 18:34]: > my $sg = new Mail::Message::Head::SpamGroup(software => 'MINE'); > my $own_sg = $head->addSpamGroup($sg); > > dying with the: > Can't use string ("Mail::Message::Head::SpamGroup") as a > HASH ref while "strict refs" in use at > /spool/timur/perllib/Mail/Message/Head/FieldGroup.pm line > 56, <GEN0> line 163. > > Bogus, isn't it? Yes, it is. Victim of clean-ups in one of the recent releases. > So, after an hour with debugger it was tracked down to the > Mail::Message::Head::FieldGroup::attach method, which is > implemented like: Debuggers are slow ;-) try print statements ;-) > > sub attach($) > { my ($self, $head) = @_; > my $lg = ref($self)->clone; > $self->{MMHF_head} = $head; > > $head->add($_->clone) for $self->fields; > $lg; > } > > It seems, that taking ref($self) here is unnecessary :) At > least, that's the root of that evil stringification.. You're right (of course). This could simply become sub attach($) { my ($self, $head) = @_; $head->add($_->clone) for $self->fields; $self; } -- Thanks for the report, MarkOv ------------------------------------------------------------------------ drs Mark A.C.J. Overmeer MARKOV Solutions [email protected] [email protected] http://Mark.Overmeer.net http://solutions.overmeer.net