File: triangle.pl

package info (click to toggle)
libmoox-struct-perl 0.020-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 288 kB
  • sloc: perl: 430; sh: 6; makefile: 2
file content (23 lines) | stat: -rw-r--r-- 382 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use strict;
use Data::Printer;
use MooX::Struct
	Triangle => [qw/ $a! $b! $c! /],
	Quad     => [qw/ $a! $b! $c! $d! /],
	Point    => [qw/ +x +y /],
;

my $triangle = Triangle[
	Point[0, 0],
	Point[1, 1],
	Point[1, 0],
];

my $square = Quad[
	Point[0, 0],
	Point[0, 1],
	Point[1, 1],
	Point[1, 0],
];

my %shapes = ( three_sided => [$triangle] , four_sided => [$square] );
p %shapes;