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 ( [id://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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-03-28 15:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found