aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2010-03-28 20:23:22 -0400
committerJoey Hess <joey@gnu.kitenet.net>2010-03-28 20:23:22 -0400
commit799b93d258bad917262ac160df74136f05d4a451 (patch)
treee56f4a9792e5b716a4b95116d08ebef8df51996c /IkiWiki.pm
parentb6666f5ac81ef4c8646a6290cf5c885adf0e385f (diff)
downloadikiwiki-799b93d258bad917262ac160df74136f05d4a451.tar
ikiwiki-799b93d258bad917262ac160df74136f05d4a451.tar.gz
don't check $@ after pagespec_translate
pagespec_translate may set $@ if it fails to parse a pagespec, but due to memoization, this is not reliable. If a memoized call is repeated, and $@ is already set for some other reason previously, it will remain set through the call to pagespec_translate. Instead, just check if pagespec_translate returns undef.
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r--IkiWiki.pm9
1 files changed, 4 insertions, 5 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 927d62940..6739ba56c 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -1796,7 +1796,7 @@ sub add_depends ($$;$) {
# Add explicit dependencies for influences.
my $sub=pagespec_translate($pagespec);
- return if $@;
+ return unless defined $sub;
foreach my $p (keys %pagesources) {
my $r=$sub->($p, location => $page);
my $i=$r->influences;
@@ -2001,7 +2001,7 @@ sub pagespec_match ($$;@) {
my $sub=pagespec_translate($spec);
return IkiWiki::ErrorReason->new("syntax error in pagespec \"$spec\"")
- if $@ || ! defined $sub;
+ if ! defined $sub;
return $sub->($page, @params);
}
@@ -2019,7 +2019,7 @@ sub pagespec_match_list ($$;@) {
my $sub=pagespec_translate($pagespec);
error "syntax error in pagespec \"$pagespec\""
- if $@ || ! defined $sub;
+ if ! defined $sub;
my @candidates;
if (exists $params{list}) {
@@ -2092,8 +2092,7 @@ sub pagespec_match_list ($$;@) {
sub pagespec_valid ($) {
my $spec=shift;
- my $sub=pagespec_translate($spec);
- return ! $@;
+ return defined pagespec_translate($spec);
}
sub glob2re ($) {