Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: The speed of blessed hashrefs, the power of Moose - how to get both?

by zwon (Abbot)
on Nov 20, 2011 at 03:28 UTC ( [id://939028]=note: print w/replies, xml ) Need Help??


in reply to The speed of blessed hashrefs, the power of Moose - how to get both?

sub blessed_hashref { my $state = bless { %args }, 'Foo'; }

You are not checking arguments here. In definition of MooseState you specified things like isa => 'Int', so constructor checks arguments. You're testing constructions which are not functionally equal. Remove these isa or add checks to blessed_hashref to get something that makes sense.

Replies are listed 'Best First'.
Re^2: The speed of blessed hashrefs, the power of Moose - how to get both?
by dynamo (Chaplain) on Nov 20, 2011 at 19:55 UTC
    This is a very important point, it's a stacked comparison. You can either put in checks in the hashref (though it might provoke argument over what exactly would be equivalent), or you can take out the checks from Moose.
      If you're going to take the checks out, why use Moose? Seriously, just use a href directly. (When do you really need method calls to attributes? Encapsulation? Hello, mantra. You're adding these unnecessary layers when you don't really need it. If you need it later, add it later! Perl is not compiled. Why are you creating a static API?)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://939028]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2024-04-23 08:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found