http://qs321.pair.com?node_id=1107594


in reply to Re^2: Perl6::Form Issues with Zero-Padding and Declarative Width (integer)
in thread Perl6::Form Issues with Zero-Padding and Declarative Width

Hey there,

Glad you got it mostly sorted out and working. I'm sorry that my quick attempt to help was off the mark. But it did relate to your outstanding question about declarative field widths. Maybe this will help:

Declarative field widths add no formatting information. The field you were talking to Damian about was this:

{>>>>>}

Clearly a field of 7 characters. There is no other information in order for this field to be used at this point. If in addition, you want an automatically validated "checksum" to ensure that the field is actually the width you intended, you can add it as a length inside parentheses:

{>(7)>}

The field is still 7 characters long, just as before. The form code will rip the "(7)" out, validate that the 7 matches the actual field length, and then logically replace it with ">>>" to restore the real format.

None of this is very useful for a field of 7 characters, it can be eyeballed as correct pretty easily. But for a field of say 50+ characters, it's nice to have a double check.