Lines Matching full:find

1 package File::Find;
14 our @EXPORT = qw(find finddepth);
31 return substr($cdir,0,rindex($cdir,'/')) if $fn eq $File::Find::current_dir;
146 # call find() or finddepth()
185 # for compatibility reasons (find.pl, find2perl)
189 $avoid_nlink = $follow || $File::Find::dont_use_nlink;
213 elsif ($top_item eq $File::Find::current_dir) {
277 $name = $abs_dir . $_; # $File::Find::name
288 die "insecure cwd in find(depth)";
315 my $dir_rel = $File::Find::current_dir;
335 unless ( $no_chdir || ($p_dir eq $File::Find::current_dir)) {
359 $dir= $p_dir; # $File::Find::dir
360 $name= $dir_name; # $File::Find::name
369 unless ($no_chdir || ($dir_rel eq $File::Find::current_dir)) {
389 $dir= $dir_name; # $File::Find::dir
393 unless (opendir $dh, ($no_chdir ? $dir_name : $File::Find::current_dir)) {
419 next if $FN =~ $File::Find::skip_pattern;
421 $name = $dir_pref . $FN; # $File::Find::name
437 next if $FN =~ $File::Find::skip_pattern;
453 $name = $dir_pref . $FN; # $File::Find::name
459 $name = $dir_pref . $FN; # $File::Find::name
499 $name = $dir = $p_dir; # $File::Find::name / dir
500 $_ = $File::Find::current_dir;
541 my $dir_rel = $File::Find::current_dir;
567 $ok = chdir($updir_loc) unless ($p_dir eq $File::Find::current_dir);
586 $dir= $p_dir; # $File::Find::dir
587 $name= $dir_name; # $File::Find::name
589 $fullname= $dir_loc; # $File::Find::fullname
598 unless ($no_chdir || ($dir_rel eq $File::Find::current_dir)) {
618 $dir = $dir_name; # $File::Find::dir
622 unless (opendir $dh, ($no_chdir ? $dir_loc : $File::Find::current_dir)) {
638 next if $FN =~ $File::Find::skip_pattern;
672 $fullname = $new_loc; # $File::Find::fullname
673 $name = $dir_pref . $FN; # $File::Find::name
687 unless ($no_chdir || ($dir_rel eq $File::Find::current_dir)) {
693 $fullname = $dir_loc; # $File::Find::fullname
694 $name = $dir_name; # $File::Find::name
696 substr($name, length($name) == 2 ? -1 : -2) = ''; # $File::Find::name
698 $dir = $p_dir; # $File::Find::dir
747 $wanted->{untaint_pattern} = $File::Find::untaint_pattern
761 sub find {
773 $File::Find::skip_pattern = qr/^\.{1,2}\z/;
774 $File::Find::untaint_pattern = qr|^([-+@\w./]+)$|;
777 # where File::Find can be expected to work
778 $File::Find::current_dir = File::Spec->curdir || '.';
780 $File::Find::dont_use_nlink = 1;
797 File::Find - Traverse a directory tree.
801 use File::Find;
802 find(\&wanted, @directories_to_search);
805 use File::Find;
809 use File::Find;
810 find({ wanted => \&process, follow => 1 }, '.');
815 on each file found similar to the Unix L<find(1)> command. C<File::Find>
816 exports two functions, C<find> and C<finddepth>. They work similarly
821 =item B<find>
823 find(\&wanted, @directories);
824 find(\%options, @directories);
826 C<find()> does a depth-first search over the given C<@directories> in
838 C<finddepth()> works just like C<find()> except that it invokes the
842 where C<find()> works from the top of the tree down.
846 Despite the name of the C<finddepth()> function, both C<find()> and
851 The first argument to C<find()> is either a code reference to your
870 specifying C<< { bydepth => 1 } >> in the first argument of C<find()>.
876 directory is in C<$File::Find::dir>. Your preprocessing function is
888 arguments. The name of the current directory is in C<$File::Find::dir>. This
913 There is a variable C<$File::Find::fullname> which holds the absolute
932 are about to be processed a second time, C<File::Find> dies.
934 C<follow_skip==0> causes C<File::Find> to die if any file is about to be
937 C<follow_skip==2> causes C<File::Find> to ignore any duplicate files and
953 C<$_> will be the same as C<$File::Find::name>.
957 If find is used in L<taint-mode|perlsec/Taint mode> (C<-T> command line
983 C<File::Find> if a file is "wanted" or not. In fact, its return value
991 =item C<$File::Find::dir> is the current directory name,
995 =item C<$File::Find::name> is the complete pathname to the file.
1004 $File::Find::dir = /some/path/
1006 $File::Find::name = /some/path/foo.ext
1008 You are C<chdir()>'d to C<$File::Find::dir> when the function is called,
1011 special case inasmuch as the concatenation of C<$File::Find::dir>,
1012 C<'/'> and C<$_> is not literally equal to C<$File::Find::name>. The
1015 $File::Find::name $File::Find::dir $_
1026 also a C<$File::Find::fullname>. The function may set
1027 C<$File::Find::prune> to prune the tree unless C<bydepth> was
1029 compatibility reasons (C<find.pl>, L<find2perl>) there are
1030 in addition the following globals available: C<$File::Find::topdir>,
1031 C<$File::Find::topdev>, C<$File::Find::topino>,
1032 C<$File::Find::topmode> and C<$File::Find::topnlink>.
1050 ($File::Find::prune = 1);
1057 Here's another interesting wanted function. It will find all symbolic
1061 -l && !-e && print "bogus link: $File::Find::name\n";
1067 find(\&wanted, "./foo", "./bar", "./baz/epsilon");
1078 C<warnings> pragma, File::Find will report warnings for several weird
1081 no warnings 'File::Find';
1092 You can set the variable C<$File::Find::dont_use_nlink> to C<0> if you
1096 If you do set C<$File::Find::dont_use_nlink> to 0, you may notice an
1100 C<$File::Find::dont_use_nlink> now defaults to 1 on all platforms.
1116 C<File::Find> used to produce incorrect results if called recursively.
1118 The first fixed version of C<File::Find> was 1.01.
1122 L<find(1)>, L<find2perl>