Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Math::Round::Var::round() takes no action when a number is not supplied

by BrowserUk (Patriarch)
on Aug 30, 2011 at 17:04 UTC ( [id://923268]=note: print w/replies, xml ) Need Help??


in reply to Math::Round::Var::round() takes no action when a number is not supplied

It seems to raise a perfectly valid exception for me:

sub round { my $self = shift; my $rnd = $self->{precision}; my $number = shift; return(sprintf("%0.${rnd}f", $number)); };; print round( {precision=>3}, 1.23456 );; 1.235 print round( {precision=>3}, 1 );; 1.000 print round( {precision=>3} );; Use of uninitialized value $number in sprintf at ... 0.000

(Though quite why you'd use a module for this is beyond me?)


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re: Math::Round::Var::round() takes no action when a number is not supplied
  • Download Code

Replies are listed 'Best First'.
Re^2: Math::Round::Var::round() takes no action when a number is not supplied
by metaperl (Curate) on Aug 31, 2011 at 02:25 UTC
    It seems to raise a perfectly valid exception for me
    Well, a Perl-generated warning is not the same as a program-generated exception, and here we have only a Perl-generated warning.
      a Perl-generated warning is not the same as a program-generated exception,

      Really? So how do you handle them differently?


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-25 09:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found