Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Perl6::Form not printing 0 (zero)

by StuLong (Acolyte)
on Jan 20, 2017 at 16:23 UTC ( [id://1180026]=perlquestion: print w/replies, xml ) Need Help??

StuLong has asked for the wisdom of the Perl Monks concerning the following question:

I am using Perl6::Form, and have run into an issue wherein a numeric value of zero gets printed as octothorpes, as if the value is too large to fit the field. Happens for both single line and block format fields.

Perl is v5.16.3 on RHEL7. Form is 0.06.

use Perl6::Form; print form '{]].[}', [0,1];
results in
###.## 1.0

Field output is properly aligned on the decimal point, but the zero value field won't print. Anyone have any ideas how I can make my zeroes manifest themselves?

Update. Things get weirder. After reading more in Perl6:Form docs, I tried one of the examples, and discovered that if I make the field in the example above slightly larger, the zeroes print, but are not properly formatted.

print form '{]]].[}', [0,1]; 0.00. 1.0

Replies are listed 'Best First'.
Re: Perl6::Form not printing 0 (zero)
by toolic (Bishop) on Jan 20, 2017 at 16:41 UTC
    Here is what I get when I change 0 to 2:
    2.0 1.0

    I can't think of a way to get it to print a 0. The Perl6::Form spec is quite dense. Either 0 intentionally has special meaning, or it could be a bug. You could submit a bug report.

      I found the issue in Perl6::Form, and put in a bug report. I suggested a solution which fixes this particular problem.

      There's another transformation later in the code that truncates trailing zeroes from the after-the-decimal segment. I know what's doing it, I'm just not sure why. That's why both of our runs show a single zero after the decimal point when the format field specifies two decimal places.

Re: Perl6::Form not printing 0 (zero)
by poj (Abbot) on Jan 20, 2017 at 17:05 UTC

    I get 0.0 with version 0.04

    poj

      Ah, then it must be Damian's fault :)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (6)
As of 2024-04-23 18:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found