10 Sep 2010 12:22:54 UTC
- Distribution: File-ShareDir-PAR
- Module version: 0.06
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (3)
- Testers (785 / 39 / 0)
- KwaliteeBus factor: 0
- 92.96% Coverage
- License: perl_5
- Perl: v5.5.0
- Activity24 month
- Download (30.79KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionSMUELLER Steffen Müller
File::ShareDir::PAR - File::ShareDir with PAR support
use File::SharedDir::PAR ':ALL'; # exact same interface as the normal File::ShareDir: # Where are distribution-level shared data files kept $dir = dist_dir('File-ShareDir'); # Where are module-level shared data files kept $dir = module_dir('File::ShareDir'); # Find a specific file in our dist/module shared dir $file = dist_file( 'File-ShareDir', 'file/name.txt'); $file = module_file('File::ShareDir', 'file/name.txt'); # Like module_file, but search up the inheritance tree $file = class_file( 'Foo::Bar', 'file/name.txt' );
You may choose to install the
File::ShareDirso that they become available globally. In that case, you must do the following before anybody can import functions from
use File::ShareDir::PAR 'global';
This module contains highly experimental code. If you want to load modules from
.parfiles using PAR and then access their shared directory using
File::ShareDir, you probably have no choice but to use it. But beware, here be dragons.
The problem is, that the concept of having a distribution or module specific share directory becomes a little hazy when you're loading everything from a single file. PAR uses an
@INChook to intercept any attempt to load a module. File::ShareDir uses the directory structure that is typically found in the directories that are listed in
@INCfor storing the shared data. In a
PARenviroment, this is not necessarily possible.
When you call one of the functions that this module provides, it will take care to search in any of the currently loaded
.parfiles before scanning
@INC. This is the same order of preference you get for loading modules when PAR is in effect. If the path or file you are asking for is found in one of the loaded
.parfiles, that containing
.parfile is extracted and the path returned will point to the extracted copy on disk.
Depending on how you're using PAR, the files that are extracted this way are either cleaned up after program termination or cached for further executions. Either way, you're safe if you use the shared data as read-only data. If you write to it, your changes may be lost after the program ends.
For any further usage information, including the list of exportable functions, please refer to the documentation of File::ShareDir.
Bugs should always be submitted via the CPAN bug tracker
For other issues, contact the PAR mailing list: <email@example.com>
Steffen Mueller <firstname.lastname@example.org>
The code was adapted from Adam Kennedy's work on
Copyright (c) 2008-2010 Steffen Mueller This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The portions of code that were copied from
Copyright (c) 2005, 2006 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
Module Install Instructions
To install File::ShareDir::PAR, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install File::ShareDir::PAR
For more information on module installation, please visit the detailed CPAN module installation guide.