in reply to Re: Surviving 'Illegal division by zero'
in thread Surviving 'Illegal division by zero'
What about the following syntactic sugar?
That would allow the following modification:sub new {my $f; bless \$f => shift; $f -> set(@_) if @_; $f}
my $fig_1 = MyNumber -> new (get_numeric_value_from_xml (...));
I only propose it because most constructors also allow for values to be passed in, which keeps to the Principle of Least Surprise.
------
We are the carpenters and bricklayers of the Information Age.
Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose
I shouldn't have to say this, but any code, unless otherwise stated, is untested
In Section
Seekers of Perl Wisdom