in reply to Tied and Entangled, Quantum fun.
What are you buying with Quantum:: that I don't get with my plain $distribution->[ rand @$distribution ]? Outside of having a really bloated module?
package Quaint; use strict; use Tie::Scalar; use Carp; use UNIVERSAL 'isa'; sub TIESCALAR { my ( $pck, @distribution ) = @_; croak "No distribution given." unless @distribution; bless { data => \ @distribution, state => $state }, $pck; } sub FETCH { my $self = shift; my $distribution = $self->{distribution}; $distribution->[ rand @$distribution ]; } sub STORE { my ( $self, $distref ) = @_; croak "No distribution given." unless isa($distref, "ARRAY"); my $orig_dist = $self->{'distribution'}; push @$orig_dist, @$distref; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Tied and Entangled, Quantum fun.
by pernod (Chaplain) on Jul 25, 2003 at 17:39 UTC |