… | |
… | |
34 | package Perl::LibExtractor; |
34 | package Perl::LibExtractor; |
35 | |
35 | |
36 | our $VERSION = '1.1'; |
36 | our $VERSION = '1.1'; |
37 | |
37 | |
38 | use Config; |
38 | use Config; |
|
|
39 | use Cwd (); |
39 | use File::Spec (); |
40 | use File::Spec (); |
40 | use File::Temp (); |
41 | use File::Temp (); |
41 | |
42 | |
42 | use common::sense; |
43 | use common::sense; |
43 | |
44 | |
… | |
… | |
75 | |
76 | |
76 | The following key-value pairs exist, with default values as specified. |
77 | The following key-value pairs exist, with default values as specified. |
77 | |
78 | |
78 | =over 4 |
79 | =over 4 |
79 | |
80 | |
80 | =item inc => \@INC without "." |
81 | =item inc => \@INC without any initial "." |
81 | |
82 | |
82 | An arrayref with paths to perl library directories. The default is |
83 | An arrayref with paths to perl library directories. The default is |
83 | C<\@INC>, with F<.> removed. |
84 | C<\@INC>, with the first entry removed if it is F<.>. Internally, all |
|
|
85 | paths will be changed to absolute paths. |
84 | |
86 | |
85 | To prepend custom dirs just do this: |
87 | To prepend custom dirs just do this: |
86 | |
88 | |
87 | inc => ["mydir", @INC], |
89 | inc => ["mydir", @INC], |
88 | |
90 | |
… | |
… | |
125 | |
127 | |
126 | sub new { |
128 | sub new { |
127 | my ($class, %kv) = @_; |
129 | my ($class, %kv) = @_; |
128 | |
130 | |
129 | my $self = bless { |
131 | my $self = bless { |
130 | inc => [grep $_ ne ".", @INC], |
|
|
131 | use_packlist => 1, |
132 | use_packlist => 1, |
132 | extra_deps => $EXTRA_DEPS, |
133 | extra_deps => $EXTRA_DEPS, |
133 | %kv, |
134 | %kv, |
134 | set => {}, |
135 | set => {}, |
135 | }, $class; |
136 | }, $class; |
136 | |
137 | |
|
|
138 | unless (exists $self->{inc}) { |
|
|
139 | my @inc = @INC; |
|
|
140 | shift @inc if $inc[0] eq "."; |
|
|
141 | $self->{inc} = \@INC; |
|
|
142 | } |
|
|
143 | |
137 | my %inc_seen; |
144 | my %inc_seen; |
138 | my @inc = grep !$inc_seen{$_}++ && -d "$_/.", @{ $self->{inc} }; |
145 | my @inc = grep !$inc_seen{$_}++ && -d "$_/.", map Cwd::abs_path ($_), @{ $self->{inc} }; |
139 | $self->{inc} = \@inc; |
146 | $self->{inc} = \@inc; |
140 | |
147 | |
141 | # maybe not inc, but these? |
148 | # maybe not inc, but these? |
142 | # sitearchexp |
149 | # sitearchexp |
143 | # sitelib |
150 | # sitelib |