in reply to Re: Choosing namespace/name for (my first) CPAN module which is a sub-class of a well-known distribution
in thread Choosing namespace/name for (my first) CPAN module which is a sub-class of a well-known distribution
This approach fails for your given example input of 3.14159:
use strict; use warnings; use Test::More tests => 1; my $val = 3.14159; my $oldval = $val; my $newval = do { use B; if ( not B::SVf_POK & B::svref_2object( \$val )->FLAGS or -1 != index $val, 'e' ) { $val = sprintf '%.4f', $val; $val =~ s/\.?0+$// } "$val" }; is "$oldval", "$newval";
I think you have to either "round to an arbitrarily sane length" as your code does or else just go with the flow.
🦛
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Choosing namespace/name for (my first) CPAN module which is a sub-class of a well-known distribution
by Anonymous Monk on Oct 30, 2024 at 12:06 UTC |