07-07-2009
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,
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
It is very urgent.
Pls guide me in learning Perl Module and the Packages.
Eventhough i tried in the google, I didnt get upto my expectations.
Pls guide me how to create , build Module and the package.
Many Thanks. (3 Replies)
Discussion started by: Yamini Thoppen
3 Replies
2. Shell Programming and Scripting
Hi guys,
when i use the following code:
open(DEST, ">>DESTINATION_")|| die "$!"; #OPEN FILE FOR WRITING
@contents=@field;
print DEST "@contents\n";
I am creating a file that lookss like this:
Wed May 14 11:42:03 2008 10800 306973223399 19419-NEA 1 1259 1 3 80
What i want to do is... (1 Reply)
Discussion started by: chriss_58
1 Replies
3. Shell Programming and Scripting
Hi Guyz
I designed a script that can compare 2 columns(values) of single file and gives the closest numbers to the first column by comparing the numbers in first column with second and it works in a single file.
Now I'm trying to design a new script with 2 objectives for 2 files (not a single... (4 Replies)
Discussion started by: repinementer
4 Replies
4. Shell Programming and Scripting
As an simple example, I have the following files
fin1.zv being a one column set of number
1 90
2 80
3 60
4 30
5 20
fin2.zv is another file like this
1 10 20 30 40 50
2 60 70 80 90 0
3 90 80 70 60 50
4 40 30 20 10 0
5 10 20 30 40 50 (2 Replies)
Discussion started by: kristinu
2 Replies
5. Shell Programming and Scripting
Good morning!!
Im trying to create a script that should get a list of numbers from the user (using STDIN or a list of arguments), and call my library function.
#!use/bin/perl
require 'my-lib.pl';
@userArray = <STDIN>;
while()
{
chomp;
last if ! /\d/;
push(@userArray,&_);
}... (2 Replies)
Discussion started by: bigben1220
2 Replies
6. Slackware
Hi!
Let me introduce a project for find and download Slackware packages and browse Slackware repositories.
The site provides following features:
* Large, daily updated database with RPM, DEB, TGZ, TXZ packages for well-known repositories of the Slackware, Fedora, CentOS, RHEL, Debian,... (2 Replies)
Discussion started by: lystor
2 Replies
7. Shell Programming and Scripting
I have a perl script that automatically runs on Mondays.
I need to have it create a variable for last Monday's date thru that Sunday's date.
example: 04-01-2011 thru 04-08-2011
Its reporting numbers for the previous week beginning with Monday and ending on Sunday. So i dont have to go in... (7 Replies)
Discussion started by: bbraml
7 Replies
8. Shell Programming and Scripting
Hi ,
I am writing a simple excel file and want to create the file under say 'D:\Documents and Settings'. The problem with my code is it is writing in the same directory instead of the specified. Here is a sample code
use Spreadsheet::WriteExcel;
my $workbook =... (1 Reply)
Discussion started by: daptal
1 Replies
9. Programming
My issue is that the perl script (as I have done it so far) created empty branches when I try to check some branches on existence.
I am using multydimentional hashes: found it as the best way for information that I need to handle. Saing multidimentional I means hash of hashes ... So, I have
... (2 Replies)
Discussion started by: alex_5161
2 Replies