rlm@8: #!/usr/bin/perl rlm@8: rlm@8: package Card; rlm@8: use List::Util qw(first max maxstr min minstr reduce shuffle sum); rlm@8: rlm@8: sub new rlm@8: { rlm@8: my $class = shift; rlm@8: rlm@8: my $hashREF = rlm@8: { rlm@8: _tags => {}, rlm@8: _pix => "" rlm@8: }; rlm@8: rlm@8: $objectREF = bless($hashREF, $class); rlm@8: rlm@8: return $objectREF; rlm@8: rlm@8: } rlm@8: rlm@8: rlm@8: sub getTags rlm@8: { rlm@8: $bull = @_[0]->{'_tags'}; rlm@8: return keys(%$bull); rlm@8: }; rlm@8: sub addTags rlm@8: { rlm@8: $object = shift; rlm@8: @add = @_; rlm@8: if (@add) rlm@8: { rlm@8: @ohYeah = ($object->getTags(),@add); rlm@8: foreach(@ohYeah){$object->{_tags}{$_} = "";} rlm@8: } rlm@8: return $object->getTags(); rlm@8: }; rlm@8: rlm@8: rlm@8: sub hasTags rlm@8: { rlm@8: $card = shift; rlm@8: @rest = @_; rlm@8: @test = $card->getTags(); rlm@8: foreach $e(@rest){if (! (first {$e eq $_} @test)){return 0;}} rlm@8: return 1; rlm@8: } rlm@8: rlm@8: rlm@8: sub setPix { $_[0]->{_pix} = $_[1]; } rlm@8: sub getPix {return $_[0]->{_pix} ; } rlm@8: rlm@8: rlm@8: 1;