… | |
… | |
95 | If disabled, only shared objects and autoload files will be added. |
95 | If disabled, only shared objects and autoload files will be added. |
96 | |
96 | |
97 | Debian GNU/Linux doesn't completely package perl or any perl modules, so |
97 | Debian GNU/Linux doesn't completely package perl or any perl modules, so |
98 | this option will fail. Other perls should be fine. |
98 | this option will fail. Other perls should be fine. |
99 | |
99 | |
|
|
100 | =item extra_deps => { file => [files...] } |
|
|
101 | |
|
|
102 | Some (mainly runtime dependencies in the perl core library) cannot be |
|
|
103 | detected automatically by this module, especially if you don't use |
|
|
104 | packlists and C<add_core>. |
|
|
105 | |
|
|
106 | This module comes with a set of default dependencies (such as L<Carp> |
|
|
107 | requiring L<Carp::Heavy>), which you cna override with this parameter. |
|
|
108 | |
|
|
109 | To see the default set of dependencies that come with this module, use |
|
|
110 | this: |
|
|
111 | |
|
|
112 | perl -MPerl::LibExtractor -MData::Dumper -e 'print Dumper $Perl::LibExtractor::EXTRA_DEPS' |
|
|
113 | |
100 | =back |
114 | =back |
101 | |
115 | |
102 | =cut |
116 | =cut |
|
|
117 | |
|
|
118 | our $EXTRA_DEPS = { |
|
|
119 | 'Config.pm' => ['Config_heavy.pl', 'Config_git.pl'], |
|
|
120 | 'Carp.pm' => ['Carp/Heavy.pm'], |
|
|
121 | 'utf8.pm' => ['utf8_heavy.pl'], |
|
|
122 | 'bytes.pm' => ['bytes_heavy.pl'], |
|
|
123 | # Exporter::Heay is usually detected |
|
|
124 | }; |
103 | |
125 | |
104 | sub new { |
126 | sub new { |
105 | my ($class, %kv) = @_; |
127 | my ($class, %kv) = @_; |
106 | |
128 | |
107 | my $self = bless { |
129 | my $self = bless { |
108 | inc => [grep $_ ne ".", @INC], |
130 | inc => [grep $_ ne ".", @INC], |
109 | use_packlist => 1, |
131 | use_packlist => 1, |
|
|
132 | extra_deps => $EXTRA_DEPS, |
110 | %kv, |
133 | %kv, |
111 | set => {}, |
134 | set => {}, |
112 | }, $class; |
135 | }, $class; |
113 | |
136 | |
114 | my %inc_seen; |
137 | my %inc_seen; |
115 | my @inc = grep !$inc_seen{$_}++ && -d "$_/.", @{ $self->{inc} }; |
138 | my @inc = grep !$inc_seen{$_}++ && -d "$_/.", @{ $self->{inc} }; |
116 | $self->{inc} = \@inc; |
139 | $self->{inc} = \@inc; |
… | |
… | |
361 | |
384 | |
362 | skip: |
385 | skip: |
363 | } |
386 | } |
364 | } |
387 | } |
365 | |
388 | |
|
|
389 | if (exists $self->{extra_deps}{$_}) { |
|
|
390 | # we require it again, because many extra dependencies require the main module to be loaded |
|
|
391 | $self->add_eval ("require q\x00$_\x00"); |
|
|
392 | |
|
|
393 | exists $lib->{$_} and $self->add_require ($_) |
|
|
394 | for @{ $self->{extra_deps}{$_} }; |
|
|
395 | } |
|
|
396 | |
366 | \@info |
397 | \@info |
367 | }; |
398 | }; |
368 | } |
399 | } |
369 | } |
400 | } |
370 | |
401 | |
… | |
… | |
447 | $self->_trace ("use $_", "{ package $pkg; use $_ }") |
478 | $self->_trace ("use $_", "{ package $pkg; use $_ }") |
448 | unless $self->{add_mod}{$_}++; |
479 | unless $self->{add_mod}{$_}++; |
449 | } |
480 | } |
450 | } |
481 | } |
451 | |
482 | |
|
|
483 | =item $extractor->add_require ($name[, $name...]) |
|
|
484 | |
|
|
485 | Works like C<add_mod>, but uses C<require $name> to load the module, i.e. |
|
|
486 | the name must be a filename. |
|
|
487 | |
|
|
488 | Example: load Coro and AnyEvent::AIO, but using C<add_require> instead of C<add_mod>. |
|
|
489 | |
|
|
490 | $extractor->add_require ("Coro.pm", "AnyEvent/AIO.pm"); |
|
|
491 | |
|
|
492 | =cut |
|
|
493 | |
|
|
494 | sub add_require { |
|
|
495 | my $self = shift; |
|
|
496 | |
|
|
497 | for (@_) { |
|
|
498 | $self->add_eval ("require q\x00$_\x00") |
|
|
499 | unless $self->{add_require}{$_}++; |
|
|
500 | } |
|
|
501 | } |
|
|
502 | |
452 | =item $extractor->add_bin ($name[, $name...]) |
503 | =item $extractor->add_bin ($name[, $name...]) |
453 | |
504 | |
454 | Adds the given (perl) program(s) to the file set, that is, a program |
505 | Adds the given (perl) program(s) to the file set, that is, a program |
455 | installed by some perl module, written in perl (an example would be the |
506 | installed by some perl module, written in perl (an example would be the |
456 | L<perl-libextract> program that is part of the C<Perl::LibExtractor> |
507 | L<perl-libextract> program that is part of the C<Perl::LibExtractor> |