File: Package.pm

package info (click to toggle)
librole-commons-perl 0.101-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 396 kB
  • ctags: 250
  • sloc: perl: 3,557; makefile: 16
file content (71 lines) | stat: -rw-r--r-- 1,612 bytes parent folder | download | duplicates (134)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#line 1
##
# name:      Module::Package
# abstract:  Postmodern Perl Module Packaging
# author:    Ingy döt Net <ingy@cpan.org>
# license:   perl
# copyright: 2011
# see:
# - Module::Package::Plugin
# - Module::Install::Package
# - Module::Package::Tutorial

package Module::Package;
use 5.005;
use strict;

BEGIN {
    $Module::Package::VERSION = '0.30';
    $inc::Module::Package::VERSION ||= $Module::Package::VERSION;
    @inc::Module::Package::ISA = __PACKAGE__;
}

sub import {
    my $class = shift;
    $INC{'inc/Module/Install.pm'} = __FILE__;
    unshift @INC, 'inc' unless $INC[0] eq 'inc';
    eval "use Module::Install 1.01 (); 1" or $class->error($@);

    package main;
    Module::Install->import();
    eval {
        module_package_internals_version_check($Module::Package::VERSION);
        module_package_internals_init(@_);
    };
    if ($@) {
        $Module::Package::ERROR = $@;
        die $@;
    }
}

# XXX Remove this when things are stable.
sub error {
    my ($class, $error) = @_;
    if (-e 'inc' and not -e 'inc/.author') {
        require Data::Dumper;
        $Data::Dumper::Sortkeys = 1;
        my $dump1 = Data::Dumper::Dumper(\%INC);
        my $dump2 = Data::Dumper::Dumper(\@INC);
        die <<"...";
This should not have happened. Hopefully this dump will explain the problem:

inc::Module::Package: $inc::Module::Package::VERSION
Module::Package: $Module::Package::VERSION
inc::Module::Install: $inc::Module::Install::VERSION
Module::Install: $Module::Install::VERSION

Error: $error

%INC:
$dump1
\@INC:
$dump2
...
    }
    else {
        die $error;
    }
}

1;