Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
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 musing on the Monastery: (3)
As of 2014-09-21 17:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (173 votes), past polls