Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: The best Moo::Role way to do an alias to 'after BUILD'

by tobyink (Abbot)
on Jan 04, 2013 at 20:57 UTC ( #1011719=note: print w/replies, xml ) Need Help??

in reply to The best Moo::Role way to do an alias to 'after BUILD'

Maybe something like...

{ package Weborama::Collect::CreativesValidator; use Moo::Role; use MooX::ClassAttribute; class_has _registered_validators => ( is => 'ro', default => sub { [] }, ); has _creative_validators => ( is => 'ro', default => sub { [] }, ); sub register_validator { my $class = shift; push @{$class->_registered_validators}, @_; } after BUILD => sub { my $self = shift; my $class = ref $self; push @{$self->_creative_validators}, @{$class->_registered_validat +ors}; }; } { package Weborama::ForcedPause; use Moo::Role; with 'Weborama::Collect::CreativesValidator'; # you have to define that one requires qw/creatives_validator_publisher_forced_pause_settings/; __PACKAGE__->register_validator(sub { my ( $self, @creatives ) = @_; ... }); }
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1011719]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2017-02-20 16:13 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (300 votes). Check out past polls.