Initself's Retarded Guide to Building a Package
To build a package, use Module::Install, ya turkey!
cpan Module::Install
Make a directory for your package to reside:
mkdir /home/you/My-Package
Put your module in the 'lib' directory. This is where all your code is going to live.
mkdir lib
mkdir My
touch My/Package.pm
Put your code in My/Package.pm, or copy the file you already wrote here.
Then, create a Makefile.PL in /home/you/My-Package:
use inc::Module::Install;
# Define metadata
name 'My-Package';
perl_version '5.006';
version '0.01';
license 'perl';
# Specific dependencies
test_requires 'Test::More' => '0.42';
WriteAll;
Then, just run your new shiny file, pal!
perl Makefile.PL && make && make install && make clean && rm Makefile.old
While your at it, put that in a file called 'install.sh' so you can execute that each time you install it. You've gotta be root to run this sucker!
sudo sh install.sh
Afterwards, your directory will looks like this:
inc/ install.sh* lib/ Makefile.PL META.yml
You're installed!
Thanks for your post which will definitely help others. However, you are responsible for handling everything right. There are a couple of modules on CPAN that could make this job even easier.
My personal favorite is to use
Dist::Zillato handle everything around managing my packages. The only thing you will have to do is to maintain a small file nameddist.iniin the top directory of your module and everything else will get generated for you. Simply installDist::Zillaand make thedzilexecutable your friend -- you will love it!