[ critical ] Migration from Shellscript to Perl or Python ?
Hello all,
I'm having some doubts about which language to choose to migrate some shell scripts that I have. All scripts work the same way:
1) access the database Pgsql / Mysql
2) HTTP request to extract data
3) Extract data fields through regular expressions
4) Parallel processing
As an example, I'll post below a piece of code that have:
Code:
for isList in ${isServersDual[@]} # loop over mysql table to extract servers
do
echo -en Integration Server '\E[33m'"\033[1m$isList\033[0m\n\n"
for PACKAGE in `ls *.zip | cut -f1 -d'.' | sort`
do
#extract package status ( ON/ OFF )
packageStatus=`wget -O- -q --http-user=$user --http-password=$pass "http://$isList/invoke/wm.server.packages/packageList" | sed -n /$PACKAGE\</,/TABLE/p | sed -n '5p' | sed -e 's/<[^>][^>]*>//g' -e '/^ *$/d'`
# Actual installed package version
remotePackageVersion=`wget -q -O- --http-user=$user --http-password=$pass "http://$isList/WmRoot/package-info.dsp?package=$PACKAGE" | sed -n '/Version/{N;p;}' | sed '2!d' | cut -c 54-57 | cut -f1 -d'&'`
# Version of the package to be installed
localPackageVersion=`unzip -qo $PACKAGE manifest.v3 | xargs cat manifest.v3 | sed -n '/\"version/p' | cut -f2 -d'>' | cut -f1 -d'<' | head -1`
#
# Package version compar.
if [[ $packageStatus == true ]]
then
if [[ $remotePackageVersion == $localPackageVersion ]]
then
echo -en [ '\E[32m'"VERSION MATCH\033[0m" ]" $PACKAGE\n"
echo -en " Installed version : $remotePackageVersion \n"
echo -en " Local package version : $localPackageVersion\n\n"
else
echo -en [ '\E[33m'"\033[1mDIFERENT VERSION\033[0m" ]" $PACKAGE\n"
echo -en " Installed version : $remotePackageVersion \n"
echo -en " Local package version : $localPackageVersion\n\n"
fi
else
#echo "" >/dev/null
echo -en [ '\E[31m'"DISABLED\033[0m" ]" $PACKAGE\n"
fi
rm manifest.v3
done
done
Currently, I am migrating to PHP (it must be compatible with windows / linux), it works, I have more performance, but I feel that I am not using the most suitable language ... I think my solution may be between Perl and Python.
But which one should use? Considering the criteria that I mentioned at the beginning?
Hi,
Iam working on migration of perl applicaion from MPE/ix OS to UNIX. Perl Application uses MPE::File Package which cannot be used in HPUX.
I have identified IO::File and Filehandle package as replacement.
Will the functionality of the MPE Package & Unix filehandle Package will match?
... (0 Replies)
I have the following problem, which I need done in Perl/ or Python using Unix/linux filters...
1. You have a very large file, named 'ColCheckMe', tab-delmited, that you are asked to process. You are told that each line in 'ColCheckMe' has 7 columns, and that the values in the... (1 Reply)
I have the following problem, which I need done in Perl/ or Python using Unix/linux filters...
1. You have a very large file, named 'ColCheckMe', tab-delmited, that you are asked to process. You are told that each line in 'ColCheckMe' has 7 columns, and that the values... (1 Reply)
Hello all,
I am in a bit of dilema here. I want to implement a suite. it involves a lot of text file processing and shell scripts . which one to use perl or python ? (4 Replies)
I have a client that needs some data downloaded from a website periodically. The problem is that the data is not available directly (i.e. ftp) and must be accessed via logging in to the site, selecting the data manually, then finally clicking a link to grab the zip file. The site does not have an... (2 Replies)
Anyone care to give me the cliff notes as to why one would want to use perl vs python? Unix Solaris over here. Have capability to run both perl and python and bash/ksh and others.
Now what I am interested in using unix and its programs for large amounts of data, sql (done in Unix SAS)...etc.... (5 Replies)
I'm New to AIX / VIOS
We're doing a FC switch cutover on an ibm device, connected via SAN.
How do I tell if one path to my remote disk is lost? (aix lvm)
How do I tell when my link is down on my HBA port?
Appreciate your help, very much! (4 Replies)
Hi All,
I'm confused what to use (Python/Perl/Shell), I have a scenario here wherein i need to process a data which might have millions of records in tabular format, my task is to find the {0,null,NA} in each and every column and also inform the end user that this column has this many values... (2 Replies)
Discussion started by: nikhil jain
2 Replies
LEARN ABOUT REDHAT
http::request
HTTP::Request(3) User Contributed Perl Documentation HTTP::Request(3)NAME
HTTP::Request - Class encapsulating HTTP Requests
SYNOPSIS
require HTTP::Request;
$request = HTTP::Request->new(GET => 'http://www.oslo.net/');
DESCRIPTION
"HTTP::Request" is a class encapsulating HTTP style requests, consisting of a request line, some headers, and some (potentially empty) con-
tent. Note that the LWP library also uses this HTTP style requests for non-HTTP protocols.
Instances of this class are usually passed to the "request()" method of an "LWP::UserAgent" object:
$ua = LWP::UserAgent->new;
$request = HTTP::Request->new(GET => 'http://www.oslo.net/');
$response = $ua->request($request);
"HTTP::Request" is a subclass of "HTTP::Message" and therefore inherits its methods. The inherited methods most often used are header(),
push_header(), remove_header(), and content(). See HTTP::Message for details.
The following additional methods are available:
$r = HTTP::Request->new($method, $uri)
$r = HTTP::Request->new($method, $uri, $header)
$r = HTTP::Request->new($method, $uri, $header, $content)
Constructs a new "HTTP::Request" object describing a request on the object $uri using method $method. The $uri argument can be either
a string, or a reference to a "URI" object. The optional $header argument should be a reference to an "HTTP::Headers" object. The
optional $content argument should be a string.
$r->method([$val])
$r->uri([$val])
These methods provide public access to the attributes containing respectively the method of the request and the URI object of the
request.
If an argument is given the attribute is given that as its new value. If no argument is given the value is not touched. In either case
the previous value is returned.
The method() method argument should be a string.
The uri() method accept both a reference to a URI object and a string as its argument. If a string is given, then it should be
parseable as an absolute URI.
$r->as_string()
Method returning a textual representation of the request. Mainly useful for debugging purposes. It takes no arguments.
SEE ALSO
HTTP::Headers, HTTP::Message, HTTP::Request::Common
COPYRIGHT
Copyright 1995-2001 Gisle Aas.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
libwww-perl-5.65 2001-11-15 HTTP::Request(3)