File: profile_listdir_vs_file-find-rule.pl

package info (click to toggle)
libfile-util-perl 4.201720-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 840 kB
  • sloc: perl: 4,353; makefile: 2
file content (28 lines) | stat: -rw-r--r-- 494 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/perl

# perl -d:NYTProf misc/profile_listdir_vs_file-find-rule.pl

use strict;
use warnings;

use lib './lib';
use lib '../lib';

use File::Util;
use File::Find::Rule;

my $f = File::Util->new();

# some dir with several subdirs (and .pod files preferably)
my $dir = shift @ARGV || '.';

for ( 1 .. 100 ) {

   print "$_\n";

   $f->list_dir( $dir => { recurse => 1, files_only => 1, files_match => qr/\.pod/ } );

   File::Find::Rule->file->name( qr/\.pod$/ )->in( $dir );
}

exit;