[Israel.pm] Adding library inside cpan module
szabgab at gmail.com
Tue Sep 2 10:27:44 PDT 2008
On Tue, Sep 2, 2008 at 8:14 PM, Shmuel Fomberg <semuelf at 012.net.il> wrote:
> Hi All.
> I have this module on CPAN, Data::ParseBinary.
> now I want to add a library of pre-prepared format. For example, a
> parser/builder for BMP files.
> The question is, how do I call it?
> some options that I though about:
> have module named Data::ParseBinary::lib::GraphicsBMP that export
> function named GetGraphicBMP, or a variable $GraphicBMP.
> maybe I shoud skip the "lib" level, and mass all the files under the
> same directory, creating a Data::ParseBinary::GraphicsBMP module.
> another possibility is to make a Data::ParseBinary::lib module, that
> export function GraphicBMP().
> What do you say?
If you need to add more Perl modules then Data::ParseBinary::GraphicsBMP
would be the way.
If you are talking about all kinds of other resources, such as actual bmp
files then I have just went through this for Padre.
Look at its Build.PL.
by overriding the ACTION_code method in the ./Build phase I copy all
the necessary files
to catdir($FindBin::Bin, 'blib', 'lib', 'auto', 'share', 'dist',
then ./Build install will take care of installing them.
Of course you can do similar things in Makefile.PL as well.
Then, once they are installed you can use File::ShareDir::dist_dir
similar to this:
my $dir =File::ShareDir::dist_dir('Data::ParseBinary');
my $path = File::Spec->catfile($dir , 'docview', $filename);
to locate the files. See the _bitmap function currently in
More information about the Perl