llancet has asked for the wisdom of the Perl Monks concerning the following question:
In a concrete page class, It may need to contain special font objects for layout calculation:package RolePage; use Moose::Role; has textFont => ( is => 'rw', isa => 'Str', default => 'Courier' ); has textSize => ( is => 'rw', isa => 'Int', default => 12 );
So, when changing on textFont or textSize occurred, such font object should be refreshed. It seems trigger mechanism is a optimum way to do that.package CairoPage; use Moose; use Cairo; with 'RolePage'; has cairoFont => ( is => 'bare', isa => 'Cairo::ScaledFont' );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Moose: possible way to implement trigger in other packages?
by stvn (Monsignor) on Jul 04, 2010 at 23:54 UTC | |
|
Re: Moose: possible way to implement trigger in other packages?
by tcurtis (Acolyte) on Jul 06, 2010 at 21:42 UTC |