|  line  | 
 stmt  | 
 bran  | 
 cond  | 
 sub  | 
 pod  | 
 time  | 
 code  | 
| 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 package Hash::AutoHash::AVPairsMulti;  | 
| 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 our $VERSION='1.17';  | 
| 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 $VERSION=eval $VERSION;		# I think this is the accepted idiom..  | 
| 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #################################################################################  | 
| 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #  | 
| 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # Author:  Nat Goodman  | 
| 
8
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # Created: 09-03-05  | 
| 
9
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # $Id:   | 
| 
10
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #  | 
| 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # AutoHash with multivalued string or number elements. no references  | 
| 
12
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # Inspired by Tie::Hash::Multivalue  | 
| 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #  | 
| 
14
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #################################################################################  | 
| 
15
 | 
11
 | 
 
 | 
 
 | 
  
11
  
 | 
 
 | 
271533
 | 
 use strict;  | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
31
 | 
    | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
429
 | 
    | 
| 
16
 | 
11
 | 
 
 | 
 
 | 
  
11
  
 | 
 
 | 
59
 | 
 use Carp;  | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
19
 | 
    | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
713
 | 
    | 
| 
17
 | 
11
 | 
 
 | 
 
 | 
  
11
  
 | 
 
 | 
19078
 | 
 use Hash::AutoHash;  | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
80168
 | 
    | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
75
 | 
    | 
| 
18
 | 
11
 | 
 
 | 
 
 | 
  
11
  
 | 
 
 | 
2566
 | 
 use base qw(Hash::AutoHash);  | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
31
 | 
    | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2565
 | 
    | 
| 
19
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 our @NORMAL_EXPORT_OK=@Hash::AutoHash::EXPORT_OK;  | 
| 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 my $helper_class=__PACKAGE__.'::helper';  | 
| 
22
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 our @EXPORT_OK=$helper_class->EXPORT_OK;  | 
| 
23
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 our @SUBCLASS_EXPORT_OK=$helper_class->SUBCLASS_EXPORT_OK;  | 
| 
24
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
25
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #################################################################################  | 
| 
26
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # helper package exists to avoid polluting Hash::AutoHash::Args namespace with  | 
| 
27
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #   subs that would mask accessor/mutator AUTOLOADs  | 
| 
28
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # functions herein (except _new) are exportable by Hash::AutoHash::Args  | 
| 
29
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #################################################################################  | 
| 
30
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 package Hash::AutoHash::AVPairsMulti::helper;  | 
| 
31
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 our $VERSION=$Hash::AutoHash::AVPairsMulti::VERSION;  | 
| 
32
 | 
11
 | 
 
 | 
 
 | 
  
11
  
 | 
 
 | 
133
 | 
 use strict;  | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
20
 | 
    | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
451
 | 
    | 
| 
33
 | 
11
 | 
 
 | 
 
 | 
  
11
  
 | 
 
 | 
52
 | 
 use Carp;  | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
33
 | 
    | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3727
 | 
    | 
| 
34
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 BEGIN {  | 
| 
35
 | 
11
 | 
 
 | 
 
 | 
  
11
  
 | 
 
 | 
467
 | 
   our @ISA=qw(Hash::AutoHash::helper);  | 
| 
36
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
37
 | 
11
 | 
 
 | 
 
 | 
  
11
  
 | 
 
 | 
76
 | 
 use Hash::AutoHash qw(autohash_tie);  | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
27
 | 
    | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
54
 | 
    | 
| 
38
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
39
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub _new {  | 
| 
40
 | 
178
 | 
 
 | 
 
 | 
  
178
  
 | 
 
 | 
1233015
 | 
   my($helper_class,$class,@args)=@_;  | 
| 
41
 | 
178
 | 
 
 | 
 
 | 
 
 | 
 
 | 
820
 | 
   my $self=autohash_tie Hash::AutoHash::AVPairsMulti::tie,@args;  | 
| 
42
 | 
175
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4428
 | 
   bless $self,$class;  | 
| 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
44
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
45
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #################################################################################  | 
| 
46
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # Tied hash which implements Hash::AutoHash::AVPairsMulti  | 
| 
47
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #################################################################################  | 
| 
48
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 package Hash::AutoHash::AVPairsMulti::tie;  | 
| 
49
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 our $VERSION=$Hash::AutoHash::AVPairsMulti::VERSION;  | 
| 
50
 | 
11
 | 
 
 | 
 
 | 
  
11
  
 | 
 
 | 
1914
 | 
 use strict;  | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
23
 | 
    | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
328
 | 
    | 
| 
51
 | 
11
 | 
 
 | 
 
 | 
  
11
  
 | 
 
 | 
50
 | 
 use Carp;  | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
23
 | 
    | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
755
 | 
    | 
| 
52
 | 
11
 | 
 
 | 
 
 | 
  
11
  
 | 
 
 | 
11719
 | 
 use Hash::AutoHash::MultiValued;  | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
26880
 | 
    | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
91
 | 
    | 
| 
53
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 our @ISA=qw(Hash::AutoHash::MultiValued::tie);  | 
| 
54
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
55
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub STORE {  | 
| 
56
 | 
605
 | 
 
 | 
 
 | 
  
605
  
 | 
 
 | 
1149844
 | 
   my($self,$key,@new)=@_;  | 
| 
57
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   # all values must be simple (non-reference)  | 
| 
58
 | 
605
 | 
 
 | 
 
 | 
 
 | 
 
 | 
885
 | 
   my $bad;  | 
| 
59
 | 
605
 | 
  
100
  
 | 
  
100
  
 | 
 
 | 
 
 | 
3800
 | 
   if (@new==1 && 'ARRAY' eq ref $new[0]) { # if passed ARRAY, look inside  | 
| 
60
 | 
495
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
665
 | 
     $bad=1 if grep {ref($_)} @{$new[0]};  | 
| 
 
 | 
664
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2157
 | 
    | 
| 
 
 | 
495
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1115
 | 
    | 
| 
61
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   } else {  | 
| 
62
 | 
110
 | 
 
 | 
 
 | 
 
 | 
 
 | 
199
 | 
     $bad=grep {ref($_)} @new;  | 
| 
 
 | 
113
 | 
 
 | 
 
 | 
 
 | 
 
 | 
339
 | 
    | 
| 
63
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   }  | 
| 
64
 | 
605
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
3313
 | 
   confess "Trying to store reference as value of attribute $key" if $bad;  | 
| 
65
 | 
598
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2409
 | 
   $self->SUPER::STORE($key,@new);  | 
| 
66
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
67
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 1;  | 
| 
68
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
69
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 __END__  |