Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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 rifling through the Monastery: (4)
As of 2016-07-30 23:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?


















    Results (269 votes). Check out past polls.