Subject: | Bug in Mail/Message/Construct/Rebuild.pm (line 156) [sub descendNested] |
Hi,
In using your module I discovered a problem with certain messages when
employing it to strip/convert html versions of emails. I tracked it down
to nested emails with html versions, and I believe is caused by a bug
within descendNested.
Mail/Message/Construct/Rebuild.pm (line 156) [sub descendNested]
my $rebuild = ref($part)->new(head => $part->head->clone);
calls Mail::Message::Part->new with only one argument (most importantly
and to the point without the 'container' argument), this causes
Part->init to fail due to ...
Mail/Message/Part.pm (line 20) [sub init]
confess "No container specified for part.\n"
unless exists $args->{container};
As such I would suggest the following fix to line 156 the within Rebuild.pm
156c156
< my $rebuild = ref($part)->new(head => $part->head->clone,
container => undef);
---
Show quoted text
> my $rebuild = ref($part)->new(head => $part->head->clone);
This operates in a similar manner to descendMultparts, by passing the
container argument as undefined.
~Mat Johns
mat@cyberfish.org
----
No container specified for part.
Mail::Message::Part::init('Mail::Message::Part=HASH(0x8571058)',
'HASH(0x856e6d8)') called at
/usr/lib/perl5/site_perl/5.8.4/Mail/Reporter.pm line 23
Mail::Reporter::new('Mail::Message::Part', 'head',
'Mail::Message::Head::Partial=HASH(0x8570fd4)') called at
/usr/lib/perl5/site_perl/5.8.4/Mail/Message/Construct/Rebuild.pm line 156
Mail::Message::descendNested('Mail::Message=HASH(0x84f4734)',
'Mail::Message::Part=HASH(0x851772c)', 'rules', 'ARRAY(0x85222ec)')
called at
/usr/lib/perl5/site_perl/5.8.4/Mail/Message/Construct/Rebuild.pm line 267
Mail::Message::recursiveRebuildPart('Mail::Message=HASH(0x84f4734)',
'Mail::Message::Part=HASH(0x851772c)', 'rules', 'ARRAY(0x85222ec)')
called at
/usr/lib/perl5/site_perl/5.8.4/Mail/Message/Construct/Rebuild.pm line 115
Mail::Message::descendMultiparts('Mail::Message=HASH(0x84f4734)',
'Mail::Message=HASH(0x84f4734)', 'rules', 'ARRAY(0x85222ec)') called at
/usr/lib/perl5/site_perl/5.8.4/Mail/Message/Construct/Rebuild.pm line 267
Mail::Message::recursiveRebuildPart('Mail::Message=HASH(0x84f4734)',
'Mail::Message=HASH(0x84f4734)', 'rules', 'ARRAY(0x85222ec)') called at
/usr/lib/perl5/site_perl/5.8.4/Mail/Message/Construct/Rebuild.pm line 41
Mail::Message::rebuild('Mail::Message=HASH(0x84f4734)',
'keep_message_id', 1, 'extra_rules', 'ARRAY(0x8516198)') called at
/usr/lib/perl5/site_perl/5.8.4/Mail/Message/Construct.pm line 56
Mail::Message::AUTOLOAD('Mail::Message=HASH(0x84f4734)',
'keep_message_id', 1, 'extra_rules', 'ARRAY(0x8516198)') called at
test3.pl line 14
----
# perl -v
This is perl, v5.8.4 built for i486-linux
Copyright 1987-2004, Larry Wall
Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.
----
# uname -a
Linux puma 2.4.26 #13 SMP Wed Dec 7 01:39:39 GMT 2005 i686 unknown
unknown GNU/Linux