Apache-AutoIndex

 view release on metacpan or  search on metacpan

AutoIndex.pm  view on Meta::CPAN

sub push_config{
	my ($cfg, $parms, $value) = @_;
	my $key = $parms->info;
	if ($key eq 'ignore'){
		$value = patternize($value);
		}
	push @ {$cfg->{$key}}, $value;
return DECLINE_CMD if Apache->module('mod_autoindex.c');
}

sub DirectoryIndex($$$;*){
	my ($cfg, $parms, $files, $cfg_fh) = @_;
	for my $file (split /\s+/, $files){
		push @{$cfg->{indexfile}}, $file;
	}
return DECLINE_CMD if Apache->module('mod_dir.c');
}

sub IndexOptions($$$;*){
	my ($cfg, $parms, $directives, $cfg_fh) = @_;
	foreach (split /\s+/, $directives){
		my $option;
		(my $action, $_) = (lc $_) =~ /(\+|-)?(.*)/;

		if (/^none$/){
			die "Cannot combine '+' or '-' with 'None' keyword" if $action;
			$cfg->{options} = NO_OPTIONS;
			$cfg->{options_add} = 0;
			$cfg->{options_del} = 0;

AutoIndex.pm  view on Meta::CPAN

			}
		if (($cfg->{options} & NO_OPTIONS) && ($cfg->{options} & ~NO_OPTIONS)) {
			die "Cannot combine other IndexOptions keywords with 'None'";
			}
	}
return DECLINE_CMD if Apache->module('mod_autoindex.c');
}

# e.g. DirectoryIndex index.html index.htm index.cgi 

sub AddDescription($$$;*){
    #this is not completely supported.  
    #Since I didn't take the time to fully check mod_autoindex.c behavior,
    #I just implemented this as simplt as I could.
    #It's in my TODO
    my ($cfg, $parms, $args, $cfg_fh) = @_;
	my ($desc, $files) = ( $args =~ /^\s*"([^"]*)"\s+(.*)$/);
	my $file = join "|", split /\s+/, $files;
	$file = patternize($file);
    $cfg->{desc}{$file} = $desc; 
return DECLINE_CMD if Apache->module('mod_autoindex.c');
}

sub IndexOrderDefault($$$$){
	my ($cfg, $parms, $order, $key) = @_;
	die "First Keyword must be Ascending or ending" unless ( $order =~ /^(de|a)scending$/i);
	die "First Keyword must be Name, Date, Size or Description" unless ( $key =~ /^(date|name|size|description)$/i);
	if ($key =~ /date/i){
		$key = 'M';
		}
	else {
	    $key =~ s/(.).*$/$1/;
	}
	$order =~ s/(.).*$/$1/;



( run in 0.618 second using v1.01-cache-2.11-cpan-65fba6d93b7 )