Skip Menu |

This queue is for tickets about the File-ShareDir CPAN distribution.

Report information
The Basics
Id: 95721
Status: open
Priority: 0/
Queue: File-ShareDir

People
Owner: Nobody in particular
Requestors: KENTNL [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.102
Fixed in: (no value)



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:

sub module_dir {
        my $module = _MODULE(shift);
        my $dir;

                   # Check the Hash
                  return $MODULES{$module} if exists $MODULES{$module};
 
        # Try the new version
        $dir = _module_dir_new( $module );
        return $dir if defined $dir;
 
        # Fall back to the legacy version
        return _module_dir_old( $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.
 

RT-Send-CC: ether [...] cpan.org
Thanks for the ticket as reminder, too. But let us avoid splitting argues, please let us use https://github.com/perl5-utils/File-ShareDir/pull/3 or this queue. Decide which one you like to prefer and add an appropriate comment to the other queue.

I opened this bug first and this location was chosen because the metadata on the release still implies "bugs => rt".

Though I'm quite happy to keep it focused on the pull req, esp as RT is not so useful for dealing with PRs.