Apache-LangURI
view release on metacpan or search on metacpan
push @{$PARAMS{&IGNORE_REGEX}}, sub { $neg == scalar(shift =~ $re) };
}
sub _default_lang { $PARAMS{&DEFAULT_LANG} = $_[2] }
sub _force_lang { $PARAMS{&FORCE_LANG} = ($_[2] =~ /^(1|true|on|yes)$/) }
sub _redir_perm { $PARAMS{&REDIR_PERM} = ($_[2] =~ /^(1|true|on|yes)$/) }
sub _handler {
my $r = shift;
if ($r->is_initial_req) {
$r->verify_config;
for my $ignore (@{$PARAMS{&IGNORE_REGEX}}) {
if ($ignore->($r->uri)) {
$r->log->debug
(sprintf("Ignoring %s that matches ignore regex.", $r->uri));
return Apache::DECLINED;
}
}
$r->set_accept_language;
return $r->perform_redirection;
}
sub _handler_1 ($$) {
my $r = bless { r => $_[1] }, $_[0];
return $r->_handler;
}
sub _handler_2 : method {
my $r = bless { r => $_[1] }, $_[0];
return $r->_handler;
}
sub verify_config {
my $r = shift;
$PARAMS{&DEFAULT_LANG} ||= $r->dir_config->get(DEFAULT_LANG);
for my $bit (FORCE_LANG, REDIR_PERM) {
my $cfg = $r->dir_config->get($bit) || '';
$PARAMS{$bit} ||= scalar($cfg =~ /^(1|true|on|yes)$/i);
}
map { _ignore_regex(undef,undef,$_) } $r->dir_config->get(IGNORE_REGEX)
unless @{$PARAMS{&IGNORE_REGEX}};
}
( run in 0.878 second using v1.01-cache-2.11-cpan-5467b0d2c73 )