Module Version Vim Binding

Ovid on 2009-05-20T08:51:42

Like most Perl programmers I know, I have a tiny command line utility which prints out a module version:

#!/usr/bin/env perl
my $module = shift;
    
package OVID::PVERSION; # for modules which won't let you use 'em in %main::
eval "use $module";
die $@ if $@;
print $module->VERSION || "Could not determine a version for $module", $/;
    
__END__

=head1 NAME

pversion

=head1 SYNOPSIS

 pversion Some::Module

=head1 DESCRIPTION

Prints out the Perl version number of an installed module.

=cut

Today, while trying to figure out a versioning issue in vim, I added the ,pv mapping. If you're on a module name and type that, it automatically displays the version number.

noremap  ,pv  :!echo  version `$HOME/bin/pversion ''`


Alternative tool

Ed Avis on 2009-05-20T09:40:36

You are probably right that most Perl programmers have written such a tool. Mine is distributed as pmq.

See also pmtools

broquaint on 2009-05-21T14:51:01

There's also pmvers from pmtools which WFM (along with a few other handy tools).