I'm using this from the command line:
perl -MDateTime::Format::DateManip -le 'print $Some::Module::VERSION'
but only return a blank line, any thoughts?
I'm using this from the command line:
perl -MDateTime::Format::DateManip -le 'print $Some::Module::VERSION'
but only return a blank line, any thoughts?
It is pseudo-code, Some
isn't set so it is just printing out undef
with the -l
flag, like perl -le'print undef
;
For evidence turn on warnings with -w
$ perl -MDateTime::Format::DateManip -wle 'print $Some::Module::VERSION'
Use of uninitialized value $Some::Module::VERSION in print at -e line 1.
Substitute Some::Module
with the module you want the version of.
Also, just for fun ;)
These are quick ways to get version numbers by utilizing the use <module> <version>
syntax and perl's vocal rejection of versions that aren't new enough.
These are all equivalent of creating a perl script with use DateTime 9999;
$ perl -MDateTime\ 9999
DateTime version 9999 required--this is only version 0.51.
BEGIN failed--compilation aborted.
However, this fashion isn't cross-platform, because you're simply telling bash to escape a space. This doesn't work in windows cmd
, for that you'll have to
$ perl -M"DateTime 9999"
DateTime version 9999 required--this is only version 0.51.
BEGIN failed--compilation aborted.
Here, you just put it in quotes - that tells cmd to send it all as an argument to perl and it gets the same job done.