# shapes -- A simple shapes example # # Copyright (C) 1998, Bradley M. Kuhn # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # Please request a copy of the GNU General Public License from the author, # or retrieve it from http://www.gnu.org/copyleft/gpl.html # Alternatively, you can obtain a copy by writing to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # Modified for use in COMP 331, Intermediate Perl 3/31/02 - C.D.Lane use warnings; use strict; package Circle; use base qw(Shape); our $VERSION = "0.01"; =head1 NAME Circle - Perl Circle Shape =head1 SYNOPSIS use Shape; my $circle = new Circle(0, 0, 5); $circle->moveTo(5, 7); $circle->draw(); =head1 DESCRIPTION Circle "draws" a circle and allows you to move it =head1 AUTHOR Bradley M. Kuhn =cut ############################################################################### sub new { my ($class, $x, $y, $radius) = @_; my $self = $class->SUPER::new($x, $y); $self->{radius} = $radius; return $self; } ############################################################################### sub draw { my ($self) = @_; print "Drawing a Circle at ($self->{x}, $self->{y}) ", "with a radius of $self->{radius}.\n"; return $self; } ############################################################################### sub setRadius { my ($self, $newRadius) = @_; $self->{radius} = $newRadius; return $self; } ############################################################################### 1;