The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Creating loop for a script -Perl repinementer Shell Programming and Scripting 4 05-09-2009 12:14 PM
help needed with creating challenging bash script with creating directories I-1 Shell Programming and Scripting 7 04-29-2009 06:33 AM
creating a file using Perl chriss_58 Shell Programming and Scripting 1 06-03-2008 08:41 AM
Mandriva: Updated perl packages fix denial of service iBot Security Advisories (RSS) 0 05-12-2008 10:30 AM
Pls guide me in learning in Perl Module and packages Yamini Thoppen UNIX for Dummies Questions & Answers 3 12-21-2007 04:10 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-01-2009
hansini hansini is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 10
creating packages in perl

How to create Module Packages from the scratch in perl.

Thanks in advance.
  #2 (permalink)  
Old 07-02-2009
cbkihong cbkihong is offline Forum Advisor  
Advisor
  
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,624
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.
  #3 (permalink)  
Old 07-07-2009
hansini hansini is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 10
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->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, '>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 (<ORIG>)
{
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, ">$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,
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:11 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0