NAME

Games::Die - it's a die; you can roll it!

VERSION

version 0.999_01

$Id: Die.pm 1501 2007-07-29 19:50:56Z rjbs $

SYNOPSIS

$six_sided = Games::Die->new({ sides => 6 });

$twenty_sided = Games::Die->new(20);
$twenty_sided->sides; # 20

$total = $six_sided->roll + $twenty_sided->roll;

DESCRIPTION

Games::Die provides an object-oriented implementation of a die that can be rolled.

METHODS

new

my $die = Games::Die->new(\%arg);
my $die = Games::Die->new($sides);

This method creates and returns a new Die. The number of sides must be an integer greater than zero. Passing $sides as the first argument is equivalent to giving that value as the sides argument, and nothing else.

Other parameters will probably appear only in subclasses of Games::Die.

sides

This method returns the number of sides on this die.

roll

my $result = $die->roll;

This method rolls the die and returns a Games::Die::Result object.

result_class

This method returns the class to be used for results.

AUTHORS

Ricardo SIGNES <rjbs@cpan.org>

LICENSE

Copyright (C) 2005, Ricardo SIGNES.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.