Moo and Moose together with Throwable::Error.

[email protected] (Bill Moseley)
Newsgroups perl.moose
Message-ID <CAKhN_m7YReVHTrVgXBfdy5mkh1+LDRm1qjBs8fc99cwsF8eBwg@mail.gmail.com>
I'm curious how Moo and Moose play together.

I have some classes that make use of
Throwable::Error<http://search.cpan.org/dist/Throwable/lib/Throwable/Error.pm>,
which uses the StackTrace::Auto role.   The problem is StackTrace::Auto
builds Devel::StackTrace without the "no_refs" option set, so my objects
leak.  (They don't get DEMOLISHED until global destruction.)

My quick fix was to add this wrapper to my Throwable::Error subclass to add
the no_refs argument to Devel::StackTrace:

around _build_stack_trace_args => sub {
    my ( $orig, $self, @rest ) =  @_;
    my $args_array = $self->$orig( @rest );
    push @{$args_array}, no_refs => 1;
    return $args_array;
};


This worked fine until I updated Throwable::Error which now uses Moo
instead of Moose.

Am I correct that "around" just will not work any more?

Do I have any other options other than overriding the entire
_build_stack_trace_method (besides trying to get no_refs added to the
Throwable dist)?

Thanks,



-- 
Bill Moseley
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.