Subject: | [Feature request] Add official way to override share resoluion |
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.