carton
view release on metacpan or search on metacpan
lib/Carton.pm view on Meta::CPAN
unless ($found and (!$ver or version->new($found->{version}) >= version->new($ver))) {
push @$unsatisfied, {
module => $mod,
version => $ver,
found => $found ? $found->{version} : undef,
};
return;
}
my $requires = $self->merge_prereqs($found->{meta}{mymeta}{prereqs});
for my $module (keys %$requires) {
next if $module eq 'perl';
$self->_check_satisfies([ $module, $requires->{$module} ], $unsatisfied, $index, $pool);
}
}
sub uninstall {
my($self, $lock, $module) = @_;
my $meta = $lock->{modules}{$module};
(my $path_name = $meta->{name}) =~ s!::!/!g;
my $path = Cwd::realpath($self->{path});
my $packlist = "$path/lib/perl5/$Config{archname}/auto/$path_name/.packlist";
open my $fh, "<", $packlist or die "Couldn't locate .packlist for $meta->{name}";
while (<$fh>) {
# EUMM merges with site and perl library paths
chomp;
next unless /^\Q$path\E/;
unlink $_ or warn "Couldn't unlink $_: $!";
}
unlink $packlist;
if ($meta->{dist}) { # safety guard not to rm -r auto/meta
File::Path::rmtree("$self->{path}/lib/perl5/$Config{archname}/.meta/$meta->{dist}");
}
}
1;
__END__
=head1 NAME
Carton - Perl module dependency manager (aka Bundler for Perl)
=head1 SYNOPSIS
# On your development environment
> cat cpanfile
requires 'Plack', 0.9980;
requires 'Starman', 0.2000;
> carton install
> git add cpanfile carton.lock
> git commit -m "add Plack and Starman"
# Other developer's machine, or on a deployment box
> carton install
> carton exec -Ilib -- starman -p 8080 myapp.psgi
=head1 WARNING
B<This software is under heavy development and considered ALPHA
quality till its version hits v1.0.0. Things might be broken, not all
features have been implemented, and APIs are likely to change. YOU
HAVE BEEN WARNED.>
=head1 DESCRIPTION
carton is a command line tool to track the Perl module dependencies
for your Perl application. The managed dependencies are tracked in a
I<carton.lock> file, which is meant to be version controlled, and the
lock file allows other developers of your application will have the
exact same versions of the modules.
=head1 TUTORIAL
=head2 Initializing the environment
carton will use the I<.carton> directory for local configuration and
the I<local> directory to install modules into. You're recommended to
exclude these directories from the version control system.
> echo .carton/ >> .gitignore
> echo local/ >> .gitignore
> git add carton.lock
> git commit -m "Start using carton"
=head2 Tracking the dependencies
You can manage the dependencies of your application via I<cpanfile>.
# cpanfile
requires 'Plack', 0.9980;
requires 'Starman', 0.2000;
And then you can install these dependencies via:
> carton install
The modules are installed into your I<local> directory, and the
dependencies tree and version information are analyzed and saved into
I<carton.lock> in your directory.
Make sure you add I<carton.lock> to your version controlled repository
and commit changes as you update dependencies. This will ensure that
other developers on your app, as well as your deployment environment,
use exactly the same versions of the modules you just installed.
> git add cpanfile carton.lock
> git commit -m "Added Plack and Starman"
=head2 Deploying your application
Once you've done installing all the dependencies, you can push your
application directory to a remote machine (excluding I<local> and
I<.carton>) and run the following command:
> carton install
( run in 0.662 second using v1.01-cache-2.11-cpan-e93a5daba3e )