Re: Finding all version numbers in a distro's *.pm files

Ron Savage <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.module-build
Message-ID <[email protected]>
Hi David

On Mon, 2009-08-31 at 23:57 -0400, David Golden wrote:
> On Mon, Aug 31, 2009 at 10:00 PM, Ron Savage<[email protected]> wrote:
> > I want to ensure all files in the dir return the same version number, if
> > I print them using version.pm.
> 
> Assuming your *.pm files are in Module::Build distros...
> 
> perl -MModule::Build -E '$mb=Module::Build->new_from_context; $pkgs =
> $mb->find_dist_packages; say "$_ => $pkgs->{$_}{version}" for keys
> %$pkgs'


Excellent. That's very neat.


> Obviously, you can analyze $pkgs directly rather than just printing
> it.  This is what generates the 'provides' data in META.yml, which is
> what PAUSE uses for indexing, if it exists.  It has the nice property
> of ignoring 'no_index'.
> 
> So, while not perfect in the context of version number complexity,
> it's a pragmatic approach to deal with your question.
> 
> -- David
> 
-- 
Ron Savage
[email protected]
http://savage.net.au/index.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.