creating packages in perl

How to create Module Packages from the scratch in perl.

Thanks in advance.

This is a rather big topic and would take more than a single forum thread would occupy. Authoritative information can be found in perlmod manpage. Do tell us in case you have difficulties understanding that.

I can create a distribution out of the perl package. But I am not able to install with the distribution on all other machines. Makefile.PL looks like this

Makefile.pl

-----------------------------------------------------------

use inc::Module::Install;
use Cwd;
use File::Spec;

my $version;

## if the file VERSION exists, it contains our versoin; otherwise,
## we use the version encoded in the containing directory name as our version,
## and create the VERSION file.
if ( -r 'VERSION' )
{
open(VERS, 'VERSION');
do {
$version = <VERS>;
} while ($version !~ /[\w\d]+/);
close(VERS);
chomp($version);
print("Version $version\n");
}
else
{
my @dirs;
my $version_from_dir;
my $vers;

    \# pull the current working directory into a list of parent directories
    @dirs = File::Spec-&gt;splitdir\(getcwd\(\)\);
    \# our containing directory will be named by our release number
    $version\_from_dir = pop\(@dirs\);
    \# make sure that the previous comment is true
    if \(! \(defined\($version\_from_dir\)\) && \($version\_from_dir =~ /^\\d\+/\)\)
    \{
            $version\_from_dir = 'DEVELOPMENT';
    \}
    elsif \($version\_from_dir =~ /^\\d\{8\}/\)
    \{
            $version\_from_dir = "RC\_$version\_from_dir";
    \}

    $version = $version\_from_dir;

    \# create version line
    $vers = 'my $VERSION = \\'' . $version\_from_dir . "';\\n";

    open\(VERS, '&gt;VERSION'\) or die\("Unable to create VERSION file: $!"\);
    print\(VERS "$version\_from_dir\\n"\);
    close\(VERS\);

    \#\# set the $VERSION variable in each file to whatever we figured
    \#\# out above.  Since our files are named *.pl before packaging, we'll
    \#\# write the modified version to the base filename without the .pl

    my $file;

    foreach $file \(glob\('bin/*.pl'\), glob\('lib/TestManager/*.pm'\)\)
    \{
            my $newfilename;
            my @newfile;
            my $line;
                \# don't re-name our library modules
            if \($file =~ /\\.pm$/\)
            \{
                    $newfilename = $file;
            \}
            else
            \{
                    \($newfilename\) = \($file =~ /\(.*\)\\.pl$/\);
            \}

            open\(ORIG, $file\) or die\("Unable to read $file: $!"\);

            \# remove all '$VERSION =' lines and replace them with this version
            foreach $line \(&lt;ORIG&gt;\)
            \{
                    if \($line =~ /\\s\*\\$VERSION\\s*=/\)
                    \{
                            push\(@newfile, $vers\);
                    \}
                    else
                    \{
                            push\(@newfile, $line\);
                    \}
            \}
            close\(ORIG\);

            \# clear any pre-existing copy
            \(-e $newfilename\) && unlink\($newfilename\);

            \# write tagged, extension-less copy
            open\(TAGGED, "&gt;$newfilename"\) or die\("Can't write tagged $newfilename: $!"\);
            foreach $line \(@newfile\)
            \{
                    print\(TAGGED $line\);
            \}
            close\(TAGGED\);

            chmod\(0755, $newfilename\);
    \}

}

# Define metadata
name 'Module_name';
abstract "Perl-based toolset for choosing, executing, and reporting tests";
author "author";
perl_version '5.008';
license 'perl';
version $version;

# say what we need
configure_requires 'File::Copy' => 0;
requires 'xyz_Module' => '1.0';

# say what doesn't need to be indexed
no_index 'directory' => 'docs';

# copy renamed scripts to install locations
install_script('bin/script1');
install_script('bin/script2');
install_script('bin/script3');
install_script('bin/script4');
install_script('bin/script5');
install_script('bin/script6');

WriteAll;

----------------------------------------------------------------------
Any changes need to be done for Makefile.pl ?

Thanks in advance,