Subject: | Breakage with MIME::Parser |
I suspect this may be an issue with MIME::Parser rather than
Devel::Events::Objects, but I've reported it here in case you want to
code around the issue in a future release.
$ perl -MMIME::Parser -e 'print "$MIME::Parser::VERSION\n"'
5.425
Attached test script results in the following:
Can't locate object method "register" via package
"Devel::Events::Generator::Objects" at
/usr/local/lib/perl5/site_perl/5.8.8/MIME/Field/ConTraEnc.pm line 50.
Compilation failed in require at
/usr/local/lib/perl5/site_perl/5.8.8/MIME/Head.pm line 126.
BEGIN failed--compilation aborted at
/usr/local/lib/perl5/site_perl/5.8.8/MIME/Head.pm line 126.
Compilation failed in require at
/usr/local/lib/perl5/site_perl/5.8.8/MIME/Parser.pm line 143.
BEGIN failed--compilation aborted at
/usr/local/lib/perl5/site_perl/5.8.8/MIME/Parser.pm line 143.
Compilation failed in require at d.pl line 24.
The error results from use of the single argument form of bless() in
MIME::Parser:
$ grep -rn "register" /usr/local/lib/perl5/site_perl/5.8.8/MIME/Field
/usr/local/lib/perl5/site_perl/5.8.8/MIME/Field/ContDisp.pm:51:bless([])->register('Content-disposition');
/usr/local/lib/perl5/site_perl/5.8.8/MIME/Field/ContType.pm:69:bless([])->register('Content-type');
/usr/local/lib/perl5/site_perl/5.8.8/MIME/Field/ConTraEnc.pm:50:bless([])->register('Content-transfer-encoding');
Commenting those lines out gets rid of the error.
I'm happy to go and hassle the author of MIME::Parser if that's the best
thing to do, but presumably this problem could occur with any code that
contains the single argument form of bless(). I don't know if that means
you'd want to code around it in a future release of
Devel::Events::Objects, or for that matter whether it's possible to code
around. Advice needed please.
Subject: | test.pl |
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use Devel::Cycle;
use Devel::Events::Handler::ObjectTracker;
use Devel::Events::Filter::RemoveFields;
use Devel::Events::Generator::Objects;
my $tracker = Devel::Events::Handler::ObjectTracker->new();
my $gen = Devel::Events::Generator::Objects->new(
handler => Devel::Events::Filter::RemoveFields->new(
fields => [qw/generator/], # don't need to have a ref to $gen in each event
handler => $tracker,
),
);
$gen->enable(); # start generating events
require MIME::Parser;
$gen->disable(); # stop generating events