Mercurial > boosterpack
view Card.pm @ 5:e91d6f908222 boosterpack
[svn r7] finished!
author | robert |
---|---|
date | Tue, 08 Sep 2009 06:55:23 -0400 |
parents | 477258d09353 |
children | 8c6d2ce90677 |
line wrap: on
line source
1 package Card;2 use List::Util qw(first max maxstr min minstr reduce shuffle sum);4 sub new5 {6 my $class = shift;8 my $hashREF =9 {10 _tags => {},11 _pix => ""12 };14 $objectREF = bless($hashREF, $class);16 return $objectREF;18 }21 sub getTags22 {23 $bull = @_[0]->{'_tags'};24 return keys(%$bull);25 };26 sub addTags27 {28 $object = shift;29 @add = @_;30 if (@add)31 {32 @ohYeah = ($object->getTags(),@add);33 foreach(@ohYeah){$object->{_tags}{$_} = "";}34 }35 return $object->getTags();36 };39 sub hasTags40 {41 $card = shift;42 @rest = @_;43 @test = $card->getTags();44 foreach $e(@rest){if (! (first {$e eq $_} @test)){return 0;}}45 return 1;46 }49 sub setPix { $_[0]->{_pix} = $_[1]; }50 sub getPix {return $_[0]->{_pix} ; }53 1;