1 package Module::Install::Admin::Include;
4 use Module::Install::Base;
6 use vars qw{$VERSION @ISA};
9 @ISA = qw{Module::Install::Base};
14 foreach my $rv ( $self->admin->glob_in_inc($_[0]) ) {
15 $self->admin->copy_package(@$rv);
21 my $deps = $self->admin->scan_dependencies($_[0]) or return;
22 foreach my $key ( sort keys %$deps ) {
35 $self->include($module);
39 sub auto_include_deps {
47 $self->include_deps($module);
55 Module::Install::Admin::Include
57 =head2 auto_include_dependent_dists
59 Grabs everything in this module's build_requires and attempts to
60 include everything (at the whole distribution level) recursively.
64 sub auto_include_dependent_dists {
72 $self->include_dependent_dists($module);
78 =head2 include_dependent_dists $package
80 Given a module package name, recursively include every package that
85 sub include_dependent_dists {
89 return if $self->{including_dep_dist}->{ $self->_pkg_to_dist($pkg) }++;
90 $self->include_one_dist($pkg);
91 foreach my $mod ( @{ $self->_dist_to_mods( $self->_pkg_to_dist($pkg) ) } ) {
92 my $deps = $self->admin->scan_dependencies($mod) or return;
93 foreach my $key ( sort grep { $_ } keys %$deps ) {
94 $self->include_dependent_dists($key);
101 =head2 include_one_dist $module
103 Given a module name, C<$module>, figures out which modules are in the
104 dist containing that module and copies all those files to ./inc. I bet
105 there's a way to harness smarter logic from L<PAR>.
109 sub include_one_dist {
111 my @mods = $self->_dist_to_mods( $self->_pkg_to_dist($_[0]) );
112 foreach my $pattern ( grep { $_ } @mods ) {
113 foreach my $rv ( $self->admin->glob_in_inc($pattern) ) {
114 $self->admin->copy_package(@$rv);
121 =for private _pkg_to_dist $modname
123 Given a module name, returns the file on CPAN containing
130 my $mod = CPAN::Shell->expand( Module => $_[1] ) or return;
136 =for private _dist_to_mods $distname
138 Takes the output of CPAN::Module->cpan_file and return all the modules
139 that CPAN.pm knows are in that dist. There's probably a beter way using CPANPLUS
144 CPAN::Shell->expand( Distribution => $_[1] )->containsmods;