Skip to content

Commit

Permalink
Merge pull request #381 from kentfredric/develop
Browse files Browse the repository at this point in the history
Add support for a ".version" file in each perls root directory.
  • Loading branch information
gugod committed Jun 6, 2014
2 parents 0df81db + 545da9e commit d99285f
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/App/perlbrew.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1481,7 +1481,20 @@ sub installed_perls {
for (<$root/perls/*>) {
my ($name) = $_ =~ m/\/([^\/]+$)/;
my $executable = joinpath($_, 'bin', 'perl');
my $orig_version = `$executable -e 'print \$]'`;
my $version_file = joinpath($_,'.version');
my $orig_version;
if ( -e $version_file ){
open my $fh, '<', $version_file;
local $/;
$orig_version = <$fh>;
chomp $orig_version;
} else {
$orig_version = `$executable -e 'print \$]'`;
if ( defined $orig_version and length $orig_version ){
open my $fh, '>', $version_file;
print {$fh} $orig_version;
}
}

push @result, {
name => $name,
Expand Down

0 comments on commit d99285f

Please sign in to comment.