Skip to content

Instantly share code, notes, and snippets.

@kits
Created November 10, 2010 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kits/670853 to your computer and use it in GitHub Desktop.
Save kits/670853 to your computer and use it in GitHub Desktop.
myperlbrew.patch (use a favorite mirror site, instead of search.cpan.org)
*** ./perlbrew 2010-11-05 08:56:08.156250000 +0900
--- perl5/perlbrew/bin/perlbrew 2010-11-10 22:33:48.046875000 +0900
***************
*** 1116,1125 ****
unless ($dist_git_describe) {
my $mirror = $self->conf->{mirror};
my $header = $mirror ? { 'Cookie' => "cpan=$mirror->{url}" } : undef;
! my $html = $self->_http_get("http://search.cpan.org/dist/$dist", undef, $header);
! ($dist_path, $dist_tarball) =
! $html =~ m[<a href="(/CPAN/authors/id/.+/(${dist}.tar.(gz|bz2)))">Download</a>];
my $dist_tarball_path = "${ROOT}/dists/${dist_tarball}";
if (-f $dist_tarball_path) {
--- 1116,1128 ----
unless ($dist_git_describe) {
my $mirror = $self->conf->{mirror};
my $header = $mirror ? { 'Cookie' => "cpan=$mirror->{url}" } : undef;
! my $my_mirror = $ENV{PERLBREW_MIRROR} || 'http://www.cpan.org';
! my $html = $self->_http_get("$my_mirror/src/5.0/", undef, $header);
! ($dist_path) =
! $html =~ m{<a href="(${dist}.tar.(?:gz|bz2))">\1</a>};
! $dist_path or die "$dist does not exist.";
! $dist_tarball = $dist_path;
my $dist_tarball_path = "${ROOT}/dists/${dist_tarball}";
if (-f $dist_tarball_path) {
***************
*** 1129,1135 ****
print "Fetching $dist as $dist_tarball_path\n";
$self->_http_get(
! "http://search.cpan.org${dist_path}",
sub {
my ($body) = @_;
open my $BALL, "> $dist_tarball_path";
--- 1132,1138 ----
print "Fetching $dist as $dist_tarball_path\n";
$self->_http_get(
! "$my_mirror/src/5.0/${dist_path}",
sub {
my ($body) = @_;
open my $BALL, "> $dist_tarball_path";
***************
*** 1203,1209 ****
$self->run_command_symlink_executables($as);
}
! $self->run_command_install_cpanm($as);
print <<SUCCESS;
Installed $dist as $as successfully. Run the following command to switch to it.
--- 1206,1212 ----
$self->run_command_symlink_executables($as);
}
! #$self->run_command_install_cpanm($as);
print <<SUCCESS;
Installed $dist as $as successfully. Run the following command to switch to it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment