Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Add bash file to a dist package

by earlati (Acolyte)
on Aug 16, 2010 at 22:02 UTC ( #855367=perlquestion: print w/replies, xml ) Need Help??

earlati has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to build my first perl package.

It consist of only one module and a bash file, let's say test1.pm and test1.sh.

I have used the module-starter utility, which build a zipped package with the perl module test1.pm but I didn't know how to add the file test1.sh and how setup where this file should be installed. (ie. I want to install it under /etc/profile.d )

Please can someone tell me how include test1.sh in the dist package ?

Regards, Enzo

Replies are listed 'Best First'.
Re: Add bash file to a dist package
by lima1 (Curate) on Aug 17, 2010 at 01:41 UTC
    With Module::Build, add something like this to your Build.PL:
    my $builder = Module::Build->new( ... sh_files => { 'path/in/dist/to/test.sh' => 'sh/test666.sh'}, install_path => { sh => '/etc/profile.d' }, ... } $builder->add_build_element('sh'); $builder->create_build_script();
    Read the Module::Build::Cookbook for details.
      Thanks, I follow your hints and it seems to work.

      Just one think is not clear to me again.

      I used a Build.PL file like this:

      use strict; use warnings; use Module::Build; my $builder = Module::Build->new( module_name => 'Jump', license => 'perl', dist_author => q{Enzo Arlati <enzo.arlati@libero.it>}, dist_version_from => 'lib/Jump.pm', build_requires => { 'Test::More' => 0, }, sh_files => { 'sh/jump.sh' => 'sh/jump.sh' }, add_to_cleanup => [ 'Jump-*' ], create_makefile_pl => 'traditional', ); $builder->install_path( 'sh' => '/etc/profile.d/' ); $builder->add_build_element( 'sh' ); $builder->create_build_script();
      In this file I have to add the statement:
      sh_files => { 'sh/jump.sh' => 'sh/jump.sh' },
      also if the source and destination of the sh files are the same.

      If I comment this line the jump.sh file are not processed.

      Is this correct and there are a more polite way to tell the program to include the file *.sh ?

      Regards, Enzo

        According Module::Build::Cookbook, if you specify
        $builder->add_build_element( 'sh' );
        this will find all *.sh files in the lib directory of your distribution. In your case, the bash script is in a non-standard directory, so you have to tell Module::Build where it is:
        sh_files => { 'sh/jump.sh' => 'sh/jump.sh' },
        And here the files are not the same. The destination is 'blib/sh/jump.sh'.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://855367]
Approved by lima1
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2021-11-30 13:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?