Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^3: Moose - ensuring a getter returns a number

by stvn (Monsignor)
on Feb 18, 2011 at 05:14 UTC ( #888851=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Moose - ensuring a getter returns a number
in thread Moose - ensuring a getter returns a number

Not likely, since Perl is so permissive about what is a number and what is a string, the Moose type constraint for numbers allows them to also be strings as well.

The solution with the around is actually pretty good, or as another responder points out, make sure that the value is a number before it is actually added to your data object.

-stvn


Comment on Re^3: Moose - ensuring a getter returns a number

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (12)
As of 2015-05-05 21:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    In my home, the TV remote control is ...









    Results (127 votes), past polls