|Syntactic Confectionery Delight|
ISO lightweight wrapper class for numbersby tlm (Prior)
|on Feb 21, 2009 at 17:39 UTC||Need Help??|
tlm has asked for the
wisdom of the Perl Monks concerning the following question:
Dear brothers and sisters,
I am looking for a lightweight class that I can wrap around numeric values.
Granted, as wheels go, this looks like a pretty easy one to re-invent... For my immediate needs, this may be enough:
But from bitter experience I've learned to resist as much as possible these seemingly trivial wheel re-invention projects. Hence I come to you for wisdom and guidance. Do you know of a well-tested class in CPAN that could serve this purpose?
the lowliest monk
PS: The reason behind this quest is convoluted, and I'd hate to bore you with it, but if you must know, here it is. The Storable module does dastardly things to numeric values, and my code must JSON-encode and transmit stuff that has been through one Storable::store/Storable::retrieve cycle. The purpose of this wrapper class is to selectively tag those data items that I want treated as numbers by JSON::XS before committing them to Storable::store, and then replace them with their underlying values once the whole thing has been Storable::retrieve'd. If there's a better way around this annoyance, please let me know.