File: Version.pm

package info (click to toggle)
libtest-mock-lwp-perl 0.05-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny, squeeze, wheezy
  • size: 156 kB
  • ctags: 119
  • sloc: perl: 1,615; makefile: 41
file content (42 lines) | stat: -rw-r--r-- 910 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#line 1
package Module::Install::Makefile::Version;

use Module::Install::Base;
@ISA = qw(Module::Install::Base);

$VERSION = '0.64';

use strict;

sub determine_VERSION {
    my $self = shift;
    my @modules = glob('*.pm');

    require File::Find;
    File::Find::find( sub {
        push @modules, $File::Find::name =~ /\.pm\z/i;
    }, 'lib' );

    if (@modules == 1) {
        eval {
            $self->version(
                ExtUtils::MM_Unix->parse_version($modules[0])
            );
        };
        print STDERR $@ if $@;

    } elsif ( my $file = "lib/" . $self->name . ".pm" ) {
        $file =~ s!-!/!g;
        $self->version(
            ExtUtils::MM_Unix->parse_version($file)
        ) if -f $file;

    }

    $self->version or die << "END_MESSAGE";
Can't determine a VERSION for this distribution.
Please call the 'version' or 'version_from' function in Makefile.PL.
END_MESSAGE
}

1;