This file is indexed.

/usr/share/perl5/Module/Install/Package.pm is in libmodule-package-perl 0.30-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
##
# name:      Module::Install::Package
# abstract:  Module::Install support for Module::Package
# author:    Ingy döt Net <ingy@cpan.org>
# license:   perl
# copyright: 2011
# see:
# - Module::Package

# This module contains the Module::Package logic that must be available to
# both the Author and the End User. Author-only logic goes in a
# Module::Package::Plugin subclass.
package Module::Install::Package;
use strict;
use Module::Install::Base;
use vars qw'@ISA $VERSION';
@ISA = 'Module::Install::Base';
$VERSION = '0.30';

#-----------------------------------------------------------------------------#
# XXX BOOTBUGHACK
# This is here to try to get us out of Module-Package-0.11 cpantesters hell...
# Remove this when the situation has blown over.
sub pkg {
    *inc::Module::Package::VERSION = sub { $VERSION };
    my $self = shift;
    $self->module_package_internals_init($@);
}

#-----------------------------------------------------------------------------#
# We allow the author to specify key/value options after the plugin. These
# options need to be available both at author time and install time.
#-----------------------------------------------------------------------------#
# OO accessor for command line options:
sub package_options {
    @_>1?($_[0]->{package_options}=$_[1]):$_[0]->{package_options}}

my $default_options = {
    deps_list => 1,
    install_bin => 1,
    install_share => 1,
    manifest_skip => 1,
    requires_from => 1,
};

#-----------------------------------------------------------------------------#
# Module::Install plugin directives. Use long, ugly names to not pollute the
# Module::Install plugin namespace. These are only intended to be called from
# Module::Package.
#-----------------------------------------------------------------------------#

# Module::Package starts off life as a normal call to this Module::Install
# plugin directive:
my $module_install_plugin;
my $module_package_plugin;
my $module_package_dist_plugin;
# XXX ARGVHACK This @argv thing is a temporary fix for an ugly bug somewhere in the
# Wikitext module usage.
my @argv;
sub module_package_internals_init {
    my $self = $module_install_plugin = shift;
    my ($plugin_spec, %options) = @_;
    $self->package_options({%$default_options, %options});

    if ($module_install_plugin->is_admin) {
        $module_package_plugin = $self->_load_plugin($plugin_spec);
        $module_package_plugin->mi($module_install_plugin);
        $module_package_plugin->version_check($VERSION);
    }
    else {
        $module_package_dist_plugin = $self->_load_dist_plugin($plugin_spec);
        $module_package_dist_plugin->mi($module_install_plugin) if ref $module_package_dist_plugin;
    }
    # NOTE - This is the point in time where the body of Makefile.PL runs...
    return;

    sub INIT {
        return unless $module_install_plugin;
        return if $Module::Package::ERROR;
        eval {
            if ($module_install_plugin->is_admin) {
                $module_package_plugin->initial();
                $module_package_plugin->main();
            }
            else {
                $module_install_plugin->_initial();
                $module_package_dist_plugin->_initial() if ref $module_package_dist_plugin;
                $module_install_plugin->_main();
                $module_package_dist_plugin->_main() if ref $module_package_dist_plugin;
            }
        };
        if ($@) {
            $Module::Package::ERROR = $@;
            die $@;
        }
        @argv = @ARGV; # XXX ARGVHACK
    }

    # If this Module::Install plugin was used (by Module::Package) then wrap
    # up any loose ends. This will get called after Makefile.PL has completed.
    sub END {
        @ARGV = @argv; # XXX ARGVHACK
        return unless $module_install_plugin;
        return if $Module::Package::ERROR;
        $module_package_plugin
            ? do {
                $module_package_plugin->final;
                $module_package_plugin->replicate_module_package;
            }
            : do {
                $module_install_plugin->_final;
                $module_package_dist_plugin->_final() if ref $module_package_dist_plugin;
            }
    }
}

# Module::Package, Module::Install::Package and Module::Package::Plugin
# must all have the same version. Seems wise.
sub module_package_internals_version_check {
    my ($self, $version) = @_;
    return if $version < 0.1800001;   # XXX BOOTBUGHACK!!
    die <<"..." unless $version == $VERSION;

Error! Something has gone awry:
    Module::Package version=$version is using 
    Module::Install::Package version=$VERSION
If you are the author of this module, try upgrading Module::Package.
Otherwise, please notify the author of this error.

...
}

# Find and load the author side plugin:
sub _load_plugin {
    my ($self, $spec, $namespace) = @_;
    $spec ||= '';
    $namespace ||= 'Module::Package';
    my $version = '';
    $Module::Package::plugin_version = 0;
    if ($spec =~ s/\s+(\S+)\s*//) {
        $version = $1;
        $Module::Package::plugin_version = $version;
    }
    my ($module, $plugin) =
        not($spec) ? ('Plugin', "Plugin::basic") :
        ($spec =~ /^\w(\w|::)*$/) ? ($spec, $spec) :
        ($spec =~ /^:(\w+)$/) ? ('Plugin', "Plugin::$1") :
        ($spec =~ /^(\S*\w):(\w+)$/) ? ($1, "$1::$2") :
        die "$spec is invalid";
    $module = "${namespace}::${module}";
    $plugin = "${namespace}::${plugin}";
    eval "use $module $version (); 1" or die $@;
    return $plugin->new();
}

