Re: roles verify attribute contents when applied?

[email protected] (Mark Hedges)
Newsgroups perl.moose
Message-ID <[email protected]>


On Thu, 12 Jan 2012, Dave Rolsky wrote:

> It seems to me that this would be better written like this:
>
>   package Machine;
>   use Moose;
>
>   has power_cycler => (
>       is => 'ro',
>       does => 'PowerCycler',
>       handles => [ 'restart' ],
>   );
>
> In other words, make a separate object that represents the
> type of power cycler (or whatever you call it) and let
> that handle restarting the machine.

I haven't communicated clearly.  There may be a number of
different ways to power cycle depending on the attributes of
the host.  The point was to separate them into classes, then
add the right one to the machine object, granting a uniform
method that does what I mean.  There may be other methods
that come along with being one or another kind of hardware.
This seems over-abstract and indirect.

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