home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / perl / Version.pm < prev    next >
Encoding:
Perl POD Document  |  2003-12-17  |  1013 b   |  36 lines

  1. # $File: //depot/cpan/Module-Install/lib/Module/Install/Makefile/Version.pm $ $Author: autrijus $
  2. # $Revision: #14 $ $Change: 1648 $ $DateTime: 2003/07/16 01:09:42 $ vim: expandtab shiftwidth=4
  3.  
  4. package Module::Install::Makefile::Version;
  5. use Module::Install::Base; @ISA = qw(Module::Install::Base);
  6.  
  7. $VERSION = '0.01';
  8.  
  9. use strict;
  10.  
  11. sub determine_VERSION {
  12.     my $self = shift;
  13.     my @modules = glob('*.pm');
  14.  
  15.     require File::Find;
  16.     File::Find::find(sub { push @modules, $File::Find::name =~ /\.pm\z/i }, 'lib');
  17.  
  18.     if (@modules == 1) {
  19.         eval {
  20.             $self->version(ExtUtils::MM_Unix->parse_version($modules[0]));
  21.         };
  22.         print STDERR $@ if $@;
  23.     }
  24.     elsif (my $file = "lib/" . $self->name . ".pm") {
  25.         $file =~ s!-!/!g;
  26.         $self->version(ExtUtils::MM_Unix->parse_version($file)) if -f $file;
  27.     }
  28.  
  29.     $self->version or die << "END";
  30. Can't determine a VERSION for this distribution.
  31. Please call the 'version' or 'version_from' function in Makefile.PL.
  32. END
  33. }
  34.  
  35. 1;
  36.