NAME

ex::lib - The same as lib, but makes relative path absolute.

VERSION

Version 0.06

SYNOPSIS

Simple use like use lib ...:

use ex::lib qw(./mylibs1 ../mylibs2);
use ex::lib 'mylibs';

THE GOAL

The main reason of this library is transformate relative paths to absolute at the BEGIN stage, and push transformed to @INC. Relative path basis is not the current working directory, but the location of file, where the statement is. When using common lib, relative paths stays relative to curernt working directory,

# For ex:
# script: /opt/scripts/my.pl
use ex::lib '../lib';

# We run `/opt/scripts/my.pl` having cwd /home/mons
# The @INC will contain '/opt/lib';

# We run `./my.pl` having cwd /opt
# The @INC will contain '/opt/lib';

# We run `../my.pl` having cwd /opt/lib
# The @INC will contain '/opt/lib';

Also this module is very useful when writing tests, when you want to load strictly the module from ../lib, respecting the test file.

# t/00-test.t
use ex::lib '../lib';

Also this is useful, when you running under mod_perl, use something like Apache::StatINC, and your application may change working directory. So in case of chdir StatINC fails to reload module if the @INC contain relative paths.

BUGS

None known

COPYRIGHT & LICENSE

Copyright 2007-2009 Mons Anderson.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Mons Anderson, <mons@cpan.org>