ylib


ylib documentation Contained in the ylib distribution.

Index


Code Index:


ylib documentation Contained in the ylib distribution.

# Copyright (c) 2009 by David Golden. All rights reserved.
# Licensed under Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License was distributed with this file or you may obtain a 
# copy of the License from http://www.apache.org/licenses/LICENSE-2.0

package ylib;
use strict;
use warnings;
use File::HomeDir 0.86 ();
use Path::Class;

require lib;

our $VERSION = '0.002';
$VERSION = eval $VERSION; ## no critic

my $name = '.mylib';

sub import {
  my $class = shift;
  my @configs = map { file($_, $name) } ( File::HomeDir->my_home(), '.' );
  for my $f (@configs) {
    next unless  -r $f;
    my $fh = $f->openr;
    while ( my $path = <$fh> ) {
      chomp $path;
      my $dir = dir($path);
      if ( -d $dir ) {
        lib->import( "$dir" );
      }
      else {
        warn "lib '$dir' was not found. skipping it\n";
      }
    }
  }
  return 1;
}

1;

__END__