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.
# Add explicit dependencies for influences.
my $sub=pagespec_translate($pagespec);
# Add explicit dependencies for influences.
my $sub=pagespec_translate($pagespec);
+ return unless defined $sub;
foreach my $p (keys %pagesources) {
my $r=$sub->($p, location => $page);
my $i=$r->influences;
foreach my $p (keys %pagesources) {
my $r=$sub->($p, location => $page);
my $i=$r->influences;
my $sub=pagespec_translate($spec);
return IkiWiki::ErrorReason->new("syntax error in pagespec \"$spec\"")
my $sub=pagespec_translate($spec);
return IkiWiki::ErrorReason->new("syntax error in pagespec \"$spec\"")
- if $@ || ! defined $sub;
return $sub->($page, @params);
}
return $sub->($page, @params);
}
my $sub=pagespec_translate($pagespec);
error "syntax error in pagespec \"$pagespec\""
my $sub=pagespec_translate($pagespec);
error "syntax error in pagespec \"$pagespec\""
- if $@ || ! defined $sub;
my @candidates;
if (exists $params{list}) {
my @candidates;
if (exists $params{list}) {
sub pagespec_valid ($) {
my $spec=shift;
sub pagespec_valid ($) {
my $spec=shift;
- my $sub=pagespec_translate($spec);
- return ! $@;
+ return defined pagespec_translate($spec);
if (exists $depends{$p} && ! defined $reason) {
foreach my $dep (keys %{$depends{$p}}) {
my $sub=pagespec_translate($dep);
if (exists $depends{$p} && ! defined $reason) {
foreach my $dep (keys %{$depends{$p}}) {
my $sub=pagespec_translate($dep);
- next if $@ || ! defined $sub;
+ next unless defined $sub;
# only consider internal files
# if the page explicitly depends
# only consider internal files
# if the page explicitly depends