The Perl Advent Calendar needs more articles for 2022. Submit your idea today!


V - Print version of the specified module(s).


    $ perl -MV=V

or if you want more than one

    $ perl -MV=CPAN,V

Can now also be used as a light-weight module for getting versions of modules without loading them:

    require V;
    printf "%s has version '%s'\n", "V", V::get_version( "V" );

If you want all available files/versions from @INC:

    require V;
    my @all_V = V::Module::Info->all_installed("V");
    printf "%s:\n", $all_V[0]->name;
    printf "\t%-50s - %s\n", $_->file, $_->version
        for @all_V;

Each element in that array isa V::Module::Info object with 3 attributes and a method:

attribute name

The package name.

attribute file

Full filename with directory.

attribute dir

The base directory (from @INC) where the package-file was found.

method version

This method will look through the file to see if it can find a version assignment in the file and uses that determine the version. As of version 0.13_01, all versions found are passed through the version module.


This module uses stolen code from Module::Info to find the location and version of the specified module(s). It prints them and exit()s.

It defines import() and is based on an idea from Michael Schwern on the perl5-porters list. See the discussion:


Returns the version of the first available file for this package as found by following @INC.


1. $pkg

The name of the package for which one wants to know the version.


This V::get_version() returns the version of the file that was first found for this package by following @INC or undef if no file was found.


Abe Timmerman <>.


Copyright 2002-2006 Abe Timmerman, All Rights Reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.