Acme-Colour
view release on metacpan or search on metacpan
my $red = "red";
my $green = "green";
my $yellow = $red + $green;
is($yellow->colour, "yellow"->colour, "red and green make yellow");
my $cyan = "cyan";
my $magenta = "magenta";
my $blue = $cyan - $magenta;
is($blue->colour, "blue"->colour, "cyan and magenta make blue");
# Now let's test the errors
throws_ok {$c = Acme::Colour->new("bogus1")} qr/Colour bogus1 is unknown/;
# We have to monkey about on the insides to test this
$c->{colour} = "bogus2";
throws_ok {$c->add("bogus3")} qr/Colour bogus2 is unknown/;
$c->{colour} = "red";
throws_ok {$c->add("bogus4")} qr/Colour bogus4 is unknown/;
( run in 0.409 second using v1.01-cache-2.11-cpan-74e6d1fb12f )