@candidates=reverse(@candidates) if $params{reverse};
+ $depends{$page}{$pagespec} |= ($params{deptype} || $DEPEND_CONTENT);
+
+ # clear params, remainder is passed to pagespec
+ my $num=$params{num};
+ delete @params{qw{num deptype reverse sort limit}};
+
my @matches;
my $firstfail;
my $count=0;
foreach my $p (@candidates) {
- my $r=$sub->($p, location => $page);
+ my $r=$sub->($p, %params, location => $page);
if ($r) {
push @matches, [$p, $r];
- last if defined $params{num} && ++$count == $params{num};
+ last if defined $num && ++$count == $num;
}
elsif (! defined $firstfail) {
$firstfail=$r;
}
}
-
- $depends{$page}{$pagespec} |= ($params{deptype} || $DEPEND_CONTENT);
my @ret;
if (@matches) {
`pagespec_match` in a loop. You should use this anytime a plugin
needs to match a set of pages and do something based on that list.
+Unlike pagespec_match, this may throw an error if there is an error in
+the pagespec.
+
Additional named parameters can be specified:
* `deptype` optionally specifies the type of dependency to add. Use the
* `list` makes it only match amoung the specified list of pages.
Default is to match amoung all pages in the wiki.
-Unlike pagespec_match, this may throw an error if there is an error in
-the pagespec.
+Any other named parameters are passed on to `pagespec_match`, to further
+limit the match.
#### `add_depends($$;$)`