in reply to Re: Dice::di
in thread Dice::Die

This comment is altered

I agree. Each type of die should be storable as an instance. For example, my $six_sider = Dice::Di->new( SIDES => 6 ). And useful methods would be
my $roll = $six_sider->roll(); my @rolls = $six_sider->rolls(6); #note plural, although #with wantarr +ay() this can probably be folded into roll() my @char_trait_set = map {$six_sider->roll()} (1..3) # ?

Replies are listed 'Best First'.
Re: Re: Re: Dice::di
by chipmunk (Parson) on Jan 06, 2001 at 02:29 UTC
    The point I was making is that, as the module is written, he can't make an object $six_sider and then call $six_sider->roll() as many times as he wants. The value for the roll is set in the new() method, and the module does not provide a method for generating a new roll on an already created object. Each die roll requires creating an entirely new object, calling its get_roll() method to find out what the die roll was, and then discarding the object.

    I agree with you that a roll() method, as you described, would be very useful.