sub test_content()

in t/modules/autoindex.t [410:443]


sub test_content {
    my $what = shift || 'create';
    return undef if ($what ne 'create' and $what ne 'destroy');

    foreach (sort keys %file) {
        my $file = "$dir/$_";
        $file = "$dir/$file_prefix.$_" unless ($_ eq 'README'
            or $_ eq '.htaccess');

        if ($what eq 'destroy') {
            unlink $file or print "warning: cant  unlink $file: $!\n";
            next;
        }

        open (FILE, ">$file") or die "cant open $file: $!";
        if ($_ eq 'README') {
            ## README file will contain actual text ##
            print FILE $readme;
        } else {
            ## everything else is just x's ##
            print FILE "x"x$file{$_}{size};
        }
        close(FILE);
    
        if ($file{$_}{date} == 0) {
            $file{$_}{date} = (stat($file))[9];
        } else {
            utime($file{$_}{date}, $file{$_}{date}, $file)
                or die "cant utime $file: $!";
        }
    
    }

}