in reply to Re: Re: Figuring out which version of a loaded module
in thread Figuring out which version of a loaded module

if you supply a number to UNIVERSAL::VERSION like you do, it simply does a numeric compare.

So your exact script could be reduced to:

$self->{PDF_VERSION} = int pdflib_pl->VERSION or die "Cannot find pdflib_pl version\n"; $self->{PDF_VERSION} = 4 if $self->{PDF_VERSION} > 4;

•Update: OK, correction, if $pdflib_pl::VERSION is a v-string it messes up, but I have never seen a module that uses that (none of the core modules are, nor are the tons of other modules installed on my computer).

In fact, perldoc perlmodlib and perlmodstyle actually says explicitly $VERSION should be a floating-point number.