lib::gitroot - locate .git root at compile time and use as lib path
use lib::gitroot qw/:set_root/;
Finds git root and export GIT_ROOT function to current package. Will die if called several times from different places.
use lib::gitroot qw/:lib/;
Finds git root, export GIT_ROOT function to current package and adds GIT_ROOT/lib to @INC. Will die if called several times from different places.
use lib::gitroot qw/:set_root :once/;
Same as :set_root, but will not die if called from different places (instead will use first found GIT_ROOT)
use lib::gitroot qw/:lib :once/;
Similar to :set_root :once
use lib::gitroot lib => 'mylib';
Use GIT_ROOT/mylib instead
Exports GIT_ROOT hoping that it's set previously or will be set in the future
use lib::gitroot ':lib', use_base_dir => "/some/path";
Use some path, instead of caller filename, for searching for git
use lib::gitroot (); say lib::gitroot::find_git_dir(undef, resolve_symlink => 1); # caller filename, resolve symlink say lib::gitroot::find_git_dir(); # caller filename say lib::gitroot::find_git_dir($filename, resolve_symlink => 1); # some filename $filename, resolve symlink
If $filename is a symlink, resolves it (i.e. only top level), finds .git root. Does not alter @INC or GIT_ROOT or anything else
Victor Efimov <lt>email@example.com>.
This software is copyright (c) 2012-2013 by REG.RU LLC
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.