#!/perl/bin/perl
use warnings;
use strict;
use File::Slurp::Tree;
use CGI qw(:header);
use CGI::Carp qw(fatalsToBrowser);
use CGI qw/:standard/;
# The tree datastructure is a hash of hashes. The keys of
# each hash are names of directories or files. Directories
# have hash references as their value, files have a scalar
# which holds the contents of the file.
my $dir = "c:/progra~1/apache~1/apache2/cgi-bin/test";
my %tree;
my $tree = slurp_tree($dir);
my $depth = 0;
print header();
print_keys($tree);
sub print_keys {
my $href = shift;
$depth++;
foreach ( keys %$href ) {
if(-d $_){ print "Dir exists= $_ ";}
print '****' x $depth, " --$_ \n";
print_keys( $href->{$_} ) if ref $href->{$_} eq 'HASH';
}
$depth--;
}