#!/usr/bin/perl

=head1 NAME

whichpm - locate a Perl module and it's version

=head1 SYNOPSIS

	whichpm Some::Module::Name

=head1 DESCRIPTION

Loads the module, prints its file system location and version.

=cut


use strict;
use warnings;

use App::whichpm 'which_pm';

exit main();

sub main {
	my $help;

	print STDERR "usage: $0 Some::Module::Name\n"
		if not @ARGV;

	# lookup for all modules passed on command line
	while (my $mn = shift @ARGV) {
		my ($filename, $version) = which_pm($mn);
		print $filename, ($version ? ' '.$version : ()), "\n"
			if $filename;
	}

	return 0;
}
