Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

dokkeldepper's scratchpad

by dokkeldepper (Friar)
on Dec 07, 2005 at 13:35 UTC ( #514832=scratchpad: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. 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;
    
  2. or download this
    # defaults
    {
    ...
        return $default_location->[Y];
        }
    }
    
  3. or download this
    sub new{
        use integer;
    ...
        $y||get_default_Y
        ],$self;
    }
    
  4. or download this
    sub get_location{
        my $self=shift;
    ...
        my $self=shift;
        return $self->get_location->[Y];
    }
    
  5. or download this
    sub set_location{
        my ($self,$x,$y)=@_;
    ...
    }
    # so far so nice
    1;
    
  6. or download this
    use integer; #we use integer coordinates
    use constant nl=>"\n";
    ...
    use constant Y=>1;
    # overload => thats new !
    use overloead '<=>' => 'compare';
    
  7. or download this
    sub compare {
        my ($loc1,$loc2,$rev)=@_;
    ...
            return 0;
        return ;
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2022-08-14 18:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?