Re: Moose hook

[email protected] ("Fields, Christopher J")
Newsgroups perl.moose
Message-ID <[email protected]>
On Oct 18, 2011, at 10:02 AM, Peter Gordon wrote:

> This is the example I am working with: 
> 
> package MyRole ; 
> with Moose::Role ; 
> 
> # Operate on the 'has' items
> sub runMe { 
> } 
> 
> package X ; 
> use Moose ;
> has 'item' => ( is => 'rw' , isa => 'Str') ;
> 
> 
> package Y ;
> use Moose ; 
> extends 'X' ; 
> with 'MyRole';
> 
> 
> I would like to be able to define package MyRole such that when it is
> invoked, runMe() gets run automatically without having to run
> it explicitly in package Y.


Maybe use a custom attribute trait, attribute metaclass, a default, or a builder?  

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