http://www.perlmonks.org?node_id=1010446

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"?) :

package MyClass; use Moo; my $timer = Benchmark::Timer->new();
Is there any nicer way to do that?