<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package Apache::DayLimit;

use strict;
use Apache::Constants ':common';
use Time::localtime;

my @wday = qw(sunday monday tuesday wednesday thursday friday saturday);

sub handler {
    my $r = shift;
    return DECLINED unless my $requires = $r-&gt;dir_config("RequireWeekdays");

    my $day = localtime-&gt;wday;

    for my $wd ( split /[,\s]+/, $requires ) {
	return OK if lc $wd eq $wday[$day];
    }

    $r-&gt;log_reason("Access forbidden on weekday `$wday[$day]'", $r-&gt;uri);
    return FORBIDDEN;
}

1;
__END__

=head1 NAME

Apache::DayLimit - Limit access based on weekday

=head1 SYNOPSIS

 &lt;Limit GET&gt;
 PerlSetVar RequireWeekdays  monday,tuesday,wednesday
 PerlAccessHandler Apache::DayLimit
 satisfy any
 &lt;/Limit&gt;

=head1 DESCRIPTION

Access to the given uri will only be allowed if the current weekday is
the B&lt;RequireWeekdays&gt; list.

=head1 SEE ALSO

mod_perl(3), Apache(3)

=head1 AUTHOR

Doug MacEachern


</pre></body></html>