This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
assert() that we can't reach two unreachable code paths
[perl5.git] / x2p / find2perl.PL
index b99bb49..f10521a 100644 (file)
@@ -99,8 +99,10 @@ while (@ARGV) {
     } elsif ($_ eq '!') {
         $out .= tab . "!";
         next;
-    } elsif ($_ eq 'name') {
-        $out .= tab . '/' . fileglob_to_re(shift) . "/s";
+    } elsif (/^(i)?name$/) {
+        $out .= tab . '/' . fileglob_to_re(shift) . "/s$1";
+    } elsif (/^(i)?path$/) {
+        $out .= tab . '$File::Find::name =~ /' . fileglob_to_re(shift) . "/s$1";
     } elsif ($_ eq 'perm') {
         my $onum = shift;
         $onum =~ /^-?[0-7]+$/
@@ -266,7 +268,9 @@ while (@ARGV) {
 }
 
 if ($print_needed) {
-    $out .= "\n" . tab . '&& print("$name\n")';
+    my $t = tab;
+    if ($t !~ /&&\s*$/) { $t .= '&& ' }
+    $out .= "\n" . $t . 'print("$name\n")';
 }
 
 
@@ -781,6 +785,18 @@ File name matches specified GLOB wildcard pattern.  GLOB may need to be
 quoted to avoid interpretation by the shell (just as with using
 C<find(1)>).
 
+=item C<-iname GLOB>
+
+Like C<-name>, but the match is case insensitive.
+
+=item C<-path GLOB>
+
+Path name matches specified GLOB wildcard pattern.
+
+=item C<-ipath GLOB>
+
+Like C<-path>, but the match is case insensitive.
+
 =item C<-perm PERM>
 
 Low-order 9 bits of permission match octal value PERM.