When I put use v5.8; at the top of my script, this means the script will not run unless it's being interpreted by Perl 5.8 or better. My question is, is there a way to force Perl to run in "compatibility mode" for a specific version? So that if I use a (fictitious) line like use only::v5.8;, my script will not run if it uses language features that weren't present in Perl 5.8.
My use case is that I would like to be able to develop scripts for my work machine (which has an older Perl release) using my personal laptop which has a more recent one.
There are Perl::MinimumVersion and Perl::MinimumVersion::Fast on CPAN.
For the former there is also a command line tool.
With those modules you can check if your program needs a more recent perl version. Sadly the formatting is a little of.
perlver yourfile.pl
-----------------------------------------
| file | explicit | syntax | external |
| ----------------------------------------- |
| logfile.pl | v5.10.0 | v5.6.0 | n/a |
| ----------------------------------------- |
| Minimum explicit version : v5.10.0 |
| Minimum syntax version : v5.6.0 |
| Minimum version of perl : v5.10.0 |
-----------------------------------------
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With