[Pdx-pm] Austin's $VERSION trick

David Wheeler david at kineticode.com
Fri Jul 15 14:22:43 PDT 2005


On Jul 14, 2005, at 4:30 PM, Michael G Schwern wrote:

> Hello::World::Version can do this inside itself.
>
>   package Hello::World::Version;
>
>   delete $INC{"Hello/World/Version.pm"};
>
>   return 0.01;
>
> so that now "$VERSION = require Hello::World::Version" works as  
> expected.

Will this force Perl to re-load Hello::World::Version from disk for  
every module that requires it?

If so, why not add a method to it?

   package Hello::World::Version;
   sub ver { return '0.01' }

Then:

   our $Hello::World::VERSION = require Hello::World::Version &&  
Hello::World::Version::ver;

And either way, this won't fix those implementations (such as  
search.cpan.org) that don't evaluate *any* perl code when searching  
for the version number...

Best,

David


More information about the Pdx-pm-list mailing list