| 1 | # Copyright (c) 2014, cPanel, Inc. | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # All rights reserved. | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # http://cpanel.net/ | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # This is free software; you can redistribute it and/or modify it under the same | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # terms as Perl itself. See the LICENSE file for further details. | ||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | package Filesys::POSIX::Userland::Find; | ||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 8 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 8 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 8 | ▶ | use Filesys::POSIX::Bits; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 8 | ▶ | use Filesys::POSIX::Module (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 8 | ▶ | use Filesys::POSIX::Path (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | 8 | ▶ | use Errno; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 8 | my @METHODS = qw(find); | |||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 8 | Filesys::POSIX::Module->export_methods( __PACKAGE__, @METHODS ); | |||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | Filesys::POSIX::Userland::Find - Crawl directories in a filesystem | ||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | use Filesys::POSIX; | ||||||||||||||||||||||||||||||||||||||||||
| 30 | use Filesys::POSIX::Real; | ||||||||||||||||||||||||||||||||||||||||||
| 31 | use Filesys::POSIX::Userland::Find; | ||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | my $fs = Filesys::POSIX->new(Filesys::POSIX::Real->new, | ||||||||||||||||||||||||||||||||||||||||||
| 34 | 'special' => 'real:/home/foo', | ||||||||||||||||||||||||||||||||||||||||||
| 35 | 'noatime' => 1 | ||||||||||||||||||||||||||||||||||||||||||
| 36 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | $fs->find(sub { | ||||||||||||||||||||||||||||||||||||||||||
| 39 | my ($path, $inode) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 40 | printf("0%o %s\n", $inode->{'mode'}, $path->full); | ||||||||||||||||||||||||||||||||||||||||||
| 41 | }, '/'); | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | This module provides an extension module to L<Filesys::POSIX> that operates | ||||||||||||||||||||||||||||||||||||||||||
| 46 | very similarly in principle to the Perl Core module L<File::Find>, albeit with | ||||||||||||||||||||||||||||||||||||||||||
| 47 | some minor differences and fewer options. For the sake of efficiency, tail | ||||||||||||||||||||||||||||||||||||||||||
| 48 | recursion, rather than pure call recursion, is used to handle very deep | ||||||||||||||||||||||||||||||||||||||||||
| 49 | hierarchies. | ||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | =head1 USAGE | ||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | =item C<$fs-E<gt>find($callback, @paths)> | ||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | =item C<$fs-E<gt>find($callback, $options, @paths)> | ||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | C<$fs-E<gt>find> will perform recursive descent into each path passed, printing | ||||||||||||||||||||||||||||||||||||||||||
| 60 | the full pathname of each item found relative to each item found in the | ||||||||||||||||||||||||||||||||||||||||||
| 61 | C<@paths> list. For each item found, both a Filesys::POSIX::Path object, and an | ||||||||||||||||||||||||||||||||||||||||||
| 62 | inode, respectively, are passed as the sole arguments to the callback. With | ||||||||||||||||||||||||||||||||||||||||||
| 63 | this mechanism, it is possible to retrieve path data from each item in every way | ||||||||||||||||||||||||||||||||||||||||||
| 64 | currently provided by L<File::Find>, without retaining global state to do so. | ||||||||||||||||||||||||||||||||||||||||||
| 65 | As a reference to the corresponding item's inode object is passed, there is no | ||||||||||||||||||||||||||||||||||||||||||
| 66 | need to perform a C<$fs-E<gt>stat> call to further inspect the item. | ||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | When called with an C<$options> argument, specified in the form of an anonymous | ||||||||||||||||||||||||||||||||||||||||||
| 69 | HASH, the following flags (whose values are set nonzero) are honored: | ||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | =item C<follow> | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | Any symlinks found along the way are resolved; if the paths they resolve to are | ||||||||||||||||||||||||||||||||||||||||||
| 76 | those of directories, then further descent will be made into said directories. | ||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | =item C<recursion_mode> | ||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | Specifies the strategy to use when recursing through directories. Available | ||||||||||||||||||||||||||||||||||||||||||
| 81 | options are: | ||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | =item breadth | ||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | Traverse in a breadth-first manner. This is the default mode. | ||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | =item depth | ||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | Traverse in a depth-first manner. | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | =item device | ||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | Traverse inodes that are on the same device first. This mode also tracks the | ||||||||||||||||||||||||||||||||||||||||||
| 96 | current filesystem it is processing and invokes the C<$fs-E<gt>enter_filesystem> | ||||||||||||||||||||||||||||||||||||||||||
| 97 | and C<$fs-E<gt>exit_filesystem> methods when the current filesystem changes to | ||||||||||||||||||||||||||||||||||||||||||
| 98 | optimize these calls. | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | =item C<ignore_missing> | ||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||
| 104 | When set, ignore if a file or directory becomes missing during recursion. If the | ||||||||||||||||||||||||||||||||||||||||||
| 105 | value is a coderef, calls that function with the name of the missing file. | ||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | =item C<ignore_inaccessible> | ||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | When set, ignore if a file or directory becomes unreadable during recursion. If | ||||||||||||||||||||||||||||||||||||||||||
| 110 | the value is a coderef, calls that function with the name of the inaccessible file. | ||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | 13 | ▶ | sub find { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find: called CC=36 SCAR=52.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | 13 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 116 | 13 | my $callback = shift; | |||||||||||||||||||||||||||||||||||||||||
| 117 | 13 | ▶ | my %opts = ref $_[0] eq 'HASH' ? %{ (shift) } : (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 118 | 13 | my @args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | 13 | my @paths = map { Filesys::POSIX::Path->new($_) } @args; | |||||||||||||||||||||||||||||||||||||||||
| 121 | 13 | ▶ | my @inodes = map { $opts{'follow'} ? $self->stat($_) : $self->lstat($_) } @args; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | 13 | ▶ | my $recursion_mode = defined $opts{'recursion_mode'} ? $opts{'recursion_mode'} : 'breadth'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 124 | 13 | ▶ | if ( $recursion_mode ne 'breadth' && $recursion_mode ne 'depth' && $recursion_mode ne 'device' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$recursion_mode ne "breadth" and $recursion_mode ne "depth" and $recursion_mode ne "device"
$recursion_mode ne "breadth" and $recursion_mode ne "depth"
MC/DC0%0/3
$recursion_mode ne "breadth" and $recursion_mode ne "depth" and $recursion_mode ne "device"
$recursion_mode ne "breadth"
$recursion_mode ne "depth"
$recursion_mode ne "device"
Truth table25%1/4
A and B and C
A= $recursion_mode ne "breadth"B= $recursion_mode ne "depth"C= $recursion_mode ne "device"
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | die "Invalid recursion mode $recursion_mode specified"; | |||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | 13 | my $current_dev; | |||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | 13 | ▶ | while ( my $inode = pop @inodes ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | 115 | my $path = pop @paths; | |||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | 115 | ▶ | if ( $recursion_mode eq 'device' && ( !defined $current_dev || $current_dev != $inode->{'dev'} ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition16%1/6
$recursion_mode eq "device" and !defined($current_dev) || $current_dev != $inode->{"dev"}
not defined $current_dev or $current_dev != $inode->{"dev"}
MC/DC0%0/3
$recursion_mode eq "device" and !defined($current_dev) || $current_dev != $inode->{"dev"}
$recursion_mode eq "device"
not defined $current_dev
$current_dev != $inode->{"dev"}
Truth table25%1/4
A and not(B) or C
A= $recursion_mode eq "device"B= not defined $current_devC= $current_dev != $inode->{"dev"}
| |||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | if ( defined $current_dev && $current_dev->can('exit_filesystem') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $current_dev and $current_dev->can("exit_filesystem")
MC/DC0%0/2
defined $current_dev and $current_dev->can("exit_filesystem")
defined $current_dev
$current_dev->can("exit_filesystem")
Truth table0%0/3
A and B
A= defined $current_devB= $current_dev->can("exit_filesystem")
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | $current_dev->exit_filesystem(); | |||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | ▶ | if ( defined $inode->{'dev'} && $inode->{'dev'}->can('enter_filesystem') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $inode->{"dev"} and $inode->{"dev"}->can("enter_filesystem")
MC/DC0%0/2
defined $inode->{"dev"} and $inode->{"dev"}->can("enter_filesystem")
defined $inode->{"dev"}
$inode->{"dev"}->can("enter_filesystem")
Truth table0%0/3
A and B
A= defined $inode->{"dev"}B= $inode->{"dev"}->can("enter_filesystem")
| |||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | $inode->{'dev'}->enter_filesystem(); | |||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | $current_dev = $inode->{'dev'}; | |||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | 115 | $callback->( $path, $inode ); | |||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | 114 | ▶ | if ( $inode->dir ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | 67 | my $directory; | |||||||||||||||||||||||||||||||||||||||||
| 147 | 67 | eval { $directory = $inode->directory->open; }; | |||||||||||||||||||||||||||||||||||||||||
| 148 | 67 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | if ( $! == &Errno::ENOENT && $opts{'ignore_missing'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$! == &Errno::ENOENT and $opts{"ignore_missing"}
MC/DC0%0/2
$! == &Errno::ENOENT and $opts{"ignore_missing"}
$! == &Errno::ENOENT
$opts{"ignore_missing"}
Truth table0%0/3
A and B
A= $! == &Errno::ENOENTB= $opts{"ignore_missing"}
| |||||||||||||||||||||||||||||||||||||||||||
| 150 | $opts{'ignore_missing'}->( $path->full() ) | ||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | if ref $opts{'ignore_missing'} eq 'CODE'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||
| 153 | ▶ | elsif ( $! == &Errno::EACCES && $opts{'ignore_inaccessible'} ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$! == &Errno::EACCES and $opts{"ignore_inaccessible"}
MC/DC0%0/2
$! == &Errno::EACCES and $opts{"ignore_inaccessible"}
$! == &Errno::EACCES
$opts{"ignore_inaccessible"}
Truth table0%0/3
A and B
A= $! == &Errno::EACCESB= $opts{"ignore_inaccessible"}
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | $opts{'ignore_inaccessible'}->( $path->full() ) | ||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | if ref $opts{'ignore_inaccessible'} eq 'CODE'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||
| 157 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | die $@; | |||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | 67 | ▶ | if ( defined $directory ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | 67 | ▶ | while ( defined( my $item = $directory->read ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | 236 | ▶ | next if $item eq '.' || $item eq '..'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$item eq "." or $item eq ".."
MC/DC100%2/2
$item eq "." or $item eq ".."
$item eq "."
$item eq ".."
Truth table100%3/3
A or B
A= $item eq "."B= $item eq ".."
| |||||||||||||||||||||||||||||||||||||||||||
| 165 | 102 | my $subpath = Filesys::POSIX::Path->new( $path->full . "/$item" ); | |||||||||||||||||||||||||||||||||||||||||
| 166 | 102 | my $subnode = $self->{'vfs'}->vnode( $directory->get($item) ); | |||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||
| 168 | 102 | ▶ | if ( $opts{'follow'} && defined $subnode && $subnode->link ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$opts{"follow"} and defined $subnode and $subnode->link
$opts{"follow"} and defined $subnode
MC/DC66%2/3
$opts{"follow"} and defined $subnode and $subnode->link
$opts{"follow"}
defined $subnode
$subnode->link
Truth table75%3/4
A and B and C
A= $opts{"follow"}B= defined $subnodeC= $subnode->link
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | 1 | $subnode = $self->stat( $subnode->readlink ); | |||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | 102 | ▶ | if ( !defined $subnode ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | if ( $opts{'ignore_inaccessible'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | $opts{'ignore_inaccessible'}->( $path->full() . "/$item" ) | ||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | ▶ | if ref $opts{'ignore_inaccessible'} eq 'CODE'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||
| 177 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | die "Failed to read " . $path->full() . "/$item"; | |||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||
| 181 | ▶ | elsif ( $recursion_mode eq 'depth' || ( $recursion_mode eq 'device' && $current_dev == $subnode->{'dev'} ) ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$recursion_mode eq "depth" or $recursion_mode eq "device" and $current_dev == $subnode->{"dev"}
$recursion_mode eq "device" and $current_dev == $subnode->{"dev"}
MC/DC0%0/3
$recursion_mode eq "depth" or $recursion_mode eq "device" and $current_dev == $subnode->{"dev"}
$recursion_mode eq "depth"
$recursion_mode eq "device"
$current_dev == $subnode->{"dev"}
Truth table25%1/4
A or B and C
A= $recursion_mode eq "depth"B= $recursion_mode eq "device"C= $current_dev == $subnode->{"dev"}
| |||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | push @paths, $subpath; | |||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | push @inodes, $subnode; | |||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||
| 185 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 186 | 102 | unshift @paths, $subpath; | |||||||||||||||||||||||||||||||||||||||||
| 187 | 102 | unshift @inodes, $subnode; | |||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||
| 190 | 67 | $directory->close; | |||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | 8 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | __END__ | ||||||||||||||||||||||||||||||||||||||||||