Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

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'


Comment on Re: The best Moo::Role way to do an alias to 'after BUILD'
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1011719]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (11)
As of 2014-07-30 20:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (240 votes), past polls