1 package Web::Dispatch::Predicates;
6 our @EXPORT = qw(match_and match_or match_method match_path match_path_strip);
12 my $my_env = { %$env };
15 foreach my $match (@match) {
16 if (my @this_got = $match->($my_env)) {
17 my %change_env = %{shift(@this_got)};
18 @{$my_env}{keys %change_env} = values %change_env;
19 @{$new_env}{keys %change_env} = values %change_env;
25 return ($new_env, @got);
32 foreach my $try (@match) {
33 if (my @ret = $try->(@_)) {
45 $env->{REQUEST_METHOD} eq $method ? {} : ()
53 if (my @cap = ($env->{PATH_INFO} =~ /$re/)) {
54 $cap[0] = {}; return @cap;
60 sub match_path_strip {
64 if (my @cap = ($env->{PATH_INFO} =~ /$re/)) {
66 SCRIPT_NAME => ($env->{SCRIPT_NAME}||'').$cap[0],
67 PATH_INFO => pop(@cap),