Subject: | [Feature request] Add official way to override share resoluion |
MIME-Version: | 1.0 |
X-Mailer: | MIME-tools 5.504 (Entity 5.504) |
Content-Disposition: | inline |
X-RT-Interface: | Web |
Message-ID: | <rt-4.0.18-10677-1400303329-391.0-0-0 [...] rt.cpan.org> |
Content-Type: | text/html; charset="utf-8" |
Content-Transfer-Encoding: | binary |
X-RT-Original-Encoding: | utf-8 |
X-RT-Encrypt: | 0 |
X-RT-Sign: | 0 |
Content-Length: | 3700 |
I've a few modules that are reasonbly well used that rely on tricking File::ShareDir into incorporating its things.
For instance, Test::File::ShareDir has to copy the source directory tree into a tempdir and stuff that directory in @INC to coax File::ShareDir into seeing its contents.
And this is not desirable for users who want to have a sharedir in their source tree and want to be able to run a catalyst server from their source tree and be able to update the static content in their /share/ directory and have catalyst refresh it.
I could be monkey patching File::ShareDir dynamically to do this, but that solution is worse than the disease.
My simple proposal would be as follows:
For both _dist_dir and _module_dir , have a hash for each:
our %File::ShareDir::DISTS
our %File::ShareDir::MODULES
and fast-resolve to those paths if they're in the hash.
For instance:
# Check the Hash
return $MODULES{$module} if exists $MODULES{$module};
This will ensure that behaviour will be retained for all sharedirs that are not explicitly indicated, while doing what is desired for the ones that are.