Array found where operator expected at RPG/Dice.pm line 11, at end of line (Do you need to predeclare our?) Operator or semicolon missing before %EXPORT_TAGS at RPG/Dice.pm line 20. Ambiguous use of % resolved as operator % at RPG/Dice.pm line 20. Array found where operator expected at RPG/Dice.pm line 25, at end of line (Do you need to predeclare our?) syntax error at RPG/Dice.pm line 11, near "our @ISA " syntax error at RPG/Dice.pm line 25, near "our @EXPORT_OK " BEGIN failed--compilation aborted at test.pl line 5. #### #!perl use RPG::Dice; print qq(Simple Test for module.\n); print qq(Result: ), RPG::Dice::computeDice("2d4+1"), qq(\n); exit(0); #### package RPG::Dice; require 5.005; use strict; use warnings; use Carp; use Exporter; our @ISA = qw(Exporter); # Items to export into callers namespace by default. Note: do not export # names by default without a very good reason. Use EXPORT_OK instead. # Do not simply export all your public functions/methods/constants. # This allows declaration use RPG::Dice ':all'; # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK # will save memory. our %EXPORT_TAGS = ( 'all' => [ qw( &initializeDice &computeDice ) ] ); our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); our @EXPORT = qw( ); our $VERSION = '0.85'; BEGIN { srand(); # intitalize Randomizer } #--------------------------------------------------------------------- #--------------------------------------------------------------------- sub computeDice { my($die_expr) = shift; my($no_rolls, $die_face, $adj, $die_modifier); my($result) = 0; if ($die_expr =~ /(\d+)d(\d+)(([-+])(\d+))*/) { $no_rolls = $1; $die_face = $2; $adj = $4; $die_modifier = $5; while ($no_rolls-- > 0) { $result += int(rand($die_face) + 1); } if ($adj =~ /-/) { $result -= $die_modifier; } else { $result += $die_modifier; } } return($result); } 1; __END__ # Below is stub documentation for your module. You better edit it! =head1 NAME RPG::Dice - Perl extension for Dice rolling expressions. =head1 SYNOPSIS use RPG::Dice; $dice_roll = RPG::Dice::computeDice("1d10+1"); =head1 DESCRIPTION Dice is a set of subroutines for parsing dice expressions. =item computeDice("1d2+3"); Function evaluates the expression. for example the expression "1d2+3" means roll 1 'die' 2 and add 3 to the result. =head2 EXPORT None by default. =head1 AUTHOR Syrkres syrkres@miniworld.com =head1 SEE ALSO perl(1). =cut