| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Tie::Pick; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 1 |  |  | 1 |  | 792 | use 5.006; | 
|  | 1 |  |  |  |  | 4 |  | 
|  | 1 |  |  |  |  | 44 |  | 
| 4 |  |  |  |  |  |  |  | 
| 5 | 1 |  |  | 1 |  | 5 | use strict; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 33 |  | 
| 6 | 1 |  |  | 1 |  | 5 | use warnings; | 
|  | 1 |  |  |  |  | 6 |  | 
|  | 1 |  |  |  |  | 49 |  | 
| 7 | 1 |  |  | 1 |  | 9 | no  warnings 'syntax'; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 414 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | our $VERSION = '2009110701'; | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | sub TIESCALAR { | 
| 13 | 1 |  |  | 1 |  | 32 | my $class  =   shift; | 
| 14 | 1 | 50 |  |  |  | 5 | do { require Carp; | 
|  | 0 |  |  |  |  | 0 |  | 
| 15 | 0 |  |  |  |  | 0 | Carp::croak ("tie needs more arguments") | 
| 16 |  |  |  |  |  |  | } unless @_; | 
| 17 | 1 |  |  |  |  | 5 | bless [@_] => $class; | 
| 18 |  |  |  |  |  |  | } | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | sub FETCH     { | 
| 21 | 6 |  |  | 6 |  | 16 | my $values = shift; | 
| 22 | 6 | 50 |  |  |  | 11 | return undef unless @$values; | 
| 23 | 6 |  |  |  |  | 51 | my $index  = int rand @$values; | 
| 24 | 6 | 100 |  |  |  | 15 | unless ($index == $#$values) { | 
| 25 | 3 |  |  |  |  | 4 | @{$values} [$index, $#$values] = @{$values} [$#$values, $index]; | 
|  | 3 |  |  |  |  | 5 |  | 
|  | 3 |  |  |  |  | 5 |  | 
| 26 |  |  |  |  |  |  | } | 
| 27 | 6 |  |  |  |  | 16 | pop @$values; | 
| 28 |  |  |  |  |  |  | } | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | sub STORE     { | 
| 31 | 1 |  |  | 1 |  | 22 | my $self = shift; | 
| 32 | 1 |  |  |  |  | 5 | do { require Carp; | 
|  | 0 |  |  |  |  | 0 |  | 
| 33 | 0 |  |  |  |  | 0 | Carp::croak ("assignment needs reference to non empty array") | 
| 34 | 1 | 50 | 33 |  |  | 9 | } unless 1 == @_ && 'ARRAY' eq ref $_ [0] && @{$_ [0]}; | 
|  |  |  | 33 |  |  |  |  | 
| 35 | 1 |  |  |  |  | 2 | @$self = @{$_ [0]}; | 
|  | 1 |  |  |  |  | 5 |  | 
| 36 |  |  |  |  |  |  | } | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | 1; | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | __END__ |