elTriberium has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks!
I have the following problem that I can't get to work right now: In my parent Moose class I have the following code:
The child has:package Parent; use Moose; use Test::Most '!blessed'; sub BUILD { my ($self, $args) = @_; if ($args->{'tests'}) { plan tests => $args->{'tests'}; } }
package Child; use Moose; extends qw(Parent); sub run { my ($self) = @_; ok(1, "a simple test"); } __PACKAGE__->new(tests => 1)->run;
However, this doesn't work because the subs of Test::Most are not in the namespace of the child:
Undefined subroutine &Child::ok called at oo_test.pl line 8.
So my question is: Is there a recommended way to export subs of non-Moose classes in Moose?
Thanks!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Moose: Exporting non-moose subs to child
by Khen1950fx (Canon) on Jul 21, 2011 at 08:40 UTC | |
Re: Moose: Exporting non-moose subs to child
by moritz (Cardinal) on Jul 21, 2011 at 08:04 UTC | |
by elTriberium (Friar) on Jul 21, 2011 at 16:04 UTC | |
by moritz (Cardinal) on Jul 21, 2011 at 18:28 UTC | |
by elTriberium (Friar) on Jul 21, 2011 at 18:45 UTC |
Back to
Seekers of Perl Wisdom