NAME
   Net::FTP::Find - Traverse a directory tree through Net::FTP

SYNOPSIS
     use Net::FTP::Find;

     my $ftp = Net::FTP::Find->new('localhost');
     $ftp->login('user', 'pass');

     $ftp->find(sub { ... }, '/');

     $ftp->finddepth(sub { ... }, '/');

   or

     use Net::FTP;
     use Net::FTP::Find::Mixin;

     my $ftp = Net::FTP->new('localhost');
     $ftp->login('user', 'pass');

     $ftp->find(sub { ... }, '/');

     $ftp->finddepth(sub { ... }, '/');

DESCRIPTION
   These are functions for searching through directory trees doing work on
   each file found similar to the File::Find. Net::FTP::Find provides two
   functions, "find" and "finddepth". They work similarly but have subtle
   differences.

FUNCTIONS
   find
        $ftp->find(\&wanted,  @directories);
        $ftp->find(\%options, @directories);

   finddepth
        $ftp->finddepth(\&wanted,  @directories);
        $ftp->finddepth(\%options, @directories);

 %options
   The first argument to "find()" is either a code reference to your
   &wanted function, or a hash reference describing the operations to be
   performed for each file. The code reference is described in "The wanted
   function" below.

   Here are the possible keys for the hash:

   "wanted"
      The value should be a code reference. This code reference is
      described in "The wanted function" below. The &wanted subroutine is
      mandatory.

   "bydepth"
      Reports the name of a directory only AFTER all its entries have been
      reported. Entry point "finddepth()" is a shortcut for specifying "{
      bydepth => 1 }" in the first argument of "find()".

   "no_chdir"
      Does not "cwd()" to each directory as it recurses. The "wanted()"
      function will need to be aware of this, of course. In this case, $_
      will be the same as $Net::FTP::Find::name.

   "max_depth"
      The directories that are deeper than this value is traversed.

   "min_depth"
      The directories that are shallower than this value is traversed.

 The wanted function
   The "wanted()" function does whatever verifications you want on each
   file and directory. Note that despite its name, the "wanted()" function
   is a generic callback function, and does not tell Net::FTP::Find if a
   file is "wanted" or not. In fact, its return value is ignored.

   The wanted function takes no arguments but rather does its work through
   a collection of variables.

   $Net::FTP::Find::dir is the current directory name,
   $_ is the current filename within that directory
   $Net::FTP::Find::name is the complete pathname to the file.

   The above variables have all been localized and may be changed without
   effecting data outside of the wanted function.

   For example, when examining the file /some/path/foo.ext you will have:

       $Net::FTP::Find::dir  = /some/path/
       $_                    = foo.ext
       $Net::FTP::Find::name = /some/path/foo.ext

   You are cwd()'d to $Net::FTP::Find::dir when the function is called,
   unless "no_chdir" was specified. Note that when changing to directories
   is in effect the root directory (/) is a somewhat special case inasmuch
   as the concatenation of $Net::FTP::Find::dir, '/' and $_ is not
   literally equal to $Net::FTP::Find::name. The table below summarizes all
   variants:

                 $Net::FTP::Find::name  $Net::FTP::Find::dir  $_
    default      /                      /                     .
    no_chdir=>0  /etc                   /                     etc
                 /etc/x                 /etc                  x

    no_chdir=>1  /                      /                     /
                 /etc                   /                     /etc
                 /etc/x                 /etc                  /etc/x

AUTHOR
   Taku Amano <[email protected]>

   A mostly parts of the document are from File::Find.

SEE ALSO
   File::Find Net::FTP::Find::Mixin

LICENSE
   This library is free software; you can redistribute it and/or modify it
   under the same terms as Perl itself.