|  line  | 
 stmt  | 
 bran  | 
 cond  | 
 sub  | 
 pod  | 
 time  | 
 code  | 
| 
1
 | 
  
 
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 package Rose::HTML::Object::MakeMethods::Localization;  | 
| 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
3
 | 
43
 | 
 
 | 
 
 | 
  
43
  
 | 
 
 | 
316
 | 
 use strict;  | 
| 
 
 | 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
102
 | 
    | 
| 
 
 | 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1332
 | 
    | 
| 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
5
 | 
43
 | 
 
 | 
 
 | 
  
43
  
 | 
 
 | 
249
 | 
 use Carp();  | 
| 
 
 | 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
103
 | 
    | 
| 
 
 | 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
790
 | 
    | 
| 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
7
 | 
43
 | 
 
 | 
 
 | 
  
43
  
 | 
 
 | 
237
 | 
 use base 'Rose::Object::MakeMethods';  | 
| 
 
 | 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
384
 | 
    | 
| 
 
 | 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
151014
 | 
    | 
| 
8
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
9
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 our $VERSION = '0.615';  | 
| 
10
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub localized_message  | 
| 
12
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 {  | 
| 
13
 | 
153
 | 
 
 | 
 
 | 
  
153
  
 | 
  
0
  
 | 
12557
 | 
   my($class, $name, $args, $opts) = @_;  | 
| 
14
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
15
 | 
153
 | 
 
 | 
 
 | 
 
 | 
 
 | 
298
 | 
   my %methods;  | 
| 
16
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
17
 | 
153
 | 
 
 | 
  
 50
  
 | 
 
 | 
 
 | 
911
 | 
   my $interface = $args->{'interface'} || 'get_set';  | 
| 
18
 | 
153
 | 
 
 | 
  
 33
  
 | 
 
 | 
 
 | 
642
 | 
   my $key       = $args->{'hash_key'} || $name;  | 
| 
19
 | 
153
 | 
 
 | 
  
 33
  
 | 
 
 | 
 
 | 
807
 | 
   my $id_method = $args->{'msg_id_method'} || $key . '_message_id';  | 
| 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
21
 | 
153
 | 
 
 | 
  
 50
  
 | 
 
 | 
 
 | 
1807
 | 
   my $accept_msg_class = $args->{'accept_msg_class'} || 'Rose::HTML::Object::Message';  | 
| 
22
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
23
 | 
153
 | 
 
 | 
 
 | 
 
 | 
 
 | 
23225
 | 
   require Rose::HTML::Object::Message::Localized;  | 
| 
24
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
25
 | 
153
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
1733
 | 
   if($interface eq 'get_set')  | 
| 
26
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   {  | 
| 
27
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     $methods{$name} = sub  | 
| 
28
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     {  | 
| 
29
 | 
2202
 | 
 
 | 
 
 | 
  
2202
  
 | 
 
 | 
10762
 | 
       my($self) = shift;  | 
| 
30
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
31
 | 
2202
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
5369
 | 
       if(@_)  | 
| 
32
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       {  | 
| 
33
 | 
850
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
2206
 | 
         if(@_ > 1)  | 
| 
34
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         {  | 
| 
35
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
           my($id) = shift;  | 
| 
36
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
37
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
           my @args;  | 
| 
38
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
39
 | 
  
0
  
 | 
  
  0
  
 | 
  
  0
  
 | 
 
 | 
 
 | 
0
 | 
           if(@_ == 1 && ref($_[0]) =~ /^(?:HASH|ARRAY)$/)  | 
| 
40
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           {  | 
| 
41
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
             @args = (args => $_[0]);  | 
| 
42
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           }  | 
| 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           else  | 
| 
44
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           {  | 
| 
45
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
             @args = (args => [ @_ ]);  | 
| 
46
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           }  | 
| 
47
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
48
 | 
  
0
  
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
0
 | 
           unless($id =~ /^\d+$/)  | 
| 
49
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           {  | 
| 
50
 | 
  
0
  
 | 
 
 | 
  
  0
  
 | 
 
 | 
 
 | 
0
 | 
             $id = $self->localizer->get_message_id($id) ||   | 
| 
51
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
               Carp::croak "Unknown message id: '$id'";  | 
| 
52
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           }  | 
| 
53
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
54
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
           return $self->$name($self->localizer->message_class->new(id => $id, parent => $self, @args));  | 
| 
55
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
56
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
57
 | 
850
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1578
 | 
         my $msg = shift;  | 
| 
58
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
59
 | 
850
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
3442
 | 
         if(UNIVERSAL::isa($msg, $accept_msg_class))  | 
| 
60
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         {  | 
| 
61
 | 
483
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1637
 | 
           $msg->parent($self);  | 
| 
62
 | 
483
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2320
 | 
           return $self->{$key} = $msg;  | 
| 
63
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
64
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         else  | 
| 
65
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         {  | 
| 
66
 | 
367
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1425
 | 
           return $self->{$key} = $self->localizer->message_class->new(text => $msg, parent => $self);  | 
| 
67
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
68
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       }  | 
| 
69
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
70
 | 
1352
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5289
 | 
       return $self->{$key};  | 
| 
71
 | 
153
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1331
 | 
     };  | 
| 
72
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
73
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     $methods{$id_method} = sub  | 
| 
74
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     {  | 
| 
75
 | 
363
 | 
 
 | 
 
 | 
  
363
  
 | 
 
 | 
1285
 | 
       my($self) = shift;  | 
| 
76
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
77
 | 
363
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
903
 | 
       if(@_)  | 
| 
78
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       {  | 
| 
79
 | 
363
 | 
 
 | 
 
 | 
 
 | 
 
 | 
764
 | 
         my($id, @args) = @_;  | 
| 
80
 | 
363
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
849
 | 
         return $self->$name(undef)  unless(defined $id);  | 
| 
81
 | 
349
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1136
 | 
         return $self->$name($self->localizer->message_class->new(id => $id, args => \@args, parent => $self));  | 
| 
82
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       }  | 
| 
83
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
84
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
       my $error = $self->$name();  | 
| 
85
 | 
  
0
  
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
0
 | 
       return $error->id  if(UNIVERSAL::can($error, 'id'));  | 
| 
86
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
       return undef;  | 
| 
87
 | 
153
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1036
 | 
     };    | 
| 
88
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   }  | 
| 
89
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
   else { Carp::croak "Unknown interface: $interface" }  | 
| 
90
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
91
 | 
153
 | 
 
 | 
 
 | 
 
 | 
 
 | 
612
 | 
   return \%methods;  | 
| 
92
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
93
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
94
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub localized_error  | 
| 
95
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 {  | 
| 
96
 | 
  
0
  
 | 
 
 | 
 
 | 
  
0
  
 | 
  
0
  
 | 
0
 | 
   my($class, $name, $args) = @_;  | 
| 
97
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
98
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
   my %methods;  | 
| 
99
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
100
 | 
  
0
  
 | 
 
 | 
  
  0
  
 | 
 
 | 
 
 | 
0
 | 
   my $interface   = $args->{'interface'} || 'get_set';  | 
| 
101
 | 
  
0
  
 | 
 
 | 
  
  0
  
 | 
 
 | 
 
 | 
0
 | 
   my $key         = $args->{'hash_key'} || $name;  | 
| 
102
 | 
  
0
  
 | 
 
 | 
  
  0
  
 | 
 
 | 
 
 | 
0
 | 
   my $id_method   = $args->{'error_id_method'} || $key . '_id';  | 
| 
103
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
104
 | 
  
0
  
 | 
 
 | 
  
  0
  
 | 
 
 | 
 
 | 
0
 | 
   my $accept_error_class = $args->{'accept_error_class'} || 'Rose::HTML::Object::Error';  | 
| 
105
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
106
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
   require Rose::HTML::Object::Error;  | 
| 
107
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
108
 | 
  
0
  
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
0
 | 
   if($interface eq 'get_set')  | 
| 
109
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   {  | 
| 
110
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     $methods{$name} = sub  | 
| 
111
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     {  | 
| 
112
 | 
  
0
  
 | 
 
 | 
 
 | 
  
0
  
 | 
 
 | 
0
 | 
       my($self) = shift;  | 
| 
113
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
114
 | 
  
0
  
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
0
 | 
       if(@_)  | 
| 
115
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       {  | 
| 
116
 | 
  
0
  
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
0
 | 
         return $self->{$key} = undef  unless(defined $_[0]);  | 
| 
117
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
118
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
         my $localizer = $self->localizer;  | 
| 
119
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
120
 | 
  
0
  
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
0
 | 
         if(@_ > 1)  | 
| 
121
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         {  | 
| 
122
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
           my($id) = shift;  | 
| 
123
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
124
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
           my @args;  | 
| 
125
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
126
 | 
  
0
  
 | 
  
  0
  
 | 
  
  0
  
 | 
 
 | 
 
 | 
0
 | 
           if(@_ == 1 && ref($_[0]) =~ /^(?:HASH|ARRAY)$/)  | 
| 
127
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           {  | 
| 
128
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
             @args = (args => $_[0]);  | 
| 
129
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           }  | 
| 
130
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           else  | 
| 
131
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           {  | 
| 
132
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
             @args = (args => [ @_ ]);  | 
| 
133
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           }  | 
| 
134
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
135
 | 
  
0
  
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
0
 | 
           unless($id =~ /^\d+$/)  | 
| 
136
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           {  | 
| 
137
 | 
  
0
  
 | 
 
 | 
  
  0
  
 | 
 
 | 
 
 | 
0
 | 
             $id = $self->localizer->get_error_id($id) ||   | 
| 
138
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
               Carp::croak "Attempt to call $name() with more than one ",  | 
| 
139
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                           "argument, and the first argument is not a numeric ",  | 
| 
140
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                           "error id: '$id'";  | 
| 
141
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           }  | 
| 
142
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
143
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
           unshift(@args, error_id => $id);  | 
| 
144
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
145
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
           my $message;  | 
| 
146
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
147
 | 
  
0
  
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
0
 | 
           if($self->can('message_for_error_id'))  | 
| 
148
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           {  | 
| 
149
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
             $message = $self->message_for_error_id(@args);  | 
| 
150
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
151
 | 
  
0
  
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
0
 | 
             unless(defined $message)  | 
| 
152
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             {  | 
| 
153
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
               $message = $localizer->message_for_error_id(@args);  | 
| 
154
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             }  | 
| 
155
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           }  | 
| 
156
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           else  | 
| 
157
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           {  | 
| 
158
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
             $message = $localizer->message_for_error_id(@args);  | 
| 
159
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           }  | 
| 
160
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
161
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
162
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
           return $self->$name($localizer->error_class->new(id      => $id,   | 
| 
163
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                                                            parent  => $self,  | 
| 
164
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                                                            message => $message));  | 
| 
165
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
166
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
167
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
         my $error = shift;  | 
| 
168
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
169
 | 
  
0
  
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
0
 | 
         if(UNIVERSAL::isa($error, $accept_error_class))  | 
| 
 
 | 
 
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
170
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         {  | 
| 
171
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
           $error->parent($self);  | 
| 
172
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
           return $self->{$key} = $error;  | 
| 
173
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
174
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         elsif(defined $error)  | 
| 
175
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         {  | 
| 
176
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
           return $self->{$key} =   | 
| 
177
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             $localizer->error_class->new(message => $localizer->messsage_class->new($error),   | 
| 
178
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                                          parent  => $self);  | 
| 
179
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
180
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       }  | 
| 
181
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
182
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
       return $self->{$key};  | 
| 
183
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
     };  | 
| 
184
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
185
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     $methods{$id_method} = sub  | 
| 
186
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     {  | 
| 
187
 | 
  
0
  
 | 
 
 | 
 
 | 
  
0
  
 | 
 
 | 
0
 | 
       my($self) = shift;  | 
| 
188
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
189
 | 
  
0
  
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
0
 | 
       if(@_)  | 
| 
190
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       {  | 
| 
191
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
         my($id) = shift;  | 
| 
192
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
193
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
         my $localizer = $self->localizer;  | 
| 
194
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
195
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
         my @args;  | 
| 
196
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
197
 | 
  
0
  
 | 
  
  0
  
 | 
  
  0
  
 | 
 
 | 
 
 | 
0
 | 
         if(@_ == 1 && ref($_[0]) =~ /^(?:HASH|ARRAY)$/)  | 
| 
198
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         {  | 
| 
199
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
           @args = (args => $_[0]);  | 
| 
200
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
201
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         else  | 
| 
202
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         {  | 
| 
203
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
           @args = (args => [ @_ ]);  | 
| 
204
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
205
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
206
 | 
  
0
  
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
0
 | 
         unless($id =~ /^\d+$/)  | 
| 
207
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         {  | 
| 
208
 | 
  
0
  
 | 
 
 | 
  
  0
  
 | 
 
 | 
 
 | 
0
 | 
           $id = $localizer->get_error_id($id) ||   | 
| 
209
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             Carp::croak "Unknown error id: '$id'";  | 
| 
210
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
211
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
212
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
         unshift(@args, error_id => $id);  | 
| 
213
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
214
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
         my $message;  | 
| 
215
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
216
 | 
  
0
  
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
0
 | 
         if($self->can('message_for_error_id'))  | 
| 
217
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         {  | 
| 
218
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
           $message = $self->message_for_error_id(@args);  | 
| 
219
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
220
 | 
  
0
  
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
0
 | 
           unless(defined $message)  | 
| 
221
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           {  | 
| 
222
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
             $message = $localizer->message_for_error_id(@args);  | 
| 
223
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           }  | 
| 
224
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
225
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         else  | 
| 
226
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         {  | 
| 
227
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
           $message = $localizer->message_for_error_id(@args);  | 
| 
228
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
229
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
230
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
231
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
         return $self->$name($localizer->error_class->new(id      => $id,   | 
| 
232
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                                                          parent  => $self,  | 
| 
233
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                                                          message => $message));  | 
| 
234
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       }  | 
| 
235
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
236
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
       my $error = $self->$name();  | 
| 
237
 | 
  
0
  
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
0
 | 
       return $error->id  if(UNIVERSAL::can($error, 'id'));  | 
| 
238
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
       return undef;  | 
| 
239
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
     };  | 
| 
240
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
241
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   }  | 
| 
242
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
   else { Carp::croak "Unknown interface: $interface" }  | 
| 
243
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
244
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
   return \%methods;  | 
| 
245
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
246
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
247
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub localized_errors  | 
| 
248
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 {  | 
| 
249
 | 
43
 | 
 
 | 
 
 | 
  
43
  
 | 
  
0
  
 | 
5863
 | 
   my($class, $name, $args) = @_;  | 
| 
250
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
251
 | 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
128
 | 
   my %methods;  | 
| 
252
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
253
 | 
43
 | 
 
 | 
  
 50
  
 | 
 
 | 
 
 | 
342
 | 
   my $interface      = $args->{'interface'} || 'get_set';  | 
| 
254
 | 
43
 | 
 
 | 
  
 33
  
 | 
 
 | 
 
 | 
262
 | 
   my $key            = $args->{'hash_key'} || $name;  | 
| 
255
 | 
43
 | 
 
 | 
  
 33
  
 | 
 
 | 
 
 | 
221
 | 
   my $plural_name    = $args->{'plural_name'} || $name;  | 
| 
256
 | 
43
 | 
 
 | 
  
 33
  
 | 
 
 | 
 
 | 
214
 | 
   my $singular_name  = $args->{'singular_name'} || plural_to_singular($plural_name);  | 
| 
257
 | 
43
 | 
 
 | 
  
 33
  
 | 
 
 | 
 
 | 
291
 | 
   my $has_method     = $args->{'has_error_method'} || 'has_' . $plural_name;  | 
| 
258
 | 
43
 | 
 
 | 
  
 33
  
 | 
 
 | 
 
 | 
317
 | 
   my $has_method2    = $args->{'has_errors_method'} || 'has_' . $singular_name;  | 
| 
259
 | 
43
 | 
 
 | 
  
 33
  
 | 
 
 | 
 
 | 
225
 | 
   my $add_method     = $args->{'add_error_method'} || 'add_' . $singular_name;  | 
| 
260
 | 
43
 | 
 
 | 
  
 33
  
 | 
 
 | 
 
 | 
259
 | 
   my $adds_method    = $args->{'add_errors_method'} || 'add_' . $plural_name;  | 
| 
261
 | 
43
 | 
 
 | 
  
 33
  
 | 
 
 | 
 
 | 
239
 | 
   my $id_method      = $args->{'error_id_method'} || $singular_name . '_id';  | 
| 
262
 | 
43
 | 
 
 | 
  
 33
  
 | 
 
 | 
 
 | 
222
 | 
   my $ids_method     = $args->{'error_ids_method'} || $singular_name . '_ids';  | 
| 
263
 | 
43
 | 
 
 | 
  
 33
  
 | 
 
 | 
 
 | 
228
 | 
   my $add_id_method  = $args->{'add_error_id_method'} || 'add_' . $singular_name . '_id';  | 
| 
264
 | 
43
 | 
 
 | 
  
 33
  
 | 
 
 | 
 
 | 
207
 | 
   my $add_ids_method = $args->{'add_error_ids_method'} || 'add_' . $singular_name . '_ids';  | 
| 
265
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
266
 | 
43
 | 
 
 | 
  
 50
  
 | 
 
 | 
 
 | 
239
 | 
   my $accept_error_class = $args->{'accept_error_class'} || 'Rose::HTML::Object::Error';  | 
| 
267
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
268
 | 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
19372
 | 
   require Rose::HTML::Object::Error;  | 
| 
269
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
270
 | 
43
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
239
 | 
   if($interface eq 'get_set')  | 
| 
271
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   {  | 
| 
272
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     $methods{$plural_name} = sub  | 
| 
273
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     {  | 
| 
274
 | 
19
 | 
 
 | 
 
 | 
  
19
  
 | 
 
 | 
65
 | 
       my($self) = shift;  | 
| 
275
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
276
 | 
19
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
58
 | 
       if(@_)  | 
| 
277
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       {  | 
| 
278
 | 
8
 | 
  
100
  
 | 
  
 66
  
 | 
 
 | 
 
 | 
65
 | 
         if(!defined $_[0] || (ref $_[0] eq 'ARRAY' && !@{$_[0]}))  | 
| 
 
 | 
1
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
6
 | 
    | 
| 
279
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         {  | 
| 
280
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
12
 | 
           return $self->{$key} = undef;  | 
| 
281
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
282
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
283
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
32
 | 
         $self->{$key} = undef;  | 
| 
284
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
26
 | 
         $self->$adds_method(@_);  | 
| 
285
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       }  | 
| 
286
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
287
 | 
17
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
49
 | 
       return wantarray ? @{$self->{$key} || []} : $self->{$key};  | 
| 
 
 | 
11
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
73
 | 
    | 
| 
288
 | 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1410
 | 
     };  | 
| 
289
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
290
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     $methods{$singular_name} = sub  | 
| 
291
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     {  | 
| 
292
 | 
6417
 | 
 
 | 
 
 | 
  
6417
  
 | 
 
 | 
21545
 | 
       my($self) = shift;  | 
| 
293
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
294
 | 
6417
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
13771
 | 
       if(@_)  | 
| 
295
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       {  | 
| 
296
 | 
4442
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
12864
 | 
         return $self->{$key} = undef  unless(defined $_[0]);  | 
| 
297
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
298
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
128
 | 
         my $localizer = $self->localizer;  | 
| 
299
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
300
 | 
20
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
690
 | 
         if(@_ > 1)  | 
| 
301
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         {  | 
| 
302
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5
 | 
           my($id) = shift;  | 
| 
303
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
304
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4
 | 
           my @args;  | 
| 
305
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
306
 | 
2
 | 
  
 50
  
 | 
  
 33
  
 | 
 
 | 
 
 | 
17
 | 
           if(@_ == 1 && ref($_[0]) =~ /^(?:HASH|ARRAY)$/)  | 
| 
307
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           {  | 
| 
308
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
8
 | 
             @args = (args => $_[0]);  | 
| 
309
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           }  | 
| 
310
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           else  | 
| 
311
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           {  | 
| 
312
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
             @args = (args => [ @_ ]);  | 
| 
313
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           }  | 
| 
314
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
315
 | 
2
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
11
 | 
           unless($id =~ /^\d+$/)  | 
| 
316
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           {  | 
| 
317
 | 
  
0
  
 | 
 
 | 
  
  0
  
 | 
 
 | 
 
 | 
0
 | 
             $id = $localizer->get_error_id($id) ||   | 
| 
318
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
               Carp::croak "Attempt to call $singular_name() with more than one ",  | 
| 
319
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                           "argument, and the first argument is not a numeric ",  | 
| 
320
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                           "error id: '$id'";  | 
| 
321
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           }  | 
| 
322
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
323
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
8
 | 
           unshift(@args, error_id => $id);  | 
| 
324
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
325
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4
 | 
           my $message;  | 
| 
326
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
327
 | 
2
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
12
 | 
           if($self->can('message_for_error_id'))  | 
| 
328
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           {  | 
| 
329
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
8
 | 
             $message = $self->message_for_error_id(@args);  | 
| 
330
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
331
 | 
2
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
6
 | 
             unless(defined $message)  | 
| 
332
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             {  | 
| 
333
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
9
 | 
               $message = $localizer->message_for_error_id(@args);  | 
| 
334
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             }  | 
| 
335
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           }  | 
| 
336
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           else  | 
| 
337
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           {  | 
| 
338
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
             $message = $localizer->message_for_error_id(@args);  | 
| 
339
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           }  | 
| 
340
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
341
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
17
 | 
           $self->{$key} =   | 
| 
342
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             [ $localizer->error_class->new(id => $id, parent => $self, message => $message) ];  | 
| 
343
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
344
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
16
 | 
           return $self->{$key}[-1];  | 
| 
345
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
346
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
347
 | 
18
 | 
 
 | 
 
 | 
 
 | 
 
 | 
62
 | 
         my $error = shift;  | 
| 
348
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
349
 | 
18
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
178
 | 
         if(UNIVERSAL::isa($error, $accept_error_class))  | 
| 
 
 | 
 
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
350
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         {  | 
| 
351
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
           $error->parent($self);  | 
| 
352
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
           $self->{$key} = [ $error ];  | 
| 
353
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
354
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         elsif(defined $error)  | 
| 
355
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         {  | 
| 
356
 | 
18
 | 
 
 | 
 
 | 
 
 | 
 
 | 
97
 | 
           $self->{$key} =   | 
| 
357
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             [ $localizer->error_class->new(message => $localizer->message_class->new($error), parent => $self) ];  | 
| 
358
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
359
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       }  | 
| 
360
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
361
 | 
1993
 | 
 
 | 
 
 | 
 
 | 
 
 | 
8289
 | 
       return $self->{$key}[-1];  | 
| 
362
 | 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
280
 | 
     };  | 
| 
363
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
364
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     $methods{$adds_method} = sub  | 
| 
365
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     {  | 
| 
366
 | 
7
 | 
 
 | 
 
 | 
  
7
  
 | 
 
 | 
19
 | 
       my($self) = shift;  | 
| 
367
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
368
 | 
7
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
20
 | 
       return  unless(@_);  | 
| 
369
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
370
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
26
 | 
       my $localizer = $self->localizer;  | 
| 
371
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
117
 | 
       my $errors = __errors_from_args($self, \@_, $localizer->error_class, $localizer->message_class, $accept_error_class, 0, 0);  | 
| 
372
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
373
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
15
 | 
       push(@{$self->{$key}}, @$errors);    | 
| 
 
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
25
 | 
    | 
| 
374
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
375
 | 
7
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
25
 | 
       return wantarray ? @$errors : $errors;  | 
| 
376
 | 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
195
 | 
     };  | 
| 
377
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
378
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     $methods{$add_method} = sub  | 
| 
379
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     {  | 
| 
380
 | 
5
 | 
 
 | 
 
 | 
  
5
  
 | 
 
 | 
13
 | 
       my($self) = shift;  | 
| 
381
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
382
 | 
5
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
19
 | 
       return  unless(@_);  | 
| 
383
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
384
 | 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
19
 | 
       my $localizer = $self->localizer;  | 
| 
385
 | 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
126
 | 
       my $errors = __errors_from_args($self, \@_, $localizer->error_class, $localizer->message_class, $accept_error_class, 0, 1);  | 
| 
386
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
387
 | 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
13
 | 
       push(@{$self->{$key}}, @$errors);  | 
| 
 
 | 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
20
 | 
    | 
| 
388
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
389
 | 
5
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
20
 | 
       return wantarray ? @$errors : $errors;  | 
| 
390
 | 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
218
 | 
     };  | 
| 
391
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
392
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     $methods{$id_method} = sub  | 
| 
393
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     {  | 
| 
394
 | 
43
 | 
 
 | 
 
 | 
  
43
  
 | 
 
 | 
194
 | 
       my($self) = shift;  | 
| 
395
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
396
 | 
43
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
143
 | 
       if(@_)  | 
| 
397
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       {  | 
| 
398
 | 
32
 | 
 
 | 
 
 | 
 
 | 
 
 | 
118
 | 
         my $localizer = $self->localizer;  | 
| 
399
 | 
32
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1084
 | 
         my $errors = __errors_from_args($self, \@_, $localizer->error_class, $localizer->message_class, $accept_error_class, 1, 1);  | 
| 
400
 | 
32
 | 
 
 | 
 
 | 
 
 | 
 
 | 
123
 | 
         $self->{$key} = $errors;  | 
| 
401
 | 
32
 | 
 
 | 
 
 | 
 
 | 
 
 | 
113
 | 
         return $errors->[-1]->id;  | 
| 
402
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       }  | 
| 
403
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
404
 | 
11
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
57
 | 
       return $self->{$key}[-1] ? $self->{$key}[-1]->id : undef;  | 
| 
405
 | 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1492
 | 
     };  | 
| 
406
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
407
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     $methods{$ids_method} = sub  | 
| 
408
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     {  | 
| 
409
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
 
 | 
4
 | 
       my($self) = shift;  | 
| 
410
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
411
 | 
1
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
4
 | 
       if(@_)  | 
| 
412
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       {  | 
| 
413
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
         my $localizer = $self->localizer;  | 
| 
414
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
         my $errors = __errors_from_args($self, \@_, $localizer->error_class, $localizer->message_class, $accept_error_class, 1, 0);  | 
| 
415
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
         $self->{$key} = $errors;  | 
| 
416
 | 
  
0
  
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
0
 | 
         return wantarray ? @$errors : $errors;  | 
| 
417
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       }  | 
| 
418
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
419
 | 
1
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
5
 | 
       if(defined(my $want = wantarray))  | 
| 
420
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       {  | 
| 
421
 | 
1
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
2
 | 
         my @ids = map { $_->id } @{$self->{$key} || []};  | 
| 
 
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
6
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
6
 | 
    | 
| 
422
 | 
1
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
9
 | 
         return $want ? @ids : \@ids;  | 
| 
423
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       }  | 
| 
424
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
425
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
       return;  | 
| 
426
 | 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
196
 | 
     };  | 
| 
427
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
428
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     $methods{$add_ids_method} = sub  | 
| 
429
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     {  | 
| 
430
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
 
 | 
3
 | 
       my($self) = shift;  | 
| 
431
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
432
 | 
1
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
4
 | 
       return  unless(@_);  | 
| 
433
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
434
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3
 | 
       my $localizer = $self->localizer;  | 
| 
435
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
12
 | 
       my $errors = __errors_from_args($self, \@_, $localizer->error_class, $localizer->message_class, $accept_error_class, 1, 1);  | 
| 
436
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
437
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3
 | 
       push(@{$self->{$key}}, @$errors);    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4
 | 
    | 
| 
438
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
439
 | 
1
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
4
 | 
       if(defined(my $want = wantarray))  | 
| 
440
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       {  | 
| 
441
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
         my @ids = map { $_->id } @$errors;  | 
| 
 
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
    | 
| 
442
 | 
  
0
  
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
0
 | 
         return $want ? @ids : \@ids;  | 
| 
443
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       }  | 
| 
444
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
445
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3
 | 
       return;  | 
| 
446
 | 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
216
 | 
     };  | 
| 
447
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
448
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     $methods{$add_id_method} = sub  | 
| 
449
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     {  | 
| 
450
 | 
68
 | 
 
 | 
 
 | 
  
68
  
 | 
 
 | 
188
 | 
       my($self) = shift;  | 
| 
451
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
452
 | 
68
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
223
 | 
       return  unless(@_);  | 
| 
453
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
454
 | 
68
 | 
 
 | 
 
 | 
 
 | 
 
 | 
325
 | 
       my $localizer = $self->localizer;  | 
| 
455
 | 
68
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2606
 | 
       my $errors = __errors_from_args($self, \@_, $localizer->error_class, $localizer->message_class, $accept_error_class, 1, 0);  | 
| 
456
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
457
 | 
68
 | 
 
 | 
 
 | 
 
 | 
 
 | 
153
 | 
       push(@{$self->{$key}}, @$errors);    | 
| 
 
 | 
68
 | 
 
 | 
 
 | 
 
 | 
 
 | 
238
 | 
    | 
| 
458
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
459
 | 
68
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
230
 | 
       if(defined(my $want = wantarray))  | 
| 
460
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       {  | 
| 
461
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
         my @ids = map { $_->id } @$errors;  | 
| 
 
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
    | 
| 
462
 | 
  
0
  
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
0
 | 
         return $want ? @ids : \@ids;  | 
| 
463
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       }  | 
| 
464
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
465
 | 
68
 | 
 
 | 
 
 | 
 
 | 
 
 | 
252
 | 
       return;  | 
| 
466
 | 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2755
 | 
     };  | 
| 
467
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
468
 | 
43
 | 
  
100
  
 | 
 
 | 
  
38
  
 | 
 
 | 
163
 | 
     $methods{$has_method}  = sub { scalar @{shift->{$key} || []} };  | 
| 
 
 | 
38
 | 
 
 | 
 
 | 
 
 | 
 
 | 
883
 | 
    | 
| 
 
 | 
38
 | 
 
 | 
 
 | 
 
 | 
 
 | 
369
 | 
    | 
| 
469
 | 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
134
 | 
     $methods{$has_method2} = $methods{$has_method};  | 
| 
470
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   }  | 
| 
471
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
   else { Carp::croak "Unknown interface: $interface" }  | 
| 
472
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
473
 | 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
217
 | 
   return \%methods;  | 
| 
474
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
475
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
476
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub plural_to_singular  | 
| 
477
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 {  | 
| 
478
 | 
43
 | 
 
 | 
 
 | 
  
43
  
 | 
  
0
  
 | 
161
 | 
   my($word) = shift;  | 
| 
479
 | 
43
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
292
 | 
   return $word  if($word =~ /[aeiouy]ss$/i);  | 
| 
480
 | 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
202
 | 
   $word =~ s/s$//;  | 
| 
481
 | 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
178
 | 
   return $word;  | 
| 
482
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
483
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
484
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # Acceptable formats:  | 
| 
485
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #  | 
| 
486
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # <error object>, ...  | 
| 
487
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # <numeric error id> (id method only)  | 
| 
488
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # <list of numeric error ids> (non-singular id method only)  | 
| 
489
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # <numeric error id> <list of args> (singular only)  | 
| 
490
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # <numeric error id> <arrayref of args>, ...  | 
| 
491
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # <numeric error id> <hashref of args>, ...  | 
| 
492
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub __errors_from_args  | 
| 
493
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 {  | 
| 
494
 | 
113
 | 
 
 | 
 
 | 
  
113
  
 | 
 
 | 
1487
 | 
   my($self, $args, $error_class, $msg_class, $accept_error_class, $id_method, $singular) = @_;  | 
| 
495
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
496
 | 
113
 | 
 
 | 
 
 | 
 
 | 
 
 | 
277
 | 
   local $Carp::CarpLevel = 1;  | 
| 
497
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
498
 | 
113
 | 
  
 50
  
 | 
  
 66
  
 | 
 
 | 
 
 | 
529
 | 
   $args = $args->[0]  if(@$args == 1 && ref($args->[0]) eq 'ARRAY');  | 
| 
499
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
500
 | 
113
 | 
 
 | 
 
 | 
 
 | 
 
 | 
225
 | 
   my @errors;  | 
| 
501
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
502
 | 
113
 | 
 
 | 
 
 | 
 
 | 
 
 | 
336
 | 
   my $localizer = $self->localizer;  | 
| 
503
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
504
 | 
113
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3238
 | 
   for(my $i = 0; $i <= $#$args; $i++)  | 
| 
505
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   {  | 
| 
506
 | 
119
 | 
 
 | 
 
 | 
 
 | 
 
 | 
313
 | 
     my $arg = $args->[$i];  | 
| 
507
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
508
 | 
119
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
872
 | 
     if(UNIVERSAL::isa($arg, $accept_error_class))  | 
| 
509
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     {  | 
| 
510
 | 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
24
 | 
       $arg->parent($self);  | 
| 
511
 | 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
13
 | 
       push(@errors, $arg);  | 
| 
512
 | 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
15
 | 
       next;  | 
| 
513
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
514
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
515
 | 
114
 | 
 
 | 
 
 | 
 
 | 
 
 | 
232
 | 
     my $id = $arg;  | 
| 
516
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
517
 | 
114
 | 
  
100
  
 | 
  
100
  
 | 
 
 | 
 
 | 
899
 | 
     if($id_method && $id !~ /^\d+$/)  | 
| 
518
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     {  | 
| 
519
 | 
3
 | 
 
 | 
  
 33
  
 | 
 
 | 
 
 | 
18
 | 
       $id = $localizer->get_error_id($id) ||   | 
| 
520
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         Carp::croak "Unknown error id: '$id'";  | 
| 
521
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
522
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
523
 | 
114
 | 
 
 | 
 
 | 
 
 | 
 
 | 
277
 | 
     my @msg_args;  | 
| 
524
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
525
 | 
114
 | 
  
100
  
 | 
  
 66
  
 | 
 
 | 
 
 | 
735
 | 
     if(ref($args->[$i + 1]) =~ /^(?:HASH|ARRAY)$/)  | 
| 
 
 | 
 
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
526
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     {  | 
| 
527
 | 
57
 | 
 
 | 
 
 | 
 
 | 
 
 | 
194
 | 
       @msg_args = (args => $args->[++$i]);  | 
| 
528
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
529
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     elsif($singular && ($i + 1) < $#$args)  | 
| 
530
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     {  | 
| 
531
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
       @msg_args = (args => [ @$args[$i + 1 .. $#$args] ]);  | 
| 
532
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
       $i = $#$args;  | 
| 
533
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
534
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
535
 | 
114
 | 
 
 | 
 
 | 
 
 | 
 
 | 
447
 | 
     unshift(@msg_args, error_id => $id, msg_class => $msg_class);  | 
| 
536
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
537
 | 
114
 | 
 
 | 
 
 | 
 
 | 
 
 | 
202
 | 
     my $message;  | 
| 
538
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
539
 | 
114
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
509
 | 
     if($id =~ /^\d+$/)  | 
| 
540
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     {  | 
| 
541
 | 
105
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
485
 | 
       if($self->can('message_for_error_id'))  | 
| 
542
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       {  | 
| 
543
 | 
105
 | 
 
 | 
 
 | 
 
 | 
 
 | 
419
 | 
         $message = $self->message_for_error_id(@msg_args);  | 
| 
544
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
545
 | 
105
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
367
 | 
         unless(defined $message)  | 
| 
546
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         {  | 
| 
547
 | 
68
 | 
 
 | 
 
 | 
 
 | 
 
 | 
288
 | 
           $message = $localizer->message_for_error_id(@msg_args);  | 
| 
548
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
549
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       }  | 
| 
550
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       else  | 
| 
551
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       {  | 
| 
552
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
         $message = $localizer->message_for_error_id(@msg_args);  | 
| 
553
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       }  | 
| 
554
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
555
 | 
105
 | 
 
 | 
 
 | 
 
 | 
 
 | 
836
 | 
       push(@errors, $error_class->new(id       => $id,  | 
| 
556
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                                       message  => $message,   | 
| 
557
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                                       parent   => $self));  | 
| 
558
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
559
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     else  | 
| 
560
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     {  | 
| 
561
 | 
9
 | 
 
 | 
 
 | 
 
 | 
 
 | 
31
 | 
       push(@errors, $error_class->new(message => $msg_class->new($id),   | 
| 
562
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                                       parent  => $self));  | 
| 
563
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
564
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   }  | 
| 
565
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
566
 | 
113
 | 
 
 | 
 
 | 
 
 | 
 
 | 
971
 | 
   return \@errors;  | 
| 
567
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
568
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
569
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 1;  |