- or download this
package Location;
use 5.008001;
...
use constant nl=>"\n";
use constant X=>0; # these are the array fields
use constant Y=>1;
- or download this
# defaults
{
...
return $default_location->[Y];
}
}
- or download this
sub new{
use integer;
...
$y||get_default_Y
],$self;
}
- or download this
sub get_location{
my $self=shift;
...
my $self=shift;
return $self->get_location->[Y];
}
- or download this
sub set_location{
my ($self,$x,$y)=@_;
...
}
# so far so nice
1;
- or download this
use integer; #we use integer coordinates
use constant nl=>"\n";
...
use constant Y=>1;
# overload => thats new !
use overloead '<=>' => 'compare';
- or download this
sub compare {
my ($loc1,$loc2,$rev)=@_;
...
return 0;
return ;
}