view BoosterPack/Card.pm @ 0:0d795f02a8bb tip

initial committ. what was I thinking?
author Robert McIntyre <rlm@mit.edu>
date Mon, 27 Sep 2010 16:57:26 -0400
parents
children
line wrap: on
line source
1 package Card;
2 use List::Util qw(first max maxstr min minstr reduce shuffle sum);
4 sub new
5 {
6 my $class = shift;
8 my $hashREF =
9 {
10 _tags => {},
11 _pix => ""
12 };
14 $objectREF = bless($hashREF, $class);
16 return $objectREF;
18 }
21 sub getTags
22 {
23 $bull = @_[0]->{'_tags'};
24 return keys(%$bull);
25 };
26 sub addTags
27 {
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 hasTags
40 {
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;