#!/usr/local/bin/perl # chronology.pl - reimplement chronology.cgi traversing file subtree # with native Perl instead of shelling out. $ROOTD = "/home/zaurus/cave/green"; $EXT = ".blink"; @subdq = @fileq = (); if ( -d $ROOTD ) { push(@subdq, $ROOTD); } while ( @subdq ) { $dir = pop(@subdq); opendir(DIR, $dir) || die "cannot open directory $dir"; while ( $entry = readdir(DIR) ) { if ( $entry =~ /^\./ ) { next; } else { $path = "$dir/$entry"; if ( -d $path ) { push(@subdq, $path); } elsif ( $path =~ /$EXT$/ ) { push(@fileq, $path); } } } closedir DIR; }