One of many ways including the __FILE__ suggestion from before, tested–
package App::Moo; use strictures; use Path::Tiny; use JSON::XS; my $__root__; sub root { $__root__ ||= path(__FILE__)->parent->parent->absolute; } sub get_config { decode_json( path( root(), "Config.json" )->slurp ); } 1;
In reply to Re: Path relative to package
by Your Mother
in thread Path relative to package
by DreamT
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |