Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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 contemplating the Monastery: (8)
As of 2014-12-25 03:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (159 votes), past polls