, File:: ShareDir?
, dist, File:: ShareDir:: Install. File:: ShareDir.
. , . , :
my @cases = (
[ 'input1' => 'expected1' ],
# etc
);
for my $case ( @cases ) {
my ($input, $expected) = @$case;
is(
my_lookup_function($input),
$expected,
"$input => $expected",
);
}
,
my $dir = dist_dir('My-Dist');
.
Makefile.PL
, blib
. , , File::ShareDir::dist_dir
, .
Test:: File:: ShareDir, , , , .
, , , - (, , ;)
+3
2
.
perl Makefile.PL ; make
make test
prove -b
$ tree
.
├── Makefile.PL
├── share
│ └── quux
└── t
└── foo.t
2 directories, 3 files
$ cat Makefile.PL
use ExtUtils::MakeMaker;
use File::ShareDir::Install;
install_share 'share';
WriteMakefile;
package MY;
use File::ShareDir::Install qw(postamble);
$ cat t/foo.t
use File::ShareDir qw(dist_dir);
use Test::More;
diag dist_dir('My-Dist');
pass;
done_testing;
+2
Test::File::ShareDir, , ShareDir.
:
use Test::More;
# use FindBin; optional
use Test::File::ShareDir
# -root => "$FindBin::Bin/../" # optional,
-share => {
-module => { 'My::Module' => 'share/MyModule' }
-dist => { 'My-Dist' => 'share/somefolder' }
};
use My::Module;
use File::ShareDir qw( module_dir dist_dir );
module_dir( 'My::Module' ) # dir with files from $dist/share/MyModule
dist_dir( 'My-Dist' ) # dir with files from $dist/share/somefolder
+1