/usr/share/perl5/Module/Install/Bundle.pm is in libmodule-install-perl 1.14-1.
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 | package Module::Install::Bundle;
use strict;
use File::Spec;
use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
$VERSION = '1.14';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
sub auto_bundle {
my $self = shift;
return $self->_install_bundled_dists unless $self->is_admin;
# Flatten array of arrays into a single array
my @core = map @$_, map @$_, grep ref, $self->requires;
$self->bundle(@core);
}
sub bundle {
my $self = shift;
return $self->_install_bundled_dists unless $self->is_admin;
$self->admin->bundle(@_);
}
sub auto_bundle_deps {
my $self = shift;
return $self->_install_bundled_dists unless $self->is_admin;
# Flatten array of arrays into a single array
my @core = map @$_, map @$_, grep ref, $self->requires;
while (my ($name, $version) = splice(@core, 0, 2)) {
next unless $name;
$self->bundle_deps($name, $version);
}
}
sub bundle_deps {
my ($self, $pkg, $version) = @_;
return $self->_install_bundled_dists unless $self->is_admin;
my $deps = $self->admin->scan_dependencies($pkg);
if (scalar keys %$deps == 0) {
# Probably a user trying to install the package, read the dependencies from META.yml
%$deps = ( map { $$_[0] => undef } (@{$self->requires()}) );
}
foreach my $key (sort keys %$deps) {
$self->bundle($key, ($key eq $pkg) ? $version : 0);
}
}
sub _install_bundled_dists {
my $self = shift;
# process bundle only the first time this function is called
return if $self->{bundle_processed};
$self->makemaker_args->{DIR} ||= [];
# process all dists bundled in inc/BUNDLES/
my $bundle_dir = $self->_top->{bundle};
foreach my $sub_dir (glob File::Spec->catfile($bundle_dir,"*")) {
next if -f $sub_dir;
# ignore dot dirs/files if any
my $dot_file = File::Spec->catfile($bundle_dir,'\.');
next if index($sub_dir, $dot_file) >= $[;
# EU::MM can't handle Build.PL based distributions
if (-f File::Spec->catfile($sub_dir, 'Build.PL')) {
warn "Skipped: $sub_dir has Build.PL.";
next;
}
# EU::MM can't handle distributions without Makefile.PL
# (actually this is to cut blib in a wrong directory)
if (!-f File::Spec->catfile($sub_dir, 'Makefile.PL')) {
warn "Skipped: $sub_dir has no Makefile.PL.";
next;
}
push @{ $self->makemaker_args->{DIR} }, $sub_dir;
}
$self->{bundle_processed} = 1;
}
1;
__END__
=pod
=head1 NAME
Module::Install::Bundle - Bundle distributions along with your distribution
=head1 SYNOPSIS
Have your Makefile.PL read as follows:
use inc::Module::Install;
name 'Foo-Bar';
all_from 'lib/Foo/Bar.pm';
requires 'Baz' => '1.60';
# one of either:
bundle 'Baz' => '1.60';
# OR:
auto_bundle;
WriteAll;
=head1 DESCRIPTION
Module::Install::Bundle allows you to bundle a CPAN distribution within your
distribution. When your end-users install your distribution, the bundled
distribution will be installed along with yours, unless a newer version of
the bundled distribution already exists on their local filesystem.
While bundling will increase the size of your distribution, it has several
benefits:
Allows installation of bundled distributions when CPAN is unavailable
Allows installation of bundled distributions when networking is unavailable
Allows everything your distribution needs to be packaged in one place
Bundling differs from auto-installation in that when it comes time to
install, a bundled distribution will be installed based on the distribution
bundled with your distribution, whereas with auto-installation the distribution
to be installed will be acquired from CPAN and then installed.
=head1 METHODS
=over 4
=item * auto_bundle()
Takes no arguments, will bundle every distribution specified by a C<requires()>.
When you, as a module author, do a C<perl Makefile.PL> the latest versions of
the distributions to be bundled will be acquired from CPAN and placed in
F<inc/BUNDLES/>.
=item * bundle($name, $version)
Takes a list of key/value pairs specifying a distribution name and version
number. When you, as a module author, do a perl Makefile.PL the distributions
that you specified with C<bundle()> will be acquired from CPAN and placed in
F<inc/BUNDLES/>.
=item * bundle_deps($name, $version)
Same as C<bundle>, except that all dependencies of the bundled modules are
also detected and bundled. To use this function, you need to declare the
minimum supported perl version first, like this:
perl_version( '5.005' );
=item * auto_bundle_deps
Same as C<auto_bundle>, except that all dependencies of the bundled
modules are also detected and bundled. This function has the same constraints as bundle_deps.
=back
=head1 BUGS
Please report any bugs to (patches welcome):
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Module-Install
=head1 AUTHORS
Audrey Tang E<lt>autrijus@autrijus.orgE<gt>
Documentation by Adam Foxson E<lt>afoxson@pobox.comE<gt>
=head1 COPYRIGHT
Copyright 2003, 2004, 2005 by Audrey Tang E<lt>autrijus@autrijus.orgE<gt>.
This program is free software; you can redistribute it and/or modify it under
the same terms as Perl itself.
=cut
|