File Coverage

blib/lib/Surveyor/Benchmark/GetDirectoryListing.pm
Criterion Covered Total %
statement 8 21 38.1
branch 0 8 0.0
condition n/a
subroutine 3 7 42.8
pod 4 4 100.0
total 15 40 37.5


line stmt bran cond sub pod time code
1 1     1   3826 use v5.14;
  1         4  
2              
3             package Surveyor::Benchmark::GetDirectoryListing;
4 1     1   8 use strict;
  1         2  
  1         37  
5 1     1   6 use warnings;
  1         2  
  1         608  
6              
7             our $VERSION = '0.125';
8              
9             =encoding utf8
10              
11             =head1 NAME
12              
13             Surveyor::App - Run benchmarks from a package
14              
15             =head1 SYNOPSIS
16              
17             Use this package with the C program from L. Give
18             it a directory to list.
19              
20             % survey -p Surveyor::Benchmark::GetDirectoryListing directory_to_list
21              
22             =head1 DESCRIPTION
23              
24             This benchmark pits C against C in the directory that
25             you choose.
26              
27             =over 4
28              
29             =item set_up( DIRECTORY )
30              
31             Change to C before running the benchmark.
32              
33             =item tear_down()
34              
35             A no-op.
36              
37             =cut
38              
39             sub set_up {
40 0     0 1   my( $class, $directory ) = @_;
41 0 0         unless( defined $directory ) {
42 0           require Cwd;
43 0           $directory = Cwd::cwd();
44             }
45 0 0         die "Directory [$directory] does not exist!\n" unless -e $directory;
46 0 0         die "[$directory] does not exist!\n" unless -e $directory;
47 0 0         chdir( $directory ) or die "Could not change to $ARGV[0]: $!\n";
48 0           my @files = glob( '.* *' );
49 0           printf "$directory has %d files\n", scalar @files;
50             }
51              
52 0     0 1   sub tear_down { 1 }
53              
54             =item bench_opendir
55              
56             =cut
57              
58             sub bench_opendir {
59 0     0 1   opendir my( $dh ), ".";
60 0           my @f = readdir( $dh );
61             }
62              
63             =item bench_glob
64              
65             =cut
66              
67             sub bench_glob {
68 0     0 1   my @f = glob(".* *")
69             }
70              
71             __PACKAGE__;
72              
73             =back
74              
75             =head1 TO DO
76              
77              
78             =head1 SEE ALSO
79              
80              
81             =head1 SOURCE AVAILABILITY
82              
83             This source is in a Git repository that I haven't made public
84             because I haven't bothered to set it up. If you want to clone
85             it, just ask and we'll work something out.
86              
87             https://github.com/briandfoy/surveyor-app
88              
89             =head1 AUTHOR
90              
91             brian d foy, C<< >>
92              
93             =head1 COPYRIGHT AND LICENSE
94              
95             Copyright © 2013-2025, brian d foy . All rights reserved.
96              
97             You may redistribute this under the terms of the Artistic License 2.0.
98              
99             =cut