# $Id$ package Apache::AxKit::DirHandler::Basic; use strict; use vars qw/@ISA/; @ISA = ('Apache::AxKit::DirHandler'); use Apache; use Apache::Log; use AxKit; use Apache::AxKit::DirHandler; use File::Spec; use Fcntl qw(O_RDONLY LOCK_SH); sub get_strref { my $self = shift; local (*DIR); my $dir = $self->{directory}; if (opendir(DIR, $dir)) { my $output = ' '; while(my $line = readdir(DIR)) { my $xmlline = AxKit::ToUTF8($line); $xmlline =~ s/&/&/; $xmlline =~ s/catfile($dir,$line)); my $attr = "size=\"$stat[7]\" atime=\"$stat[8]\" mtime=\"$stat[9]\" ctime=\"$stat[10]\""; $attr .= ' readable="1"' if (-r _); $attr .= ' writable="1"' if (-w _); $attr .= ' executable="1"' if (-x _); if (-f _) { $output .= "$xmlline\n"; } elsif (-d _) { $output .= "$xmlline\n"; } else { $output .= "$xmlline\n"; } } $output .= "\n"; return \$output; } return undef; } 1; __END__ =head1 NAME Apache::AxKit::DirHandler::Basic - directory handler implementing a simple XML output =head1 SYNOPSIS Override the base DirHandler class and enable it by using: AxHandleDirs on AxDirHandler Apache::AxKit::DirHandler::Basic # or AxHandleDirs on # This module is the default =head1 DESCRIPTION This module is the default Directory Handler when no handler is explicitly specified. It is intended to be simple to use and easy to get started with. =head1 SAMPLE OUTPUT . .. index.xml images .htaccess link-4.1a.tar.gz Bender.pl =head1 SEE ALSO L =cut