File: demo_starry.pl

package info (click to toggle)
libperl6-form-perl 0.090-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 584 kB
  • sloc: perl: 3,080; makefile: 8
file content (34 lines) | stat: -rwxr-xr-x 1,204 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use Perl6::Form;

$ID = 10565263827;
$retail = 173.87;
$disc = $retail * .95;
$tax = $retail * .12;

$desc = "3.5 in. closed length. Translucent ruby handle. Features, large & small blades, corkscrew, can opener with small screwdriver, bottle opener with large screwdriver, Perl interpreter, wire stripper, reamer, key ring, tweezers, toothpick, plus 12 other features.";

sub starbright {
    my ($match,$opts) = @_;
    $opts->{fill}='*';
	(my $whole = $match->[1]) =~ tr/*/>>/;
	 my $point = $match->[2];
	(my $fract = $match->[3]) =~ tr/*/<</;
    return "{$whole$point$fract}";
}

my $starlight = qr/ [{] ([*]+) ([.,]) ([*]+) [}] /x;

sub starfield() {
	return { field => [$starlight => \&starbright] };
}

print form starfield, {interleave=>1}, <<'.',
=================[ Quote for item: {>>>>>>>>>>>>>>>>} ]=================

      Retail: {******.*}        Desc: {<<<<<<<<<<<<>>>>>>>>>>>>>}
  Discounted: {******.*}              {VVVVVVVVVVVVVVVVVVVVVVVVV}
         Tax: {******.*}              {VVVVVVVVVVVVVVVVVVVVVVVVV}
                                      {VVVVVVVVVVVVVVVVVVVVVVVVV}
  {VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV}
.
      $ID, $retail, $desc, $disc, $tax;