mascip has asked for the wisdom of the Perl Monks concerning the following question:
Hello,
with Moose i used MooseX::ClassAttribute to declare class attributes. I am thinking about transitioning to Moo, and am wondering how to best deal with class attributes.
For example, i am sharing a timer between all the objects of a class. I used to write
package MyClass; use Moose; use MooseX::ClassAttribute; class_has 'timer' => ( is => 'ro', isa => 'Benchmark::Timer', default => sub { Benchmark::Timer->new() }, );
Now with Moo i have just used the "good old way" (maybe not that "good"?) :
Is there any nicer way to do that?package MyClass; use Moo; my $timer = Benchmark::Timer->new();
Back to
Seekers of Perl Wisdom