Browse Source

Fortified op handlers against mising $a

Alois Mahdal (@azzgoat) 12 years ago
parent
commit
b2e6a5eea1
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      lib/SugarTrail/Template/Condition.pm

+ 3
- 3
lib/SugarTrail/Template/Condition.pm View File

8
 use warnings;
8
 use warnings;
9
 
9
 
10
 sub _equals {
10
 sub _equals {
11
-    my $a = shift;
11
+    my $a = shift or return;
12
     my $b = $_[0]->[0];
12
     my $b = $_[0]->[0];
13
     return $a eq $b;
13
     return $a eq $b;
14
 }
14
 }
15
 
15
 
16
 sub _regex {
16
 sub _regex {
17
-    my $a = shift;
17
+    my $a = shift or return;
18
     my $b = $_[0]->[0];
18
     my $b = $_[0]->[0];
19
     return $a =~ m/$b/;
19
     return $a =~ m/$b/;
20
 }
20
 }
21
 
21
 
22
 sub _in {
22
 sub _in {
23
-    my $a = shift;
23
+    my $a = shift or return;
24
     my %b = map { $_ => 1 } @_;
24
     my %b = map { $_ => 1 } @_;
25
     return exists $b{$a};
25
     return exists $b{$a};
26
 }
26
 }