Acme-Monkey

 view release on metacpan or  search on metacpan

lib/Acme/Monkey.pm  view on Meta::CPAN

our $CLEAR_COMMAND = $os_clrscr_commands{$^O};

=head1 METHODS

=head2 new

=cut

sub new {
    my $class = shift;
    my $self = bless {}, $class;
    $self->{hunger}    = 80;
    $self->{happiness} = 50;
    $self->{drunkness} = 0;
    $self->{sub}       = undef;
    return $self;
}

sub monkey {
    print "Monkey!\n";
}

lib/Acme/Monkey.pm  view on Meta::CPAN

	    $self->{WIDTH}  = $params{'width'}  || $params{'W'} || undef;
	    $self->{HEIGHT} = $params{'height'} || $params{'H'} || undef;

        # TODO: Should we just default X,Y instead?
	    croak "Width required\n"  if !defined($self->{WIDTH});
	    croak "Height required\n" if !defined($self->{HEIGHT});

	    $self->{BUF_SIZE} = $self->{WIDTH} * $self->{HEIGHT};
	    $self->{BUFFER}   = '';

	    bless($self, $class);
    }

    sub width {
	    my ($self) = shift;
	    return $self->{WIDTH};
    }

    sub height {
	    my ($self) = shift;
	    return $self->{HEIGHT};

lib/Acme/Monkey.pm  view on Meta::CPAN

];

    !(!(!0));
}

{
    package Acme::Monkey::ScreenBuffer;

    sub new {
        my ($class, $width, $height) = @_;
        my $self = bless {}, $class;
        $self->{width}  = $width;
        $self->{height} = $height;
        $self->clear_screen();
        $self->clear_buffer();
        return $self;
    }

    sub clear_screen {
        system( $CLEAR_COMMAND );
    }



( run in 1.919 second using v1.01-cache-2.11-cpan-de7293f3b23 )