Ricardo SIGNES > Games-Dice-0.999_02 > Games::Dice::Result

Download:
Games-Dice-0.999_02.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.999_01   Source  

NAME ^

Games::Dice::Result - what you get when you roll some dice

VERSION ^

version 0.999_01

 $Id: Result.pm 1499 2007-07-29 19:15:29Z rjbs $

SYNOPSIS ^

 my $dice = Games::Dice->new("3d6");
 my $result = $dice->roll;
 
 say "You rolled: ",  $result->as_string;

DESCRIPTION ^

Result objects are returned when the roll method is called on a Game::Dice set.

METHODS ^

new

  my $result = Games::Dice::Result->new(\%arg);

This method creates a new result. You shouldn't need to use it outside of Games::Dice classes.

Valid arguments are:

  results - (required) an arrayref of Games::Die::Result objects
  dropped - (optional) an arrayref of Games::Die::Result objects
  adjust  - (optional) a coderef

results

This method returns all the non-dropped Games::Die::Result objects for this result.

dropped_results

This returns a list of the result of each die rolled, in the order the results were given to the constructor.

all_results

This returns both kept and dropped die results for this object.

total

This returns the total of the rolls, plus the adjustment.

as_string

This method returns a string describing the results. The default implementation will return something like this (though this is likely to change):

  1 + 2 + 4 + 4 + 8 = 19 + 2 = 21

AUTHOR ^

Ricardo SIGNES, <rjbs@cpan.org>

BUGS ^

Please report any bugs or feature requests to bug-games-dice@rt.cpan.org, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

COPYRIGHT ^

Copyright 2005, Ricardo SIGNES.

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

syntax highlighting: