[22885] in Perl-Users-Digest
Perl-Users Digest, Issue: 5106 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 11 14:06:30 2003
Date: Wed, 11 Jun 2003 11:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 11 Jun 2003 Volume: 10 Number: 5106
Today's topics:
Re: Beginning a script in the background <jurgenex@hotmail.com>
Count in binary <john.wilkinson@philips.com>
Re: Count in binary (Villy Kruse)
Re: Count in binary <usenet@expires082003.tinita.de>
Re: Count in binary <bernard.el-hagin@DODGE_THISlido-tech.net>
Re: Critique my code - need a bit of help (Perl for Win <nobull@mail.com>
db file problem <ixanthi@ixanthi.remove.gr>
Re: Do yu know abetter way to do it ? <nobull@mail.com>
extracting multiple data items from an array <tim@fakeaddress.com>
Re: extracting multiple data items from an array <wksmith@optonline.net>
Re: extracting multiple data items from an array <nobull@mail.com>
Re: extracting multiple data items from an array <nobull@mail.com>
help with HTTP::Cookies (dan baker)
Re: How to I arrange for a socket connection to time ou <nospam@spamcop.com>
LWP Post with incorrect response (Chacrint Charinthorn)
Re: LWP Post with incorrect response <nobull@mail.com>
manipulating files in Perl question. <gt8306b@mail.gatech.edu>
Re: manipulating files in Perl question. <bigj@kamelfreund.de>
Re: manipulating files in Perl question. <thens@nospam.com>
Memory Leak in certain perl modules (Sanjaya Srivastava)
Re: need the ascii set for arrow down <jpagnew@vcu.edu>
Re: need the ascii set for arrow down <jurgenex@hotmail.com>
Re: NEWBEE: Client-Server Timout implementation (John Brock)
Re: Perl Matrix Filter Module like in Excel? Dennis@NoSpam.com
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 11 Jun 2003 14:27:43 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Beginning a script in the background
Message-Id: <z%GFa.57$Zi5.1@nwrddc03.gnilink.net>
Dave Ardrey wrote:
> I posted this question yesterday but I may have been a little unclear
> as to what I need. I understand how to, from within a script, start a
> process in the background:
>
> system("command &");
>
> However, what I need is for my entire script to immediately go into
> the background, as soon as I execute it from the unix command line.
Anything wrong with letting the shell do the work?
myperlscript &
But of course this would be a shell solution, not a Perl solution
jue
------------------------------
Date: Wed, 11 Jun 2003 14:05:17 +0100
From: "John Wilkinson" <john.wilkinson@philips.com>
Subject: Count in binary
Message-Id: <3ee72891$0$11384$4d4eb98e@read-nat.news.uk.uu.net>
Hi,
I would like to know how to count up in binary with perl.
I have an integer going from 1 to say 200, I need to convert this number to
an array of 1's and 0's.
Can ayone help please.
Regards,
John.
------------------------------
Date: 11 Jun 2003 13:13:35 GMT
From: vek@station02.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: Count in binary
Message-Id: <slrnbeeanv.943.vek@station02.ohout.pharmapartners.nl>
On Wed, 11 Jun 2003 14:05:17 +0100,
John Wilkinson <john.wilkinson@philips.com> wrote:
>Hi,
>I would like to know how to count up in binary with perl.
>
>I have an integer going from 1 to say 200, I need to convert this number to
>an array of 1's and 0's.
>Can ayone help please.
>
The pack function can convert a number to a string of binary digits.
Villy
------------------------------
Date: 11 Jun 2003 13:28:01 GMT
From: Tina Mueller <usenet@expires082003.tinita.de>
Subject: Re: Count in binary
Message-Id: <bc7ap1$gl703$1@ID-24002.news.dfncis.de>
John Wilkinson wrote:
> I would like to know how to count up in binary with perl.
> I have an integer going from 1 to say 200, I need to convert this number to
> an array of 1's and 0's.
> Can ayone help please.
sprintf "%b", $int
perldoc -f sprintf
hth, tina
--
http://www.tinita.de/ \ enter__| |__the___ _ _ ___
http://Movies.tinita.de/ \ / _` / _ \/ _ \ '_(_-< of
http://www.perlquotes.de/ \ \ _,_\ __/\ __/_| /__/ perception
- my mail address expires end of august 2003 -
------------------------------
Date: Wed, 11 Jun 2003 13:30:42 +0000 (UTC)
From: "Bernard El-Hagin" <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: Count in binary
Message-Id: <Xns93979D6CEDF5Belhber1lidotechnet@62.89.127.66>
John Wilkinson wrote:
> Hi,
> I would like to know how to count up in binary with perl.
>
> I have an integer going from 1 to say 200, I need to convert this
> number to an array of 1's and 0's.
> Can ayone help please.
% perl -e 'printf "%b\n", $_ for (1 .. 200)'
--
Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'
------------------------------
Date: 11 Jun 2003 19:00:22 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Critique my code - need a bit of help (Perl for Win32)
Message-Id: <u9vfvcwl3d.fsf@wcl-l.bham.ac.uk>
tadmc@augustmail.com (Tad McClellan) writes:
> Jason B <jbunsto@toronto.ca> wrote:
>
> > if (!grep { /Reply/ } @Ping)
>
>
> "unless" is the same as "if not", and you don't need the block:
But it does aid readability.
> unless ( grep /Reply/, @Ping )
>
> (just a point of style, but excessive punctuation gets in the way of
> clear communication, so I try to avoid punctuation.
> )
Just a point of style, but excessive avoidance of punctuation also
gets in the way of clear communication, so I try to avoid saving a few
puctionation marks at the expense of clear communication.
unless ( grep { /Reply/ } @Ping )
The first argument to grep is code. Even if you use the syntax that
doesn't make this explicit, the first argument is still code to pass
to grep not an expression to be evaluated. I like form to follow
function so I always use the explicit block syntax.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 11 Jun 2003 18:56:08 +0300
From: "Vassilis Tavoultsidis" <ixanthi@ixanthi.remove.gr>
Subject: db file problem
Message-Id: <bc7jeq$icq$1@nic.grnet.gr>
I am working with the simple db files perl gives and I open and close the
with the dbmopen and dbmclose files. Sometimes (i don't know the conditions)
it seems that the file contains 2(!!) identical records in it. The records
have the same key and the same content. If I erase one the other is gone
too. If i modify one the other is modified too. I have tried to figure out
what may cause this but nothing.
Does anyone know anything about this?
Thanks
Zeus
------------------------------
Date: 11 Jun 2003 18:25:19 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Do yu know abetter way to do it ?
Message-Id: <u9he6wy1a8.fsf@wcl-l.bham.ac.uk>
Jean-Luc BEAUDET <beaudet@cyber.kodak.com> writes:
> John W. Krahn wrote:
>
> > my $search_pattern = qr/@{[ sprintf '%s %s %2s \d{2}:\d{2}:\d{2} MEST 2003', @d7tt[0,2,1] ]}/;
> But what about the construction with @{[../..]} ?
> Could yu explain it to me ?
See FAQ: "How do I expand function calls in a string?"
Personally I think in this case it more readable not to use it:
my $search_pattern = sprintf '%s %s %2s \d{2}:\d{2}:\d{2} MEST 2003', @d7tt[0,2,1];
$search_pattern = qr/$search_pattern/;
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 11 Jun 2003 14:25:19 +0100
From: "tim" <tim@fakeaddress.com>
Subject: extracting multiple data items from an array
Message-Id: <1055338180.70784.0@demeter.uk.clara.net>
I'm trying to extract some data elements from an array. The solution below
works, but i'm sure there is a much easier way of doing it. Although it's
not in this script the array is created by doing an nslookup -q=mx domain,
the idea is to just extract the mail server's name and weighting. One
problem I can see, is that I want it to run on both NT & Linux, the
difference being that Linux seems to output all of the MX records on one
line. I had a look at the nslookup module but had great trouble getting it
(and the prereq's) installed so this was my attempt. I would be grateful
for any help.
#!/usr/bin/perl -w
my @weight; my @server;
@array = ("blah", "MX preference = 30 mail exchanger = smtp3.abcd.com", "MX
preference = 10 mail exchanger = smtp1.abcd.com", "blah", "MX preference =
20 mail exchanger = smtp2.abcd.com", "blah", "blah");
foreach my $line (@array) {
if (index($line, "MX preference") >= 0) {
push @weight, (substr($line, index($line, "MX preference")+16, 2));
}
}
foreach my $line (@array) {
if (index($line, "mail exchanger") >= 0) {
push @smtp, (substr($line, index($line, "mail exchanger")+17,
length($line)-index($line, "mail exchanger")-16));
}
}
print @weight;
print @smtp;
Regards,
Tim
------------------------------
Date: Wed, 11 Jun 2003 16:49:05 GMT
From: "Bill Smith" <wksmith@optonline.net>
Subject: Re: extracting multiple data items from an array
Message-Id: <54JFa.25423$ly.10061935@news4.srv.hcvlny.cv.net>
"tim" <tim@fakeaddress.com> wrote in message
news:1055338180.70784.0@demeter.uk.clara.net...
> I'm trying to extract some data elements from an array. The solution
below
> works, but i'm sure there is a much easier way of doing it. Although
it's
> not in this script the array is created by doing an nslookup -q=mx
domain,
> the idea is to just extract the mail server's name and weighting. One
> problem I can see, is that I want it to run on both NT & Linux, the
> difference being that Linux seems to output all of the MX records on
one
> line. I had a look at the nslookup module but had great trouble
getting it
> (and the prereq's) installed so this was my attempt. I would be
grateful
> for any help.
>
> #!/usr/bin/perl -w
> my @weight; my @server;
> @array = ("blah", "MX preference = 30 mail exchanger =
smtp3.abcd.com", "MX
> preference = 10 mail exchanger = smtp1.abcd.com", "blah", "MX
preference =
> 20 mail exchanger = smtp2.abcd.com", "blah", "blah");
> ### foreach my $line (@array) {
> ### if (index($line, "MX preference") >= 0) {
> ### push @weight, (substr($line, index($line, "MX
preference")+16, 2));
> ### }
> ### }
@weight = map +(/MX preference\s=\s(\d+)/), @array;
> ### foreach my $line (@array) {
> ### if (index($line, "mail exchanger") >= 0) {
> ### push @smtp, (substr($line, index($line, "mail exchanger")+17,
> ### length($line)-index($line, "mail exchanger")-16));
> ### }
> ### }
@smtp = map +(/mail exchanger\s=\s([\w.]+)/), @array;
>
> print @weight;
> print @smtp;
>
I have suggested a one-line replacement for each of your loops. I
cannot help with the other format without a more detailed description of
it.
Bill
------------------------------
Date: 11 Jun 2003 18:34:38 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: extracting multiple data items from an array
Message-Id: <u9d6hky0up.fsf@wcl-l.bham.ac.uk>
"tim" <tim@fakeaddress.com> writes:
> I'm trying to extract some data elements from an array. The solution below
> works, but i'm sure there is a much easier way of doing it. Although it's
> not in this script the array is created by doing an nslookup -q=mx domain,
> the idea is to just extract the mail server's name and weighting. One
> problem I can see, is that I want it to run on both NT & Linux, the
> difference being that Linux seems to output all of the MX records on one
> line. I had a look at the nslookup module but had great trouble getting it
> (and the prereq's) installed so this was my attempt. I would be grateful
> for any help.
>
> #!/usr/bin/perl -w
Note: -w has been superceded by "use warnings". Use -w only if you
need to retain backward compatibility with old versions of Perl.
You forgot to "use strict".
> my @weight; my @server;
> @array = ("blah", "MX preference = 30 mail exchanger = smtp3.abcd.com", "MX
> preference = 10 mail exchanger = smtp1.abcd.com", "blah", "MX preference =
> 20 mail exchanger = smtp2.abcd.com", "blah", "blah");
You forgot to declare @array.
> foreach my $line (@array) {
> if (index($line, "MX preference") >= 0) {
> push @weight, (substr($line, index($line, "MX preference")+16, 2));
> }
> }
> foreach my $line (@array) {
> if (index($line, "mail exchanger") >= 0) {
> push @smtp, (substr($line, index($line, "mail exchanger")+17,
> length($line)-index($line, "mail exchanger")-16));
> }
> }
Perl has very powerfull pattern matching. While you can build pattern
matching out of primative bits (and your code may actually still be as
fast or faster) it's not very Perlish.
my @weight = map { /MX preference = (\d+)/ } @array;
my @smtp = map { /mail exchanger = (.*)/ } @array;
However creating two paralell arrays like this may cause trouble if
there are lines that contain one target and not the other.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 11 Jun 2003 18:39:20 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: extracting multiple data items from an array
Message-Id: <u98ys8y0mv.fsf@wcl-l.bham.ac.uk>
Brian McCauley <nobull@mail.com> writes:
> my @weight = map { /MX preference = (\d+)/ } @array;
> my @smtp = map { /mail exchanger = (.*)/ } @array;
>
> However creating two paralell arrays like this may cause trouble if
> there are lines that contain one target and not the other.
So consider an array of hashes:
my @mx = map {
/MX preference = (\d+).*mail exchanger = (.*)/ ? { weight => $1, smtp => $2 } : ();
} @array;
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 11 Jun 2003 05:30:18 -0700
From: botfood@yahoo.com (dan baker)
Subject: help with HTTP::Cookies
Message-Id: <13685ef8.0306110430.3e593d40@posting.google.com>
passme
I have used CGI:Cookies before and prepared a header before printing
to browser "semi-manually"... however in this case I think I need to
use HTTP::Cookies because the page I am creating is via LWP::UserAgent
. I am really confused in how to prepare and add the cookie
information to the object prior to making the request.
I have included a snippet of code below where I think it needs to go,
but I left the cookie stuff alone... Can someone please illustrate
using this as a simple example? I want to set two cookies, with an
expiration date of 30 days, available to be read only by the domain
that is creating the cookies.
my $WelcomeMsg = "Welcome $MemberHandle ! ";
my $ua = LWP::UserAgent->new;
# set up cookies: BCNMuser=$MemberEmail , BCNMepw=$MemberEncPassword
# -----
# use HTTP::Cookies;
# $cookie_jar = HTTP::Cookies->;new;
# $cookie_jar->add_cookie_header($request);
# $ua->cookie_jar([$cookies])
### code here ###
# display UpdateMemberInfo UI form
# -----
# pass in values that need to be displayed for review/update
my $req = POST $cfgAbsPath_top2cgi.'DisplayUI.pl',
[
f => 'UpdateMemberInfo',
MemberEmail => $MemberEmail ,
FormErrorMsg => $WelcomeMsg
] ;
print $ua->request($req)->as_string; # display
Thanks,
dan
------------------------------
Date: Wed, 11 Jun 2003 17:45:07 GMT
From: "BrianC" <nospam@spamcop.com>
Subject: Re: How to I arrange for a socket connection to time out?
Message-Id: <DUJFa.34895$6f3.5663955@news1.telusplanet.net>
> > I am using Perl to write a client module which communicates with
> > a server through a socket connection. I want the client to time
> > out the socket connection if the server does not respond within,
> > let's say, 60 seconds, and I am trying to figure out the correct
> > and idiomatic Perl way to do this. (I also want this to be portable,
> > since the client needs to run on both Unix and Windows NT).
I did this:
$CLIENT_MAX_WAIT = 60;
my $time = time;
while (defined ($buf = <$sock>) )
{
$response .= $buf;
if( time - $time > $CLIENT_MAX_WAIT) { print "timed out\n"; last(); }
}
close $sock;
------------------------------
Date: 11 Jun 2003 04:00:43 -0700
From: chacrint@hotmail.com (Chacrint Charinthorn)
Subject: LWP Post with incorrect response
Message-Id: <bfe227db.0306110300.1a894703@posting.google.com>
Hi all,
When I post to a php script running on apache 1.3.27 using LWP
HTTP/1.1 but I had the response saying "HTTP/1.0 200 OK".
I assume LWP will recognise it as "Internal Server Error". What would be
the fix for this problem?
Please find the following as the reference.
POST /Service/myscript.php HTTP/1.1
TE: deflate,gzip;q=0.3
Connection: TE, close
User-Agent: LWP Agent/1.0
Content-Length: 65
Content-Type: application/x-www-form-urlencoded
....
HTTP/1.0 200 OK
Date: Sat, 07 Jun 2003 06:35:44 GMT
Server: Apache/1.3.27 (Unix) PHP/4.2.3 mod_ssl/2.8.12 OpenSSL/0.9.6b
X-Powered-By: PHP/4.2.3
Content-Type: text/html
X-Cache: MISS from serv1.mydomain.com
Connection: close
...
Thanks in advance,
chacrint
------------------------------
Date: 11 Jun 2003 18:22:40 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: LWP Post with incorrect response
Message-Id: <u9llw8y1en.fsf@wcl-l.bham.ac.uk>
chacrint@hotmail.com (Chacrint Charinthorn) writes:
> When I post to a php script running on apache 1.3.27 using LWP
> HTTP/1.1 but I had the response saying "HTTP/1.0 200 OK".
Hmmm.. strange but OK. I don't know anything about PHP - perhaps it
runs in NPH mode.
> I assume LWP will recognise it as "Internal Server Error".
Why would you assume this? It's perfectly valid for an HTTP response
to be a lower version of HTTP than the request. Not, of course, that
this has anything to do with Perl.
> What would be the fix for this problem?
I don't understand what the problem is. Is the problem your
assumption? If so the fix is to drop the assumption.
Or is your problem that LWP does not like a HTTP/1.0 response to an
HTTP/1.1 query? If this is the case then it is a bug in LWP and needs
to fixed/reported.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 11 Jun 2003 12:53:11 -0400
From: "Siddharth K. Joshi" <gt8306b@mail.gatech.edu>
Subject: manipulating files in Perl question.
Message-Id: <Pine.SOL.4.33.0306111245520.22212-100000@acmey.gatech.edu>
I have a scenario that's killing me:
I have automated the downloading of .png images that are genarated by a
.cgi program. The files are succesfully downloaded to my directory of
choice (on an XP box). Now, I'm seeking to "pipeline" those images to an
HTML document using the opendir command. Everything works syntactically,
save for the fact that upon printing to the HTML filehandle, it prints
literally what was specified rather than the data stored in the respective
variables containing the images, e.g.:
print HTML qq~<tr><td>$myimage</td></tr>~;
outputs "myimage.png" rather than the image @ myimage itself.
So, in sum, there's some problem in the referencing of the file.
Please help!
Thank You.
Siddharth K. Joshi
Georgia Institute of Technology, Atlanta Georgia, 30332
Email: gt8306b@prism.gatech.edu
------------------------------
Date: Wed, 11 Jun 2003 18:22:15 +0200
From: "Janek Schleicher" <bigj@kamelfreund.de>
Subject: Re: manipulating files in Perl question.
Message-Id: <pan.2003.06.11.16.18.57.805560@kamelfreund.de>
Siddharth K. Joshi wrote at Wed, 11 Jun 2003 12:53:11 -0400:
> I have automated the downloading of .png images that are genarated by a
> .cgi program. The files are succesfully downloaded to my directory of
> choice (on an XP box). Now, I'm seeking to "pipeline" those images to an
> HTML document using the opendir command. Everything works syntactically,
> save for the fact that upon printing to the HTML filehandle, it prints
> literally what was specified rather than the data stored in the respective
> variables containing the images, e.g.:
>
> print HTML qq~<tr><td>$myimage</td></tr>~;
>
> outputs "myimage.png" rather than the image @ myimage itself.
So it prints what is specified by the variable containing the image
_filename_. Just because a variable holds a filename, that doesn't mean it
knows that it is a file.
> So, in sum, there's some problem in the referencing of the file.
Erm yes, allthough it seems to be more a HTML problem instead of Perl
problem.
A first start (working local on your computer) might be:
print HTML qq~<tr><td><img src="$myimage"></td></tr>~;
Best Wishes,
Janek
------------------------------
Date: Wed, 11 Jun 2003 23:17:19 +0530
From: Thens <thens@nospam.com>
Subject: Re: manipulating files in Perl question.
Message-Id: <20030611231719.5a9b7133.thens@nospam.com>
On Wed, 11 Jun 2003 12:53:11 -0400
"Siddharth K. Joshi" <gt8306b@mail.gatech.edu> wrote:
>I have a scenario that's killing me:
>I have automated the downloading of .png images that are genarated by a
>.cgi program. The files are succesfully downloaded to my directory of
>choice (on an XP box). Now, I'm seeking to "pipeline" those images to an
>HTML document using the opendir command. Everything works syntactically,
>save for the fact that upon printing to the HTML filehandle, it prints
>literally what was specified rather than the data stored in the respective
>variables containing the images, e.g.:
It did what you asked it to do. You never asked it to print the contents of the file and that is not the way you embed imagges in HTML.
>print HTML qq~<tr><td>$myimage</td></tr>~;
>
>outputs "myimage.png" rather than the image @ myimage itself.
Your problem is with HTML and not Perl. If you want to display an image in the browser you will have to use the IMG tag.
print HTML qq~<tr><td><img src="$myimage" alt ="$myimage"></td></tr>~;
You may have to take care of prepending the location of the myimage based on whether you want to use absolute or relative path.
>So, in sum, there's some problem in the referencing of the file.
>
>Please help!
>
>Thank You.
>
>Siddharth K. Joshi
>Georgia Institute of Technology, Atlanta Georgia, 30332
>Email: gt8306b@prism.gatech.edu
>
------------------------------
Date: 11 Jun 2003 10:41:50 -0700
From: sanjaya_98@yahoo.com (Sanjaya Srivastava)
Subject: Memory Leak in certain perl modules
Message-Id: <edaaccd2.0306110941.12c331d0@posting.google.com>
Hi,
I have a perl code (perl 5.8) using MIME::Parser (MIME::Tools version
6.106) and perl log4perl modules on solaris 9.
The code goes in a loop to scan for E-mail and parser them.
I am seeing big time memory leaks on this. Any idea how to debug it or
any known problems with them
...Sanjaya
PS: Code Highlights. (I am a newbie, if there are any optimizations do
let me know)
The folders are about 1GB.
foreach $f (sort @folders)
{
@metadata = $imap->fetch($msgid,"(RFC822.HEADER)"); #to fetch it
@body = $imap->fetch($msgid,"(RFC822.TEXT)" ) ;
# Construct the Output Path Name
$fname = join ("/", $path,$f,$msg_count ) ;
mkpath("$fname",,,) ;
$tmp_var = join ("/", $fname,$msg_count );
$Meta_Name = join ("_", $tmp_var,"metadata" ) ;
$output_base = ($fname) ;
mkpath ($fname);
mkpath("$output_base/body\+attachments",,,) ;
$parser = new MIME::Parser;
$parser->output_dir("$output_base/body\+attachments");
$parser->extract_nested_messages(1);
$parser->filer->output_prefix("MSG_inbody");
$parser->extract_uuencode(1);
$parser->tmp_to_core(0) ;
.
.
.
.
}
--------- pmap output -------
00010000 1072K r-x-- /usr/local/bin/perl
0012A000 56K rwx-- /usr/local/bin/perl
00138000 2963856K rwx-- [ heap ]
FF010000 24K r-x-- /usr/lib/nss_files.so.1
FF026000 8K rwx-- /usr/lib/nss_files.so.1
FF030000 24K r-x-- /usr/lib/nss_nis.so.1
FF046000 8K rwx-- /usr/lib/nss_nis.so.1
FF050000 24K r-x--
/usr/local/lib/perl5/5.8.0/sun4-solaris/auto/Socket/Socket.so
FF064000 16K rwx--
/usr/local/lib/perl5/5.8.0/sun4-solaris/auto/Socket/Socket.so
FF070000 8K rwx-- [ anon ]
FF080000 16K r-x--
/usr/local/lib/perl5/5.8.0/sun4-solaris/auto/List/Util/Util.so
FF092000 8K rwx--
/usr/local/lib/perl5/5.8.0/sun4-solaris/auto/List/Util/Util.so
FF0A0000 32K r-x--
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/auto/Params/Validate/Validate.so
FF0B6000 8K rwx--
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/auto/Params/Validate/Validate.so
FF0C0000 8K r-x--
/usr/local/lib/perl5/5.8.0/sun4-solaris/auto/Sys/Hostname/Hostname.so
FF0D0000 8K rwx--
/usr/local/lib/perl5/5.8.0/sun4-solaris/auto/Sys/Hostname/Hostname.so
FF0E0000 16K r-x--
/usr/local/lib/perl5/5.8.0/sun4-solaris/auto/Time/HiRes/HiRes.so
FF0F2000 8K rwx--
/usr/local/lib/perl5/5.8.0/sun4-solaris/auto/Time/HiRes/HiRes.so
FF100000 8K r-x--
/usr/local/lib/perl5/5.8.0/sun4-solaris/auto/MIME/Base64/Base64.so
FF110000 8K rwx--
/usr/local/lib/perl5/5.8.0/sun4-solaris/auto/MIME/Base64/Base64.so
FF120000 32K r-x--
/usr/local/lib/perl5/5.8.0/sun4-solaris/auto/Data/Dumper/Dumper.so
FF136000 8K rwx--
/usr/local/lib/perl5/5.8.0/sun4-solaris/auto/Data/Dumper/Dumper.so
FF140000 8K r-x--
/usr/local/lib/perl5/5.8.0/sun4-solaris/auto/Cwd/Cwd.so
FF150000 8K rwx--
/usr/local/lib/perl5/5.8.0/sun4-solaris/auto/Cwd/Cwd.so
FF160000 16K r-x--
/usr/local/lib/perl5/5.8.0/sun4-solaris/auto/Fcntl/Fcntl.so
FF172000 8K rwx--
/usr/local/lib/perl5/5.8.0/sun4-solaris/auto/Fcntl/Fcntl.so
FF180000 680K r-x-- /usr/lib/libc.so.1
FF23A000 24K rwx-- /usr/lib/libc.so.1
FF240000 8K rwx-- /usr/lib/libc.so.1
FF250000 8K rwx-- [ anon ]
FF260000 16K r-x--
/usr/local/lib/perl5/5.8.0/sun4-solaris/auto/IO/IO.so
FF272000 8K rwx--
/usr/local/lib/perl5/5.8.0/sun4-solaris/auto/IO/IO.so
FF280000 568K r-x-- /usr/lib/libnsl.so.1
FF31E000 32K rwx-- /usr/lib/libnsl.so.1
FF326000 32K rwx-- /usr/lib/libnsl.so.1
FF340000 16K r-x-- /usr/platform/sun4u/lib/libc_psr.so.1
FF350000 16K r-x-- /usr/lib/libmp.so.2
FF364000 8K rwx-- /usr/lib/libmp.so.2
FF380000 40K r-x-- /usr/lib/libsocket.so.1
FF39A000 8K rwx-- /usr/lib/libsocket.so.1
FF3A0000 8K r-x-- /usr/lib/libdl.so.1
FF3B0000 8K rwx-- [ anon ]
FF3C0000 152K r-x-- /usr/lib/ld.so.1
FF3F6000 8K rwx-- /usr/lib/ld.so.1
FFBF8000 32K rw--- [ stack ]
total 2966968K
------------------------------
Date: Wed, 11 Jun 2003 09:29:25 -0400
From: Jim Agnew <jpagnew@vcu.edu>
Subject: Re: need the ascii set for arrow down
Message-Id: <3EE72EB5.8D77B5C5@vcu.edu>
also do a google search for shuford terminal page
that guy has tons of information, in addition to what was just posted...
Greg Miller wrote:
>
> On 10 Jun 2003 05:30:57 -0700, gerard.maloney@intel.com (gerrym)
> wrote:
>
> >I have aq ascii menu on a linux box which uses the arrow up and down
> >to nagivate the menus.
> >I want to automate it using Perl Expect.pm, but I cannot find the
> >character set I need to send.
>
> The arrow keys do not have ASCII codes, you need to emulate
> them based on the terminal you're using. This link should do it:
> http://www.geocities.com/SiliconValley/Campus/7071/vtcodes.html
>
> Greg Miller (gmiller at gregmiller dot net)
> http://www.gregmiller.net
> http://www.net-chess.com
--
"4,000 years ago I made a mistake." Elrond Half-Elven, in "Fellowship
of the Ring"
------------------------------
Date: Wed, 11 Jun 2003 16:38:16 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: need the ascii set for arrow down
Message-Id: <YVIFa.67$_J.1@nwrddc03.gnilink.net>
gerrym wrote:
[see subject line]
There are no "arrow up" or "arrow down" characters in ASCII.
Those characters are included in the e.g. the original DOS code pages
(CP-8??) and of course in Unicode.
jue
------------------------------
Date: 11 Jun 2003 11:09:41 -0400
From: jbrock@panix.com (John Brock)
Subject: Re: NEWBEE: Client-Server Timout implementation
Message-Id: <bc7gnl$lh5$1@panix1.panix.com>
I asked about this recently in this newsgroup: look for the thread
"How to I arrange for a socket connection to time out?". I ended
up using IO:Socket for dealing with socket connections and the
can_read() method of IO::Select for doing the timeouts. I didn't
need to use alarm() or interupts at all. Note that IO::Socket has
it's own timeout() method which only applies to connect() and
accept() (which wouldn't be covered by IO::Select since no filehandle
exists yet).
In article <a5f6b9a8.0306101308.3c9cc9c2@posting.google.com>,
Zack <uzmargov@yahoo.com> wrote:
>Hi,
>I am very new to perl and network programming, so bear with me please.
>I am trying to write the client-server app. that is going receive a
>request from a client,
>process the request and send the reply back. The request process is
>going to be some kind
>outside program that will be started from my server.
>At this moment I successfully implemented the communication part
>between client and server,
>however I would like to add the timeout signal. So, that if the
>outside process would
>take too much time (or would hang), the client would receive the
>timeout message and the
>server should kill the process. I wrote the ALRM signal handler
>however there are some problems,
>which I can't figure out. It seems that:
>1. Any command is running for as long as alarm($timeout) value is set
>(so if timeout is 15 seconds -- it takes 15 seconds for the child
>process to execute) and I want to return the reply to client
>immediately after process is done. For example if I set timeout for 20
>minutes, I do not want to wait for this time just to receive an
>acknowledgement (like "Hello", for instance)
>2. The server always logs the timeout message.
>
>
>Bellow is the code snippet for server:
>
>
>$SIG{'ALRM'} = 'Signal_Handler';
>
>%ERRORS = (
>error1 => {error_id => 1, error_msg => "Couldn't bind to port
>SERVER_PORT",},
>error2 => {error_id => 2,error_msg => "Couldn't listen on port
>$SERVER_PORT", },
>error3 => {error_id => 3, error_msg => "Can't fork a process",},
>error4 => {error_id => 4, error_msg => "Didn't understand the
>question!"},
>error5 => {error_id => 5, error_msg => "The process timeout
>occured!"},
>);
>
>%WARNINGS = (
>warning1 => {warning_id => 1,warning_msg => "Server is started on
>$SERVER_NAME:$SERVER_PORT",},
>warning2 => {warning_id => 2, warning_msg => "Caught the request from
>a Client:",},
>warning3 => {warning_id => 3, warning_msg => "Received request from
>Client:",},
>warning4 => {warning_id => 4, warning_msg => "Caught Signal:",},
>);
>
>MAIN: {
># some initialization code for sockets is skipped
>.................
>.................
>.................
>
># Accept and process connections
>while ($client_paddr = accept($CLIENT, $SERVER)) {
> select((select($SERVER), $| = 1)[0]); #enable command
>buffering
> # do something with the new Client connection
> {
> my ($port, $iaddr) = sockaddr_in($client_paddr);
> my $cname = gethostbyaddr($iaddr,AF_INET);
> Log_Warning($WARNINGS{warning2},$cname); #logs warning
> }
>
> # fork the child process for each connection
> FORK: {
> if ($pid = fork) {
> # parent here. Child process pid is available in $pid
> alarm($TIMEOUT);
> waitpid($pid,WNOHANG);
> alarm(0);
> }
> elsif (defined $pid) { #$pid is zero here if defined
> # child here parent process pid is available with getppid
> work_with_client($client_paddr, $CLIENT);
> }
> elsif ($! == EAGAIN) {
> # EAGAIN is the supposedly recoverable fork error
> sleep 5;
> redo FORK;
> }
> else {
> # Some weird fork error occurred
> die Log_Error($ERRORS{error3}, $!); #Logs error
> }
> close($CLIENT);
> } # End FORK.
>} # END while
>close($SERVER);
>} # END MAIN
>#####################################################################
>sub Signal_Handler {
> local($sig) = shift;
> my $msg;
>
> if ($sig eq "ALRM") {
> $msg = "ERROR: ID = " . $ERRORS{error5}->{error_id} . "; ";
> $msg .= "MESSAGE: " . $ERRORS{error5}->{error_msg}. "||||";
> Log_Warning($WARNINGS{warning4},$sig);
>
> Send_Reply($CLIENT, $msg);
> kill 9, $pid if $pid;
> }
>
>}
>#####################################################################
--
John Brock
jbrock@panix.com
------------------------------
Date: Wed, 11 Jun 2003 09:44:16 -0500
From: Dennis@NoSpam.com
Subject: Re: Perl Matrix Filter Module like in Excel?
Message-Id: <c1geevk7grtaiiald0dkc5pepk6ikn5c5j@4ax.com>
On 11 Jun 2003 04:41:51 GMT, Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
>[Please, in the future, put your reply _after_ the suitably trimmed
>text you reply to. This is the convention on this newsgroup, and
>usenet in general. Thank you]
>
Martien thanks for your reply and for your perl code. Your code will certainly
get me started in the right direction since I've coded only relatively simple
programs in perl. I greatly appreciate your going to the time and trouble of
giving me the coding direction to follow. While your code is above my current
level, I will do the required study and reading to master your methods.
<-----snip----->
>For the next time, instead of just asking for code, it might be nice
>if you showed us that you even tried to solve the problem yourself.
Unfortunately my code to solve this problem in Excel VBA and works only on Excel
spreadsheets. However VBA is very slow and as I said in previous post is
constrained to matrices of <=65000 rows. Whence to move to perl and my
questions. My original question asked if there was a perl "module" that did the
matrix filtering.
I've heard of APL...what is PDL?
Is compliled "exe" perl faster than interpreted perl?
Thanks again
Dennis
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 5106
***************************************