Subject: | Module only works in the case dist_dir = '.' |
Hi,
The module only works when dist_dir = '.'. Find_modules is changing
directory to $dist_dir, but _find_modules assumes this hasn't occured.
[woolger@rum module]$ cat module_depend.pl
#!/usr/bin/perl
use YAML;
use Module::Depends;
use Module::Depends::Intrusive;
use File::chdir;
print $CWD . "\n";
my $deps = Module::Depends->new;
$deps->dist_dir('Module-Depends-0.03');
$deps->find_modules;
print "Errors:\n", $deps->error, "\n";
$CWD = 'Module-Depends-0.03';
print $CWD . "\n";
my $deps = Module::Depends->new;
$deps->dist_dir('.');
$deps->find_modules;
print "Errors:\n", $deps->error, "\n";
[woolger@rum module]$ ./module_depend.pl
/mnt/data/home/woolger/perl/module
Errors:
No META.yml found in Module-Depends-0.03
/mnt/data/home/woolger/perl/module/Module-Depends-0.03
Errors:
[woolger@rum module]$ pwd
/home/woolger/perl/module
[woolger@rum module]$ ls Module-Depends-0.03
blib Build Changes Makefile.PL MANIFEST.SKIP NINJA t
_build Build.PL lib MANIFEST META.yml README
[woolger@rum module]$
The attached patch resolves this by making _find_modules assume that the
chdir has already occurred. I'm not sure if the use of File::Spec->catfile
on the absolute path + META.yml would be better.
Also the SYNOPSIS is invalid...
[woolger@rum Module-Depends-0.03]$ perl
use YAML;
use Module::Depends;
my $deps = Module::Depends->new->dist_dir( '.' )->find_modules;
print "Our dependencies:\n", Dump { $depends->requires };
Can't call method "requires" on an undefined value at - line 4.
[woolger@rum Module-Depends-0.03]$
[woolger@rum Module-Depends-0.03]$ perl
use YAML;
use Module::Depends;
my $deps = Module::Depends->new->dist_dir( '.' )->find_modules;
print "Our dependencies:\n", Dump { $deps->requires };
Our dependencies:
--- #YAML:1.0
HASH(0x8217290): ~
[woolger@rum Module-Depends-0.03]$ perl
use YAML;
use Module::Depends;
my $deps = Module::Depends->new->dist_dir( '.' )->find_modules;
print "Our dependencies:\n", Dump $deps->requires;
Our dependencies:
--- #YAML:1.0
Class::Accessor::Chained: 0
File::Spec: 0
File::chdir: 0
YAML: 0
[woolger@rum Module-Depends-0.03]$
Message body not shown because it is not plain text.