Mercurial > boosterpack
view Card.pm @ 8:8c6d2ce90677 boosterpack
[svn r11] saving for transference to cd
author | rlm |
---|---|
date | Fri, 19 Mar 2010 07:28:10 -0400 |
parents | 477258d09353 |
children |
line wrap: on
line source
1 #!/usr/bin/perl3 package Card;4 use List::Util qw(first max maxstr min minstr reduce shuffle sum);6 sub new7 {8 my $class = shift;10 my $hashREF =11 {12 _tags => {},13 _pix => ""14 };16 $objectREF = bless($hashREF, $class);18 return $objectREF;20 }23 sub getTags24 {25 $bull = @_[0]->{'_tags'};26 return keys(%$bull);27 };28 sub addTags29 {30 $object = shift;31 @add = @_;32 if (@add)33 {34 @ohYeah = ($object->getTags(),@add);35 foreach(@ohYeah){$object->{_tags}{$_} = "";}36 }37 return $object->getTags();38 };41 sub hasTags42 {43 $card = shift;44 @rest = @_;45 @test = $card->getTags();46 foreach $e(@rest){if (! (first {$e eq $_} @test)){return 0;}}47 return 1;48 }51 sub setPix { $_[0]->{_pix} = $_[1]; }52 sub getPix {return $_[0]->{_pix} ; }55 1;