Re: Moo and Moose together with Throwable::Error.

[email protected] (Bill Moseley)
Newsgroups perl.moose
Message-ID <CAKhN_m6=834eXcvo6ga-UyyK3DDKacJ8ZJFwngdn0GuYbwSkVA@mail.gmail.com>
On Wed, Feb 20, 2013 at 11:18 AM, Tomas Doran <[email protected]> wrote:

>
> On 20 Feb 2013, at 06:36, Bill Moseley <[email protected]> wrote:
>
> > Am I correct that "around" just will not work any more?
> >
>
> No, this should just work.
>
> The Moo class will get upgraded to a Moose class automatically, you
> shouldn't need to do anything - this should 'just work'.
>
> It's a bug in Moo if it doesn't (and one that will get fixed if you can
> provide a simpleish test - which sounds easy in this case).
>

Moo $VERSION = '1.000004'; # 1.0.4
$Moose::VERSION = '2.0604';
$Throwable::Error::VERSION = '0.200003';



package My::Throwable;
use Moose;
extends 'Throwable::Error';

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

package main;

My::Throwable->throw({ message => 'oops', });


The method '_build_stack_trace_args' was not found in the inheritance
hierarchy for My::Throwable at
/home/bill/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/x86_64-linux/Class/MOP/Class.pm
line 1053.

But I can override:

package My::Throwable;
use Moose;
extends 'Throwable::Error';

sub _build_stack_trace_args { die "override works!\n" }

package main;

My::Throwable->throw({ message => 'oops', });


override works!

shell returned 255




-- 
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.