Acme-ful
view release on metacpan or search on metacpan
Support is by the author. Please file bug reports or ask questions at
L<https://github.com/ryan-willis/ful.pm/issues>.
=cut
our $VERSION = '0.11';
use Cwd;
use File::Spec;
my $cursor;
my $FS = 'File::Spec';
our $crum = undef;
sub crum { $crum }
sub import {
my $me = shift;
my @user = caller();
my $used_me = $user[1];
$cursor = Cwd::abs_path($used_me);
my %args = ();
my @libdirs = ('lib');
if (@_ && ref($_[0]) eq 'HASH') {
%args = %{$_[0]};
}
elsif(@_) {
@libdirs = @_;
}
$me->_ascend until $me->_is_file(@gitparts) or $me->_heaven;
}
else {
while (!$me->_heaven) {
last if scalar @libdirs == grep { $me->_is_dir($_) } @libdirs;
$me->_ascend;
}
}
return if $me->_heaven;
$crum = $me->_comb($cursor);
unshift @INC => $me->_comb($cursor, $_) for @libdirs;
}
sub _is_file { -f shift->_comb($cursor, @_) }
sub _is_dir { -d shift->_comb($cursor, @_) }
sub _comb { $FS->catfile(@_[1..$#_]) }
sub _ascend { $cursor = $FS->catdir(($FS->splitpath($cursor))[0..1]) }
sub _heaven { $cursor eq $FS->rootdir }
1;
__END__
( run in 0.253 second using v1.01-cache-2.11-cpan-4d50c553e7e )