Created
May 2, 2014 02:14
-
-
Save mamemomonga/8927a6bd3d5d33e4ddbe to your computer and use it in GitHub Desktop.
phpのソースの最新バージョンを取得する
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
my $curl='curl'; | |
sub php_latest { | |
my $release=shift; | |
my $atom=`$curl http://www.php.net/releases/feed.php`; | |
while( $atom=~m#<link rel="enclosure" title="([^"]+)" href="([^"]+)">#mg ) { | |
my($title,$href)=($1,$2); | |
if($title=~/^PHP (\Q$release.\E(?:\d{1,2})) \Q(tar.gz)\E/) { return $1 } | |
} | |
return undef; | |
} | |
my $phpver=php_latest(5.5); | |
system($curl,'--location','--max-redirs',3,'-o',"php-$phpver.tar.bz2", | |
"http://jp1.php.net/get/php-$phpver.tar.bz2/from/this/mirror"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment