view Card.pm @ 10:3b52ac950753 boosterpack tip

going to try to fix this thing
author Robert McIntyre <rlm@mit.edu>
date Mon, 27 Sep 2010 17:24:06 -0400
parents 8c6d2ce90677
children
line wrap: on
line source
1 #!/usr/bin/perl
3 package Card;
4 use List::Util qw(first max maxstr min minstr reduce shuffle sum);
6 sub new
7 {
8 my $class = shift;
10 my $hashREF =
11 {
12 _tags => {},
13 _pix => ""
14 };
16 $objectREF = bless($hashREF, $class);
18 return $objectREF;
20 }
23 sub getTags
24 {
25 $bull = @_[0]->{'_tags'};
26 return keys(%$bull);
27 };
28 sub addTags
29 {
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 hasTags
42 {
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;