The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Polygon - A simple demo for a one-to-many association (/examples).

VERSION

1.00

SYNOPSIS

DESCRIPTION

This example is taken from Rumbaughs book, chapter 3.

A Polygon consist of at least 3 Points (many). In this simple demo there is no checking on the minimum number of Points implemented.

The purpose is to show, how the one-to-many direction could be implemented in Perl. It turns out that there is no need to have an explicit variable $a_has, like in the one-to-one case (cf ../one-to-one).

Instead, the internal list @points takes this functionality. Each index of this array is a unique identifier of an individual Point-instance. See Polygon->add() for details.

You may think of further extensions of this simple Polygon class. E.g. the Polygon could have a name. It could calculate its perimeter, area etc.

ENVIRONMENT

DIAGNOSTICS

BUGS

FILES

SEE ALSO

        perldoc classgen
        perldoc many
        perldoc Point

AUTHOR

Name: Michael Schlueter

email: mschlue@cpan.org

COPYRIGHT

Copyright (c) 2000, Michael Schlueter. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.