Last active
December 19, 2015 02:19
-
-
Save fujiwara/5882670 to your computer and use it in GitHub Desktop.
ExtUtils::Installedで現在インストールされているモジュールからcpanfileを作る
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
$ perl installed2cpanfile > cpanfile | |
$ cpanm --installdeps . |
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; | |
use ExtUtils::Installed; | |
my $i = ExtUtils::Installed->new; | |
for my $module (keys %$i) { | |
next if $module eq ":private:" || $module =~ /-/ || $module eq "Perl"; | |
my $version = $i->{$module}->{version}; | |
next if $version !~ /^[\d.]*$/; | |
print "requires '$module', '$version';\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
4.069
になる(頭にスペースが入ってる…)ので、1.04_12
とかになるので、$version !~ /^\s*[\d._]*$/
のがいいかもv0.5.3
なので$version =~ s/^v//;
した方がいいかもif (! $version)
だったら$module =~ s/-/::/g; eval "require $module"; $version = $module->VERSION
しなとかもすねぇ