Skip Menu |

This queue is for tickets about the Games-Dice-Advanced CPAN distribution.

Report information
The Basics
Id: 21416
Status: resolved
Priority: 0/
Queue: Games-Dice-Advanced

People
Owner: Nobody in particular
Requestors: bdfoy [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.0
Fixed in: (no value)



Subject: new() has regex error that limits it to die with less than 10 faces
I was playing around with Games::Dice::Advanced and wanted to try something with a 20 sided die, but it comes out as a 1 sided die: <pre> #!/usr/bin/perl use Games::Dice::Advanced; foreach ( 1..10 ) { print Games::Dice::Advanced->roll( "d20" ), "\n"; } </pre> There's a closing paren in the wrong place in the regex to parse that: <pre> --- Advanced.pm 2006-09-10 10:45:33.000000000 -0500 +++ Advanced.pm-new 2006-09-10 10:46:51.000000000 -0500 @@ -132,7 +132,7 @@ if($recipe !~ /\D/) { # constant # $self = eval("sub { $recipe * $mul }"); $self = sub { $recipe * $mul }; - } elsif($recipe =~ /^d(\d)+$/) { # dINT + } elsif($recipe =~ /^d(\d+)$/) { # dINT # $self = eval("sub { (1 + int(rand($1))) * $mul }"); my $faces = $1; $self = sub { (1 + int(rand($faces))) * $mul }; </pre>
Thanks for the patch, fixed in 1.1