# Find and load the user side plugin:
sub _load_dist_plugin {
    my ($self, $spec, $namespace) = @_;
    $spec ||= '';
    $namespace ||= 'Module::Package::Dist';
    my $r = eval { $self->_load_plugin($spec, $namespace); };
    return $r if ref $r;
    return;
}

#-----------------------------------------------------------------------------#
# These are the user side analogs to the author side plugin API calls.
# Prefix with '_' to not pollute Module::Install plugin space.
#-----------------------------------------------------------------------------#
sub _initial {
    my ($self) = @_;
}

sub _main {
    my ($self) = @_;
}

# NOTE These must match Module::Package::Plugin::final.
sub _final {
    my ($self) = @_;
    $self->_all_from;
    $self->_requires_from;
    $self->_install_bin;
    $self->_install_share;
    $self->_WriteAll;
}

#-----------------------------------------------------------------------------#
# This section is where all the useful code bits go. These bits are needed by
# both Author and User side runs.
#-----------------------------------------------------------------------------#

my $all_from = 0;
sub _all_from {
    my $self = shift;
    return if $all_from++;
    return if $self->name;
    my $file = shift || "$main::PM" or die "all_from has no file";
    $self->all_from($file);
}

my $requires_from = 0;
sub _requires_from {
    my $self = shift;
    return if $requires_from++;
    return unless $self->package_options->{requires_from};
    my $file = shift || "$main::PM" or die "requires_from has no file";
    $self->requires_from($main::PM)
}

my $install_bin = 0;
sub _install_bin {
    my $self = shift;
    return if $install_bin++;
    return unless $self->package_options->{install_bin};
    return unless -d 'bin';
    my @bin;
    File::Find::find(sub {
        return unless -f $_;
        push @bin, $File::Find::name;
    }, 'bin');
    $self->install_script($_) for @bin;
}

my $install_share = 0;
sub _install_share {
    my $self = shift;
    return if $install_share++;
    return unless $self->package_options->{install_share};
    return unless -d 'share';
    $self->install_share;
}

my $WriteAll = 0;
sub _WriteAll {
    my $self = shift;
    return if $WriteAll++;
    $self->WriteAll(@_);
}

# Base package for Module::Package plugin distributed components.
package Module::Package::Dist;

sub new {
    my ($class, %args) = @_;
    bless \%args, $class;
}

sub mi {
    @_ > 1 ? ($_[0]->{mi}=$_[1]) : $_[0]->{mi};
}

sub _initial {
    my ($self) = @_;
}

sub _main {
    my ($self) = @_;
}

sub _final {
    my ($self) = @_;
}

1;

#-----------------------------------------------------------------------------#
# Take a guess at the primary .pm and .pod files for 'all_from', and friends.
# Put them in global magical vars in the main:: namespace.
#-----------------------------------------------------------------------------#
package Module::Package::PM;
use overload '""' => sub {
    $_[0]->guess_pm unless @{$_[0]};
    return $_[0]->[0];
};
sub set { $_[0]->[0] = $_[1] }
sub guess_pm {
    my $pm = '';
    my $self = shift;
    if (-e 'META.yml') {
        open META, 'META.yml' or die "Can't open 'META.yml' for input:\n$!";
        my $meta = do { local $/; <META> };
        close META;
        $meta =~ /^module_name: (\S+)$/m
            or die "Can't get module_name from META.yml";
        $pm = $1;
        $pm =~ s!::!/!g;
        $pm = "lib/$pm.pm";
    }
    else {
        require File::Find;
        my @array = ();
        File::Find::find(sub {
            return unless /\.pm$/;
            my $name = $File::Find::name;
            my $num = ($name =~ s!/+!/!g);
            my $ary = $array[$num] ||= [];
            push @$ary, $name;
        }, 'lib');
        shift @array while @array and not defined $array[0];
        die "Can't guess main module" unless @array;
        (($pm) = sort @{$array[0]}) or
            die "Can't guess main module";
    }
    my $pmc = $pm . 'c';
    $pm = $pmc if -e $pmc;
    $self->set($pm);
}
$main::PM = bless [$main::PM ? ($main::PM) : ()], __PACKAGE__;

package Module::Package::POD;
use overload '""' => sub {
    return $_[0]->[0] if @{$_[0]};
    (my $pod = "$main::PM") =~ s/\.pm/.pod/
        or die "Module::Package's \$main::PM value should end in '.pm'";
    return -e $pod ? $pod : '';
};
sub set { $_[0][0] = $_[1] }
$main::POD = bless [$main::POD ? ($main::POD) : ()], __PACKAGE__;

1;

=head1 SYNOPSIS

    use inc::Module::Package <options>;

=head1 DESCRIPTION

This Module::Install plugin provides user-side support for L<Module::Package>.