I'm trying to do something with plenv, and I don't know if I'm approaching it the right way, so I would appreciate some advice.
I have some scripts that I've written. I tend to maintain them in their own git repositories. But I want to make them able to run just by typing the command name. So I give them a shebang of #!/usr/bin/env perl, I set up a ~/bin, added it to my $PATH, and made symlinks to the executable scripts. So far, so good; I can run the commands just by typing their names.
Now, for unimportant reasons, I want to try and use different perls to develop each script. So I try putting a .perl-version file in each repository. Now, when I try running the file in the repository, it runs great; it gets the perl version specified by the .perl-version file.
But here's my problem: when I try running the program using the bare command, it doesn't get the version I want. As far as I can tell, this is because plenv looks for the .perl-version in the directory where the symlink is located (i.e. bin), and not the directory where the actual target is located (the repository).
Am I approaching this the wrong way? What's the best approach to do something like this? I can't put .perl-version in the bin directory because it will be different for different files. Should I make multiple bin directories for different perl versions? Should I write wrapper shell scripts that append the right version for each command? I'd like to avoid having to add each repository to my $PATH...
I'm trying to do something with
plenv
, and I don't know if I'm approaching it the right way, so I would appreciate some advice.I have some scripts that I've written. I tend to maintain them in their own git repositories. But I want to make them able to run just by typing the command name. So I give them a shebang of
#!/usr/bin/env perl
, I set up a~/bin
, added it to my$PATH
, and made symlinks to the executable scripts. So far, so good; I can run the commands just by typing their names.Now, for unimportant reasons, I want to try and use different perls to develop each script. So I try putting a
.perl-version
file in each repository. Now, when I try running the file in the repository, it runs great; it gets the perl version specified by the.perl-version
file.But here's my problem: when I try running the program using the bare command, it doesn't get the version I want. As far as I can tell, this is because
plenv
looks for the.perl-version
in the directory where the symlink is located (i.e.bin
), and not the directory where the actual target is located (the repository).Am I approaching this the wrong way? What's the best approach to do something like this? I can't put
.perl-version
in thebin
directory because it will be different for different files. Should I make multiplebin
directories for different perl versions? Should I write wrapper shell scripts that append the right version for each command? I'd like to avoid having to add each repository to my$PATH
...An example, in case my description was confusing:
In this case, I would like if the last two commands printed out
v5.32.1
andv5.34.0
, respectively