given a directory where 1 or more perl modules are installed [...], is there a way to determine what version of perl [...] was used to install those modules?
For pure-perl modules, no, because the installation process essentially just copies the module from the source / unpacked archive directory. The installing perl does not leave any "fingerprints".
For XS-based modules, partially. The Perl part is copied as before, so again, no "fingerprints". The C library generated from XS is compiled code, and even when stripped, you should still be able to find some traces in the binary:
>strings /usr/lib64/perl5/vendor_perl/auto/DBI/DBI.so|sort -u|grep -i
+perl
Note: perl is running without the recommended perl -w option
PERL_DBI_XSBYPASS
PerlIO_open
PerlIO_printf
PerlIO_puts
PerlIO_vprintf
Perl_PerlIO_close
Perl_PerlIO_flush
... a lot of matches omitted here ...
Perl_sv_upgrade
Perl_taint_proper
Perl_warn_nocontext
Perl_warn_sv
Perl_xs_boot_epilog
Perl_xs_handshake
>
Well, no version here, but because the XS API changed over time, you should at least be able to elimitate some older versions. E.g. I guess PerlIO functions weren't available in 5.005.
Let's be a little bit smarter and search for a digit followed by a dot:
>strings /usr/lib64/perl5/vendor_perl/auto/DBI/DBI.so|sort -u|grep '[[
+:digit:]]\.'
1.636
GCC: (GNU) 5.3.0
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.3.4
GLIBC_2.4
bind_col: column %d is not a valid column (1..%d)
v5.22.0
>perl -v
This is perl 5, version 22, subversion 2 (v5.22.2) built for x86_64-li
+nux-thread-multi
Copyright 1987-2015, Larry Wall
Perl may be copied only under the terms of either the Artistic License
+ or the
GNU General Public License, which may be found in the Perl 5 source ki
+t.
Complete documentation for Perl, including FAQ lists, should be found
+on
this system using "man perl" or "perldoc perl". If you have access to
+ the
Internet, point your browser at http://www.perl.org/, the Perl Home Pa
+ge.
>perl -MDBI -E 'say $DBI::VERSION'
1.636
>
That looks about right.
Alexander
--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
|