Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ perl5.10.0 program.pl
- #!perl
- use 5.010;
- use strict;
- use warnings;
- use File::Basename;
- use File::Spec::Functions;
- my $perls_directory = catfile(
- $ARGV[0] // '/usr/local/perls',
- 'perl*'
- );
- die "$perls_directory does not exist!n"
- unless -d dirname $perls_directory;
- my $links_directory = $ARGV[1] // catfile( $ENV{HOME}, 'bin' ); #/
- die "$links_directory does not exist!n" unless -d $links_directory;
- foreach my $directory ( glob( $perls_directory ) )
- {
- say "Processing $directory...";
- unless( -e catfile( $directory, 'bin' ) )
- {
- say "tNo bin/ directory. Skipping!";
- next;
- }
- my @perls = glob( catfile( $directory, qw( bin perl5* ) ) );
- my( $perl_version ) = $perls[0] =~ m/(5.d+.d+)z/;
- say "tperl version is $perl_version";
- foreach my $bin ( glob( catfile( $directory, 'bin', '*' ) ) )
- {
- say "tFound $bin";
- my $basename = basename( $bin );
- my $link_basename = do {
- if( $basename =~ m/5.d+.d+z/) { $basename }
- else { "$basename$perl_version" }
- };
- my $link = catfile( $links_directory, $link_basename );
- next if -e $link;
- say "ttlinking $bin => $link";
- symlink $bin => $link or
- warn "ttCould not create symlink [$!]: $bin => $link!";
- }
- }
- $ module-starter --mi --module=Module::Name --author="Me" [email protected]
Add Comment
Please, Sign In to add comment