in reply to Perl6::Form Issues with Zero-Padding and Declarative Width
Yes, i think there is some kind of bug in there, either a documentation bug, or implementation bug, or both
perl6form doesn't have an INTeger field, so {0>>>>>} doesn't mean zero pad (that is only documented for decimal numbers ie floats)
Also, zero padding numeric fields only shows using {]].[[} not {>>.<<} so that could be a doc bug or implementation bug (not implemented, or error not detected)
So to fill that integer field with zeros you have to use lfill right before the value ... this works
#!/usr/bin/perl -- use strict; use warnings; use diagnostics; use Perl6::Form qw/ form /; print form { page => { width => ( 44 + 1), } }, "{<<{20}<<}|{>>>>>}", "Int for Zero Pad", {lfill => '0',} , 3 , "{<<{20}<<}|{]]].[[}", "Float for Zero Pad", 3.2, "{<<{20}<<}|{]]].[[0}", "Float for Zero Pad", 3.2, "{<<{20}<<}|{0]]].[[0}", "Float for Zero Pad", 3.2, ;;;;; __END__ Int for Zero Pad |0000003 Float for Zero Pad | 3.2 Float for Zero Pad | 3.2000 Float for Zero Pad |00003.2000
So maybe the implementation is incomplete, doesn't do the padding, or doesn't warn about invalid field pattern .... good job finding this AnaximanderThales
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl6::Form Issues with Zero-Padding and Declarative Width (integer)
by AnaximanderThales (Novice) on Nov 18, 2014 at 13:46 UTC | |
by Loops (Curate) on Nov 18, 2014 at 16:41 UTC | |
by AnaximanderThales (Novice) on Nov 18, 2014 at 19:27 UTC | |
by Loops (Curate) on Nov 18, 2014 at 19:39 UTC | |
by AnaximanderThales (Novice) on Nov 18, 2014 at 23:07 UTC | |
| |
by Anonymous Monk on Nov 19, 2014 at 00:55 UTC |