3

I need to find the version of Mojo:::Util that's installed on one of my servers, so I can submit an issue on the Mojolicious Github repository. I followed the recommendations on How can I find the version of an installed Perl module? mainly:

perl -MMojo::Util\ 9999

The response I got when I ran that was:

Mojo::Util does not define $Mojo::Util::VERSION--version check failed.
BEGIN failed--compilation aborted.

I originally installed Mojo::DOM using CPANM and got Mojo::Util because Mojo::DOM depends on it.

How do I determine the version of an installed Perl module where $VERSION is not defined?

Keith Thompson
  • 254,901
  • 44
  • 429
  • 631
Dave Aiello
  • 490
  • 2
  • 16
  • When I run cpanm Mojo::Util, I get the following response: "Mojo::Util is up to date. (undef)". Is it safe to assume that my system has Mojolicious-8.12 installed because that's the most recent version shown in MetaCPAN, https://metacpan.org/pod/Mojo::DOM? – Dave Aiello Mar 11 '19 at 21:15

1 Answers1

6

They do not have a version. The version of all modules in the Mojolicious distribution is considered to be equal to the version of Mojolicious (it is a somewhat non-standard distribution). So you would check the version of Mojolicious, depend on a certain version of the Mojolicious module, and pass Mojolicious to cpanm to update the distribution.

perl -MMojolicious\ 9999

Note that Mojolicious also includes a version command:

mojo version

In general, if a module you are using or depending on does not have a version, check or depend instead on the version of the main module of the distribution, which is the module sharing the name of the distribution (with some legacy exceptions like libwww-perl). The distribution of a module can be found on its metacpan page or in the packages index.

Grinnz
  • 9,093
  • 11
  • 18
  • 1
    @DaveAiello In general, if $VERSION is not defined, that module has no version. Either the distribution relies on the version of the main module for updating (like Mojolicious), or the distribution is not correctly set up for CPAN. – Grinnz Mar 11 '19 at 21:25
  • I didn't explicitly install Mojolicious, which is why I didn't think to do what you suggested. This is also why I didn't completely understand the Mojolicious Github repository, – Dave Aiello Mar 11 '19 at 21:26
  • 1
    @DaveAiello If it helps, you can find the distribution a module is associated with on [its metacpan page](https://metacpan.org/pod/Mojo::DOM) (top left), or [the packages index directly](https://cpanmeta.grinnz.com/packages#=Mojo::DOM). – Grinnz Mar 11 '19 at 21:29
  • Thanks! I added a comment to my question where I asked if I should infer the Mojolicious version from MetaCPAN before I saw your answer. – Dave Aiello Mar 11 '19 at 21:32
  • 1
    @DaveAiello I would classify distributions into four groups: 1. all modules have their own versions, and they vary; 2. all modules have their own versions, and they match; 3. only the main module has a version; 4. no modules have versions properly declared. So the process would be to check the module you want to depend on for a version, and then the main module (module with name matching the distribution name). Also note that the distribution "version" doesn't technically have to be related to any of this, it just generally matches the main module version to avoid confusion. – Grinnz Mar 11 '19 at 21:40