Subject: | Issues with Declarative Widh and Zero-Paddidng fields |
Date: | Mon, 17 Nov 2014 19:26:59 -0600 |
To: | bug-Perl6-Form [...] rt.cpan.org |
From: | Christopher Pearson <chris [...] cuberootent.com> |
Perl6::Form
Perl v5.20.1 on Linux 3.16.0-25-generic #33-Ubuntu SMP x86_64 x86_64
x86_64 GNU/Linux
The code produces the corresponding included errors.
Not sure if I'm doing something wrong, or if something get off or if
I'm missing just breaking it through incorrect use.
==============================================
# Test Perl6::Form -- submitting code for Perl Monks
# zero-padded fields appears to be broken
# Declarative width fields appears to calculate the field length
# incorrectly
use strict;
use warnings;
use diagnostics;
use Perl6::Form;
my $columns = 44;
my $fID = "TEST";
my $tID = "003 ";
my $space = " ";
my $fPer = "Test";
my $tPer = "100.0";
my $fVal = "Int for Zero Pad";
my $tVal = "3";
my $fFlo = "Float for Zero Pad";
my $tFlo = 3.2;
# Produces error for invalid field length
print "Length = " . length($tID) . "\n";
print form { page => { width => ($columns + 1), } },
"{<<{15}<<}|{>(5)>}|{><}|{<<{15}<<}|{>(5)>}%|",
$fID, $tID, $space, $fPer, $tPer;
# Produces Unintialized value $whole in patter match (m//) error
print form { page => { width => ($columns + 1), } },
"{<<{20}<<}{0>>>>>}",
$fVal, $tVal,
"{<<{20}<<}{0>>>.>>0}",
$fFlo, $tFlo;
==============================================
Invalid field length error:
Length = 5
Uncaught exception from user code:
Inconsistent width for field 2.
Specified as '{>(5)>}' but actual width is 7
in call to &form at test_perl6Form.pl line 33.
Perl6::Form::fatal("Inconsistent width for field 2.\x{a}", "Specified
as '{>(5)>}' but actual width is 7") called at
/usr/local/share/perl/5.20.1/Perl6/Form.pm line 663
Perl6::Form::segment("{<<{15}<<}|{>(5)>}|{><}|{<<{15}<<}|{>(5)>}%|\x{a}",
ARRAY(0x1e676b8), HASH(0x1e5d400), 0, HASH(0x1e5d448)) called at
/usr/local/share/perl/5.20.1/Perl6/Form.pm line 1097
Perl6::Form::form(undef, undef, "TEST", "003 ", " ", "Test", 100.0)
called at test_perl6Form.pl line 33
==============================================
Unintialized value $whole in patter match (m//) error:
Use of uninitialized value $whole in pattern match (m//) at
/usr/local/share/perl/5.20.1/Perl6/Form.pm line 340 (#1)
(W uninitialized) An undefined value was used as if it were already
defined. It was interpreted as a "" or a 0, but maybe it was a
mistake.
To suppress this warning assign a defined value to your variables.
To help you figure out what was undefined, perl will try to tell you
the name of the variable (if any) that was undefined. In some cases
it cannot do this, so it also tells you what operation you used the
undefined value in. Note, however, that perl optimizes your program
and the operation displayed in the warning may not necessarily
appear
literally in your program. For example, "that $foo" is usually
optimized into "that " . $foo, and the warning will refer to the
concatenation (.) operator, even though there is no . in
your program.
Use of uninitialized value $places in pattern match (m//) at
/usr/local/share/perl/5.20.1/Perl6/Form.pm line 341 (#1)
Use of uninitialized value $whole in pattern match (m//) at
/usr/local/share/perl/5.20.1/Perl6/Form.pm line 342 (#1)
Use of uninitialized value $whole in repeat (x) at
/usr/local/share/perl/5.20.1/Perl6/Form.pm line 359 (#1)
Use of uninitialized value $point in concatenation (.) or string at
/usr/local/share/perl/5.20.1/Perl6/Form.pm line 359 (#1)
Use of uninitialized value $places in repeat (x) at
/usr/local/share/perl/5.20.1/Perl6/Form.pm line 359 (#1)
Use of uninitialized value $whole in repeat (x) at
/usr/local/share/perl/5.20.1/Perl6/Form.pm line 360 (#1)
Use of uninitialized value $point in concatenation (.) or string at
/usr/local/share/perl/5.20.1/Perl6/Form.pm line 360 (#1)
Use of uninitialized value $places in repeat (x) at
/usr/local/share/perl/5.20.1/Perl6/Form.pm line 360 (#1)
Use of uninitialized value $point in string ne at
/usr/local/share/perl/5.20.1/Perl6/Form.pm line 369 (#1)
Use of uninitialized value $whole in numeric gt (>) at
/usr/local/share/perl/5.20.1/Perl6/Form.pm line 399 (#1)
Use of uninitialized value $w in concatenation (.) or string at
/usr/local/share/perl/5.20.1/Perl6/Form.pm line 403 (#1)
Use of uninitialized value $p in concatenation (.) or string at
/usr/local/share/perl/5.20.1/Perl6/Form.pm line 403 (#1)
Use of uninitialized value $point in concatenation (.) or string at
/usr/local/share/perl/5.20.1/Perl6/Form.pm line 412 (#1)
Use of uninitialized value $whole in subtraction (-) at
/usr/local/share/perl/5.20.1/Perl6/Form.pm line 413 (#1)
Int for Zero Pad
Float for Zero Pad .