sub new { my $class = shift; my $base = shift; my $self = {}; bless $self, $class; # store my base for later $self->{base} = $base; $debug && print "spawned with base [$base]\n"; # read in contents of current directory opendir (BASE, $base); my @entries = grep !/^\.\.?\z/, readdir BASE; chomp(@entries); closedir(BASE); for my $entry (@entries) { print "DEBUG: processing '$base/$entry'\n"; # if entry is a directory, launch a new File::List to explore it # and store a reference to the new object in the dirlist hash if (-d "$base/$entry") { $debug && print _trace(),"following directory $base/$entry\n"; my $newbase = new File::List("$base/$entry"); $self->{dirlist}{ $entry } = $newbase; } # if entry is a file, store it's name in the dirlist hash elsif ( -f "$base/$entry"){ $debug && print _trace(),"Found file : $base/$entry\n"; $self->{dirlist}{ $entry } = 1; } else { print "DEBUG: '$base/$entry' is not -f nor -d\n"; } } return $self; } #### DEBUG: processing '/tmp/zumlaut//Zatôichi 01 - The Tale of Zatoichi (1962)' DEBUG: processing '/tmp/zumlaut//Zatôichi 01 - The Tale of Zatoichi (1962)/folder.jpg' DEBUG: processing '/tmp/zumlaut//Zatôichi 01 - The Tale of Zatoichi (1962)/VIDEO_TS' DEBUG: processing '/tmp/zumlaut//Zatôichi 01 - The Tale of Zatoichi (1962)/VIDEO_TS/fanart.jpg' DEBUG: processing '/tmp/zumlaut//Zatôichi 01 - The Tale of Zatoichi (1962)/VIDEO_TS/VIDEO_TS.TAG' DEBUG: processing '/tmp/zumlaut//Zatôichi 01 - The Tale of Zatoichi (1962)/backdrop.jpg' DEBUG: processing '/tmp/zumlaut//Zatôichi 01 - The Tale of Zatoichi (1962)/mymovies.xml' DEBUG: processing '/tmp/zumlaut//Pan's Labyrinth (2006)' DEBUG: processing '/tmp/zumlaut//Pan's Labyrinth (2006)/folder.jpg' DEBUG: processing '/tmp/zumlaut//Pan's Labyrinth (2006)/BDMV' DEBUG: processing '/tmp/zumlaut//Pan's Labyrinth (2006)/BDMV/index.TAG' DEBUG: processing '/tmp/zumlaut//Pan's Labyrinth (2006)/BDMV/fanart.jpg' DEBUG: processing '/tmp/zumlaut//Pan's Labyrinth (2006)/backdrop.jpg' DEBUG: processing '/tmp/zumlaut//Pan's Labyrinth (2006)/mymovies.xml' #### DEBUG: processing '/tmp/zumlaut//Zatôichi 01 - The Tale of Zatoichi (1962)' DEBUG: '/tmp/zumlaut//Zatôichi 01 - The Tale of Zatoichi (1962)' is not -f nor -d DEBUG: processing '/tmp/zumlaut//Pan's Labyrinth (2006)' DEBUG: processing '/tmp/zumlaut//Pan's Labyrinth (2006)/folder.jpg' DEBUG: processing '/tmp/zumlaut//Pan's Labyrinth (2006)/BDMV' DEBUG: processing '/tmp/zumlaut//Pan's Labyrinth (2006)/BDMV/index.TAG' DEBUG: processing '/tmp/zumlaut//Pan's Labyrinth (2006)/BDMV/fanart.jpg' DEBUG: processing '/tmp/zumlaut//Pan's Labyrinth (2006)/backdrop.jpg' DEBUG: processing '/tmp/zumlaut//Pan's Labyrinth (2006)/mymovies.xml'