[carton] 287/472: move CPANfile load out of CLI
Lucas Kanashiro
kanashiro-guest at moszumanska.debian.org
Fri Jul 24 00:38:56 UTC 2015
This is an automated email from the git hooks/post-receive script.
kanashiro-guest pushed a commit to branch master
in repository carton.
commit 1c2f5b2aa6df026bc55bb68c9527a7275ebad923
Author: Tatsuhiko Miyagawa <miyagawa at bulknews.net>
Date: Wed Jun 5 15:31:38 2013 +0900
move CPANfile load out of CLI
---
lib/Carton/CLI.pm | 6 +-----
lib/Carton/Requirements.pm | 3 ++-
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/lib/Carton/CLI.pm b/lib/Carton/CLI.pm
index 3d84fe8..edb76ea 100644
--- a/lib/Carton/CLI.pm
+++ b/lib/Carton/CLI.pm
@@ -17,8 +17,6 @@ use Path::Tiny;
use Try::Tiny;
use Moo;
-use Module::CPANfile;
-
use constant { SUCCESS => 0, INFO => 1, WARN => 2, ERROR => 3 };
our $UseSystem = 0; # 1 for unit testing
@@ -257,9 +255,7 @@ sub cmd_tree {
my $lock = $self->find_lock
or $self->error("Can't find carton.lock: Run `carton install` to rebuild the lock file.\n");
- my $cpanfile = Module::CPANfile->load($self->find_cpanfile);
- my $requirements = Carton::Requirements->new(lock => $lock, cpanfile => $cpanfile);
-
+ my $requirements = Carton::Requirements->new(lock => $lock, cpanfile => $self->find_cpanfile);
$requirements->walk_down(sub { $self->_dump_requirement(@_) });
}
diff --git a/lib/Carton/Requirements.pm b/lib/Carton/Requirements.pm
index 5264c3e..517d861 100644
--- a/lib/Carton/Requirements.pm
+++ b/lib/Carton/Requirements.pm
@@ -3,9 +3,10 @@ use strict;
use Carton::Dependency;
use Moo;
use CPAN::Meta::Requirements;
+use Module::CPANfile;
has lock => (is => 'ro');
-has cpanfile => (is => 'ro');
+has cpanfile => (is => 'ro', coerce => sub { Module::CPANfile->load($_[0]) });
sub walk_down {
my($self, $cb) = @_;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/carton.git
More information about the Pkg-perl-cvs-commits
mailing list