No, do not write a shell script. Perl already has a perfectly fine way of doing this. The correct way to do this is to build a CPAN-ready distribution using the normal toolchain. Some of this is explained in perlnewmod, perlmodstyle and perlmodinstall.
For a minimal working example, create a directory layout thus:
.
├── Build.PL
├── README
└── script
└── abuscript.pl
In the Build.PL
file, put:
use 5.000;
use Module::Build qw();
Module::Build->new(
module_name => 'abuscript',
dist_version => '1.000',
dist_author => 'abubacker <abubacker@example.com>',
dist_abstract => 'describe what the script does in one sentence',
configure_requires => {
'perl' => '5.000',
},
requires => {
'JSON::Any' => 0,
},
)->create_build_script;
Change the details to suite your purposes.
In the README
file, put some installation instructions, for instance:
To install this module, run the following commands:
perl Build.PL
./Build install
Once you're done with all that, you run:
perl Build.PL
./Build manifest
./Build dist
This will result in a .tar.gz
archive which you will distribute. Tell your users to install it like any other CPAN module, or if they don't know what that means, they should read the README.
If you have time, I recommend converting your script to a module. The program pl2pm (comes with Perl) and the CPAN module Module-Starter-PBP help you.
If license permits, it is possible to upload your code to CPAN to make it even more convenient for your users. Ask for help in any of the following places first: mailing list module-authors@perl.org, web forum PerlMonks, IRC channel #toolchain on MagNET (irc://irc.perl.org/toolchain)