#!/usr/bin/perl
#
# Buggy File::Find example for http://sial.org/howto/perl/file-find/
#
# $Id$
use strict;
use warnings;
#use diagnostics;
use File::Find qw/find/;
########################################################################
#
# MAIN
my $search_dir = shift || die "Usage: $0 search-dir\n";
find( \&handler, $search_dir );
exit 0;
########################################################################
#
# SUBROUTINES
sub handler {
my $current_dir = $File::Find::dir;
my $file = $File::Find::name;
warn "DBG: dir=$current_dir, file=$file ($_)\n";
my @stat_data = stat($file) or die "could not stat $file: $!\n";
}