Perl6::Form module implements the Perl 6 'form' built-in.
SYNOPSIS
use Perl6::Form;
$text = form " =================================== ",
"| NAME | AGE | ID NUMBER |",
"|----------+------------+-----------|",
"| {>} |",
$name, $age, $ID,
"|===================================|",
"| COMMENTS |",
"|-----------------------------------|",
"| {[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[} |",
$comments,
" =================================== ";
Formats are Perl 5's mechanism for creating text templates with fixed-width fields. Those fields are then filled in using values from prespecified package variables.
Unlike Perl 5, Perl 6 doesn't have a format keyword. Or the associated built-in formatting mechanism. Instead it has a Form.pm module. And a form function.
Like a Perl 5 format statement, the form function takes a series of format (or "picture") strings, each of which is immediately followed by a suitable set of replacement values. It interpolates those values into the placeholders specified within each picture string, and returns the result:
$text = form
$format_f1,
$datum1, $datum2, $datum3,
$format_f2,
$datum4,
$format_f3,
$datum5;
So, whereas in Perl 5 we might write:
# Perl 5 code...
our ($name, $age, $ID, $comments);
format STDOUT
===================================
| NAME | AGE | ID NUMBER |
|----------+------------+-----------|
| @>> |
$name, $age, $ID,
|===================================|
| COMMENTS |
|-----------------------------------|
| ^
Product's homepage
Requirements:
· Perl