Skip to content

Commit

Permalink
Build results of c379643 (on master)
Browse files Browse the repository at this point in the history
  • Loading branch information
kentfredric committed Apr 14, 2015
1 parent 15b52cd commit d804b15
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Release history for Module-Path-Simplify

0.001000 2015-04-14T10:46:25Z ba38b45
0.001000 2015-04-14T10:57:21Z c379643
- First version.

52 changes: 28 additions & 24 deletions lib/Module/Path/Simplify.pm
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,39 @@ sub inc {
return @{ $self->{inc} ||= [@INC] };
}

# Iterates @$tries
# and returns a {} if $try[n] is a prefix.
sub _find_in_set {
my ( undef, $path, $tries ) = @_;
my ( $shortest, $match_target );
for my $try ( @{$tries} ) {
next unless $try->valid and my $short = $try->matched_suffix($path);
next if defined $shortest and length $short >= length $shortest;
$shortest = $short;
$match_target = $try;
}
return unless defined $shortest;
return {
relative_path => $shortest,
match_target => $match_target,
};
}

# Private lazy accessor
sub _tests_config {
my ($self) = @_;
return @{ $self->{_tests_config} ||= [ $self->_gen_tests_config ] };
}

# Private lazy accessor
# Cache + saves on first use unless nonfrozen.
sub _tests_inc {
my ($self) = @_;
## no critic (ValuesAndExpressions::RequireInterpolationOfMetachars)
return @{ $self->{_tests_inc} ||= [ $self->_gen_tests_user_inc( '$INC', [ $self->inc ] ) ] } unless $self->inc_dynamic;
return $self->_gen_tests_user_inc( '$INC', \@INC );
}

sub _gen_tests_config {
my (@try) = (
{ display => 'SA', key => 'sitearch' },
Expand Down Expand Up @@ -155,30 +183,6 @@ sub _gen_tests_user_inc {
} 0 .. $#u_inc;
}

# Cache + saves on first use unless nonfrozen.
sub _tests_inc {
my ($self) = @_;
## no critic (ValuesAndExpressions::RequireInterpolationOfMetachars)
return @{ $self->{_tests_inc} ||= [ $self->_gen_tests_user_inc( '$INC', [ $self->inc ] ) ] } unless $self->inc_dynamic;
return $self->_gen_tests_user_inc( '$INC', \@INC );
}

sub _find_in_set {
my ( undef, $path, $tries ) = @_;
my ( $shortest, $match_target );
for my $try ( @{$tries} ) {
next unless $try->valid and my $short = $try->matched_suffix($path);
next if defined $shortest and length $short >= length $shortest;
$shortest = $short;
$match_target = $try;
}
return unless defined $shortest;
return {
relative_path => $shortest,
match_target => $match_target,
};
}

sub _abs_unix_path {
my ($path) = @_;
return q{} unless defined $path;
Expand Down

0 comments on commit d804b15

Please sign in to comment.