DreamT has asked for the wisdom of the Perl Monks concerning the following question:
2. A config file, located in a subfolder: /App/Config/Config.json.package App::Package; use File::Slurp; sub get_config { my $json = read_file("???/Config/Config.json"); #... return $something; }
My problem occurs when I try to read the config file; The problem is that I don't know the relative path between the package and the config file.use lib 'Some/Random/Path/To/App'; my $result = get_config();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Path relative to package
by hippo (Archbishop) on Jun 01, 2018 at 15:01 UTC | |
|
Re: Path relative to package
by haj (Vicar) on Jun 01, 2018 at 20:37 UTC | |
|
Re: Path relative to package
by bliako (Abbot) on Jun 01, 2018 at 16:47 UTC | |
|
Re: Path relative to package
by tinita (Parson) on Jun 01, 2018 at 21:38 UTC | |
|
Re: Path relative to package
by Your Mother (Archbishop) on Jun 01, 2018 at 22:54 UTC | |
|
Re: Path relative to package
by Anonymous Monk on Jun 01, 2018 at 14:54 UTC | |
|
Re: Path relative to package
by ikegami (Patriarch) on Jun 01, 2018 at 23:42 UTC |