diff 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 diff
     1.1 --- a/Card.pm	Thu Sep 10 08:01:18 2009 -0400
     1.2 +++ b/Card.pm	Fri Mar 19 07:28:10 2010 -0400
     1.3 @@ -1,53 +1,55 @@
     1.4 -package Card;
     1.5 -use List::Util qw(first max maxstr min minstr reduce shuffle sum);
     1.6 -
     1.7 -sub new
     1.8 -{
     1.9 -	my $class = shift;
    1.10 -	
    1.11 -	my $hashREF = 
    1.12 -	{
    1.13 -		_tags => {},
    1.14 -		_pix  => ""
    1.15 -	};
    1.16 -	
    1.17 -	$objectREF = bless($hashREF, $class);
    1.18 -	
    1.19 -	return $objectREF;	
    1.20 -	
    1.21 -}
    1.22 -
    1.23 -
    1.24 -sub getTags 
    1.25 -{ 
    1.26 -	$bull = @_[0]->{'_tags'};
    1.27 -	return keys(%$bull);
    1.28 -};
    1.29 -sub addTags 
    1.30 -{
    1.31 -	$object = shift;
    1.32 -	@add = @_;
    1.33 -	if (@add)
    1.34 -		{
    1.35 -			@ohYeah = ($object->getTags(),@add);
    1.36 -			foreach(@ohYeah){$object->{_tags}{$_} = "";}
    1.37 -		}
    1.38 -	return $object->getTags();
    1.39 -};
    1.40 -
    1.41 -
    1.42 -sub hasTags
    1.43 -{
    1.44 -	$card = shift;
    1.45 -	@rest = @_;
    1.46 -	@test = $card->getTags();
    1.47 -	foreach $e(@rest){if (! (first {$e eq $_} @test)){return 0;}}
    1.48 -	return 1;
    1.49 -}
    1.50 -
    1.51 -
    1.52 -sub setPix { $_[0]->{_pix} = $_[1]; }
    1.53 -sub getPix {return $_[0]->{_pix} ; }
    1.54 -
    1.55 -
    1.56 -1; 
    1.57 \ No newline at end of file
    1.58 +#!/usr/bin/perl
    1.59 +
    1.60 +package Card;
    1.61 +use List::Util qw(first max maxstr min minstr reduce shuffle sum);
    1.62 +
    1.63 +sub new
    1.64 +{
    1.65 +	my $class = shift;
    1.66 +	
    1.67 +	my $hashREF = 
    1.68 +	{
    1.69 +		_tags => {},
    1.70 +		_pix  => ""
    1.71 +	};
    1.72 +	
    1.73 +	$objectREF = bless($hashREF, $class);
    1.74 +	
    1.75 +	return $objectREF;	
    1.76 +	
    1.77 +}
    1.78 +
    1.79 +
    1.80 +sub getTags 
    1.81 +{ 
    1.82 +	$bull = @_[0]->{'_tags'};
    1.83 +	return keys(%$bull);
    1.84 +};
    1.85 +sub addTags 
    1.86 +{
    1.87 +	$object = shift;
    1.88 +	@add = @_;
    1.89 +	if (@add)
    1.90 +		{
    1.91 +			@ohYeah = ($object->getTags(),@add);
    1.92 +			foreach(@ohYeah){$object->{_tags}{$_} = "";}
    1.93 +		}
    1.94 +	return $object->getTags();
    1.95 +};
    1.96 +
    1.97 +
    1.98 +sub hasTags
    1.99 +{
   1.100 +	$card = shift;
   1.101 +	@rest = @_;
   1.102 +	@test = $card->getTags();
   1.103 +	foreach $e(@rest){if (! (first {$e eq $_} @test)){return 0;}}
   1.104 +	return 1;
   1.105 +}
   1.106 +
   1.107 +
   1.108 +sub setPix { $_[0]->{_pix} = $_[1]; }
   1.109 +sub getPix {return $_[0]->{_pix} ; }
   1.110 +
   1.111 +
   1.112 +1;