This script runs perfectly in your local OS X. # download.pl use strict; use warnings; use HTTP::Tiny; my $http = HTTP::Tiny->new; my $url = "http://www.cpan.org/src/5.0/perl-5.22.1.tar.gz"; my $res = $http->mirror($url => "perl-5.22.1.tar.gz"); if ($res->{success}) { warn "Complete!\n"; } else { die "Failed $res->{status}"; }
host, you’ll get • This is because the perl in CentOS6 is so old that it does not have HTTP::Tiny in core :/ $ /usr/bin/perl download.pl Can’t locate HTTP/Tiny.pm in @INC (@INC contains…)
in remote host • But it is sometimes tiresome, or even impossible. • Okay let’s introduce App::FatPacker by mst now! $ cpanm HTTP::Tiny Successfully installed HTTP-Tiny-0.056
is a dependency. # So install it to ./local first $ cpanm -nq -L ./local HTTP::Tiny Successfully installed HTTP-Tiny-0.056 # Then just run fatpack-simple $ fatpack-simple download.pl -> fatpack HTTP/Tiny.pm (with perl-strip) -> Successfully created download.fatpack.pl
trace dependencies, it’s sometimes annoying. • Let’s say your script depends on URI module. Then $ cpanm -nq -L ./local URI Successfully installed URI-1.71 $ fatpack-simple script.pl -> Successfully created script.fatpack.pl $ /path/to/5.8.5/perl script.fatpack.pl Can’t locate parent.pm in @INC ...