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

dwm042 has asked for the wisdom of the Perl Monks concerning the following question:

I'm running into Moose through Catalyst, and liking what I see of Moose. I've worked in C++ before, with the endless getters and putters, the constructors from hell. For complex classes, the savings in time and clarity gained is worth the code layer.

But how complex does it have to be to be a win? Obviously I'm fishing for judgments here based on the experience of the Monks, as I have just my exposure over the past couple weeks of Catalyst hacking. For something as simple as a stack I'm not sure it's a win over

my @stack; push @stack, $foo; my $saved_value = pop @stack;

That said, in Catalyst, a Moose based model can be preloaded with stuff, from a config file, and it isn't that much harder to do things like

my $moose_stack = MyApp::MooseStack->new(); $moose_stack->add_item($foo ); if ( $moose_stack->has_item ) { $saved_value = $moose_stack->pop_item; }

My gut feeling though is, the bigger the collection of related data structures in a class, the bigger the potential win. And I'm curious how others feel about this issue.

David.