[6512] in Perl-Users-Digest
Perl-Users Digest, Issue: 137 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 18 07:10:34 1997
Date: Tue, 18 Mar 97 04:00:20 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 18 Mar 1997 Volume: 8 Number: 137
Today's topics:
Re: # Need help with perl script <rootbeer@teleport.com>
Re: [Q] for loop - making multiple arrays <OperaGhost@NetTown.com>
Re: [Q] for loop - making multiple arrays <wkuhn@uconect.net>
Re: [Q] for loop - making multiple arrays <OperaGhost@NetTown.com>
Re: Can 5.01 handle 4.0.1.8 scripts? (Greg Ward)
cgi perl script dies <seant1@airmail.net>
Has anyone had trouble with FIND2PERL? (Phil McMullin)
Re: Help <rootbeer@teleport.com>
Re: I must be misunderstanding packages... enlighten me <rootbeer@teleport.com>
Re: inheritance with hash variables <tchrist@mox.perl.com>
Re: Multiple substitutions (Eric Bohlman)
New Interface Between Perl and the NExS Spreadsheet (xess)
Re: Odd behavior with numbers <rootbeer@teleport.com>
Re: Perl 5 manual <seay@absyss.fr>
Re: Perl Browser (Greg Ward)
Re: Perl DB? (Mike Stok)
Re: Perl running on a VMSserver... (Wolfgang Reimann)
Re: Regex problem (Mike Stok)
Reward for NExS Spreadsheet Plug-Ins (xess)
Re: select statement in perl <seay@absyss.fr>
Re: Setting PATH env. variable problem... (Honza Pazdziora)
Re: simple glob fails under Linux (Greg Ward)
Re: Standard "Reaper" procedure doesn't work on Solaris <gilh@sysdep.elex.co.il>
Re: What is the best Perl book? (Greg Ward)
Re: What's wrong with "an email" (was: How to spam - le (Ross Howard)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 17 Mar 1997 20:34:20 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Ramon Mariano Jr <rmariano@u.washington.edu>
Subject: Re: # Need help with perl script
Message-Id: <Pine.GSO.3.96.970317203007.21931N-100000@kelly.teleport.com>
On Mon, 17 Mar 1997, Ramon Mariano Jr wrote:
> Subject: # Need help with perl script
Doesn't everybody? You should have said "Subject: Need help picking a good
subject line". At least then we would have known that you knew. :-)
(Seriously, there's a frequent posting in this group about choosing a good
subject line for your postings. Read it quickly, before somebody adds
yours as an example of what not to do. :-)
> What I'm trying to figure out is how to generate and assign a unique
> "serial number" for each person who submits a form.
Just keep the serial number in a file, and increment it as you go. I think
you could use the methods in Randal's fourth Web Techniques column, which
explains how to use flock() to avoid problems when multiple processes need
to modify one file. Hope this helps!
http://www.stonehenge.com/merlyn/WebTechniques/
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: Mon, 17 Mar 1997 22:50:33 +0000
From: Opera Ghost <OperaGhost@NetTown.com>
Subject: Re: [Q] for loop - making multiple arrays
Message-Id: <332DCAB9.7F3C8317@NetTown.com>
> I know this can't work but my concept is :
> for ($i=0;$i<20;$i++){
> @num$i = ("$string[$i]","$string[$i+1]");
> }
u need to use a reference (ref)
and [] for an anonymous array...
for ($i=0;$i<20;$i++){
$num[i] = ["$string[$i]","$string[$i+1]"];
}
but itd probably be better to use...
for $i (0..20) {
$num[$j++] = [$string[$i], $string[++$i]]; #note the j
}
so i guess ull wanna like print em out r something...
foreach (@num) {
print "$_->[0]...$_->[1]\n";
}
hope this helps. (untested)
--
<i>Opera Ghost</i>
<OperaGhost@NetTown.com>
------------------------------
Date: Mon, 17 Mar 1997 23:13:23 -0500
From: Bill Kuhn <wkuhn@uconect.net>
To: Benny Chee <chchee@hercules.iti.gov.sg>
Subject: Re: [Q] for loop - making multiple arrays
Message-Id: <332E1663.1A722232@uconect.net>
I think it is called symbolic references, but I am not sure.
Anyway, it goes something like this:
#!/usr/local/bin/perl -w
@string = (1..20) ;
for ($i=0;$i<20;$i += 2) {
$array_name = 'num' . $i ;
@{$array_name} = ($string[$i],$string[$i+1]) ;
push(@array_names,$array_name) ;
}
for (@array_names) {
print $_," contains: ",join(",",@{$_}),"\n" ;
}
By the way, note that $i += 2 (not $i++) is needed to get the effect you
were interested in.
-Bill
--
Bill Kuhn
Chief Developer
Wired Markets, Inc.
http://www.buyersindex.com
------------------------------
Date: Mon, 17 Mar 1997 23:37:01 +0000
From: Opera Ghost <OperaGhost@NetTown.com>
Subject: Re: [Q] for loop - making multiple arrays
Message-Id: <332DD59D.7A22F454@NetTown.com>
uh...i guess ull need perl5 too...
--
<i>Opera Ghost</i>
<OperaGhost@NetTown.com>
------------------------------
Date: 18 Mar 1997 03:56:08 GMT
From: greg@bic.mni.mcgill.ca (Greg Ward)
Subject: Re: Can 5.01 handle 4.0.1.8 scripts?
Message-Id: <5gl3oo$f7o@sifon.cc.mcgill.ca>
Marshall Pierce (piercem@col.hp.com) wrote:
: I thought 5.01 could correctly deal with 4.0 syntax? If this is not the
: case, is there a comprehensive list somewhere which identifies those
: things which would have to be changed. Even better, is there a conversion
: tool?
Are you referring to Perl versions here? If so, there's no such thing
as 5.01 -- perhaps you mean 5.001, which is pretty old. Most people
nowadays are using 5.003, and 5.004 is imminent.
Anyways, if you have any version of Perl 5 installed, or even
downloaded, take a look at the `perltraps' man page. Skim through the
sections on C, awk, and shell -- at the bottom are all the changes in
Perl 5 that can bite your old Perl 4 scripts. They're pretty minor,
out-of-the-way changes; the only thing I can recall ever having to
change is @ to \@ in double-quoted strings. (And I still make that
error... grumble, mutter...)
Here's a great algorithm for converting Perl 4 scripts to Perl 5:
perl5 -cw old_script
<fix errors>
<repeat until no errors>
Shouldn't take too many iterations, unless you didn't use to use -w and
now do (naughty!), or start adding `use strict' to old scripts,
or... oh, well, never mind, you can get as carried away as you like.
Greg
--
Greg Ward - Research Assistant greg@bic.mni.mcgill.ca
Brain Imaging Centre (WB201) voice: (514) 398-4965 (or 1996)
Montreal Neurological Institute fax: (514) 398-8948
Montreal, Quebec, Canada H3A 2B4
------------------------------
Date: Sun, 16 Mar 1997 09:51:52 -0600
From: Sean Thornberg <seant1@airmail.net>
Subject: cgi perl script dies
Message-Id: <332C1718.769B@airmail.net>
I have written a Script in perl that is run from cgi using apache. This
script takes a while to run and I dont want it being dependant on the
user being connected to the web server to staying alive. Currently
error/progress indication is output to a NPH html.page. What is the
best way to make it so the user clicks submit then it outputs the page
"Ok its running" then lets the script run while the user goes on to di
whatever. If i creat a child process or call an entire different script
will these die too? Any input would be greatly appreciated.
Sean
seant1@airmail.net
------------------------------
Date: Tue, 18 Mar 1997 06:54:45 GMT
From: philmcm@flash.net (Phil McMullin)
Subject: Has anyone had trouble with FIND2PERL?
Message-Id: <332e38e1.64297337@news.flash.net>
I have been a C/C++ programmer and have only recently started writing
perl scripts. I have been writting a tape backup program in perl 4.0
on a SCO Unix system. I used FIND2PERL to get started on the perl
code to write to the tape device.
If I run the following commands I do not get the same results.
1) find / -print -cpio /dev/rStp0
2)
a) find2perl / -print -cpio /dev/rStp0 > find.perl
b) find.perl
if after performing each of these operations I run:
3) cpio -itv < /dev/rStp0
I will see a list of the file transfered to tape only after 1) and
nothing after 2) b)
The FIND2PERL translator uses a SYS_WRITE command without verifing the
returned value. If I go in and modify the translated find.perl script
to check the returned value of the SYS_WRITE it will be NULL and $!
will have the error of "Bad file Number".
Does anyone have any advice (besides upgrading to perl 5.0...I will
try to convince my managment but it is not my descision) or
suggestions of how I can make this work.
I am currently using SYSTEM calls to do the CPIO and would like to
have the flexibility to whole job in perl.
Thanks in advance.
Phil McMullin
Senior Programmer Tandy Information Services.
------------------------------
Date: Mon, 17 Mar 1997 23:15:05 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Paul <paul@flinet.com>
Subject: Re: Help
Message-Id: <Pine.GSO.3.96.970317231131.21931Y-100000@kelly.teleport.com>
On Mon, 17 Mar 1997, Paul wrote:
> Subject: Help
Help! I need somebody. Help! Not just anybody...
Oops. Forgot where I was for a moment. But you should probably check out
the frequent posting in this newsgroup about choosing good subject lines.
> Looking for program to print on html page something like the
> following....
>
> test<br>test<br>test
You can probably take your existing script and add this line.
print "test<br>test<br>test\n";
Or is your question something different, such as how you can transform
some text into text with "<br>"'s in it? Hope this helps!
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: Mon, 17 Mar 1997 23:09:00 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Michael T Decerbo <mike@athena.mit.edu>
Subject: Re: I must be misunderstanding packages... enlighten me?
Message-Id: <Pine.GSO.3.96.970317225402.21931X-100000@kelly.teleport.com>
On 17 Mar 1997, Michael T Decerbo wrote:
> I wonder if someone can explain why it seems that my subroutines are
> being called in one package, but executed in package main. Perhaps I
> am missing something?
Probably. :-)
> I have an array of references to hashes, and I want to select a bunch of
> those hashes and put them in a new array. The way I want to select them
> is by evaluating an expression which uses the keys of each hash as a
> variable. In other words, if my expression reads
>
> ($id eq "foo")
>
> then I want to switch to a clean package, and set $id to
> $$hashref{'id'}. Then I can evaluate the expression above, and decide
> whether to push $hashref onto the array of selected hashrefs.
Huh? I didn't understand that. But if you want to select some but not all
elements of an array, that's what grep is good for. (Why do you want to
switch packages?)
[ snip a bunch of code ]
> If so, is there any way to define a subroutine to do what I was trying
> to do, namely, read the keys of a hash and set variables with the same
> name in any given package?
So, if your hash has keys jerry, elaine, george, and kramer, you want to
set $foo::jerry, $foo::elaine, $foo::george, and $foo::kramer? If that's
what you want, it can be done... But it's probably easier to make your own
(possibly anonymous) hash rather than messing around with packages and
symbol tables.
If you want to take another try at explaining what you're trying to do, I
might be able to take another try at explaining a different way to do it.
:-) Good luck!
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: 18 Mar 1997 05:39:32 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: inheritance with hash variables
Message-Id: <5gl9qk$50m$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
emcmilla@cps.msu.edu (Eric Marc Mcmillan) writes:
:I am trying to do inheritance using anonymous hash to hold
:instance variables.
Have you read the new perltoot man page?
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
"If ease of use is the highest goal, we should all be driving golf carts."
--Larry Wall
------------------------------
Date: Tue, 18 Mar 1997 06:22:05 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Multiple substitutions
Message-Id: <ebohlmanE7870t.7rF@netcom.com>
Michael Schuerig (uzs90z@uni-bonn.de) wrote:
: Believe it or not, but I have the Camel book, first & second edition.
: And I've even done some perl scripting recently. The thing is, I'm not
: using perl regularly, only every now and then, to solve a problem that I
: find it suitable for.
What has proved profitable to me is to read the posts on this group,
especially those that include source code, and look up every constuct
that I don't understand right off the bat. I have 23+ years of
programming experience and I still find such techniques helpful.
------------------------------
Date: 17 Mar 1997 23:32:55 -0500
From: xess@lys.vnet.net (xess)
Subject: New Interface Between Perl and the NExS Spreadsheet
Message-Id: <5gl5tn$euf@lys.vnet.net>
New Interface Between Perl and the NExS Spreadsheet
=======================================================
X Engineering Software Systems (XESS Corp.) announces the immediate
availability of a Perl plug-in for the NExS spreadsheet. The plug-in
provides an interface between Perl and the most commonly used NExS API
functions, including the ability to write new spreadsheet functions in Perl.
The NExS Perl plug-in was contributed by Remco Wouts. This plug-in is
provided to NExS spreadsheet users as source code (version 0.02). It
requires Perl 5.003 and the NExS 1.3.0 API library. It has been successfully
built on Linux 2.0.18, 2.0.28, Solaris 2.4, and HP/UX 9.05.
Those interested in the Perl plug-in can download it from www.xess.com. XESS
Corp. provides several plug-ins on an unsupported basis in the hopes that
they might be useful to users of the NExS spreadsheet. In addition, a free,
30-day version of the NExS spreadsheet and the new conNExions-BETA API can
also be downloaded for the HP/UX, AIX, Digital UNIX, SunOS, Solaris and
Linux platforms.
- 30 -
Previous news releases on the NExS Spreadsheet
-----------------------------------------------------------------------
* Simulated Annealing Plug-In for NExS Released
* Genetic Algorithm Plug-In for NExS Released
* Updated Tcl/Tk Interface for the NExS Spreadsheet
* Linear Programming Plug-In for NExS Released
* Academic Pricing for NExS Personal Edition Introduced
* Free 30-Day Trial Licenses for NExS
* NExS Version 1.3-BETA Available
o New Features in NExS 1.3-BETA
o Bug Fixes from NExS 1.2 to NExS 1.3-BETA
* Buy NExS for UNIX, Get NExS for Linux Free!
* NExS Version 1.2 Available
--
|| Information Director XESS Corp. (919) 387-0076 ||
|| info-nexs@xess.com 2608 Sweetgum Dr. (800) 549-9377 ||
|| http://www.xess.com Apex, NC 27502 USA FAX:(919) 387-1302 ||
------------------------------
Date: Mon, 17 Mar 1997 22:40:57 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: "Nicholas J. Leon" <nicholas@neko.binary9.net>
Subject: Re: Odd behavior with numbers
Message-Id: <Pine.GSO.3.96.970317223127.21931V-100000@kelly.teleport.com>
On 17 Mar 1997, Nicholas J. Leon wrote:
> I was doing some playing around and I found an interesting effect. It
> is demonstrated with this little snippet of code:
[ snipped example showed subtracting 0.1 from 0.1 and getting -2.8e-17 ]
I think you should sue. :-)
No computer can represent every real number. Your machine has had to round
off the values it uses. It had two values which were very close to (but
not both exactly at 0.1), and their difference was -2.8e-17, that's all.
There are ways to do this sort of thing on every computer.
Here's another thing to try. Add 1e20 to 1e-20, and store it into a
variable. Now subtract 1e20 from the variable. Did you get 1e-20? Probably
not, unless your machine has 40 digits of accuracy. (If it does, replace
20 with 40 in that example. :-)
Hope this helps!
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: Tue, 18 Mar 1997 12:13:21 +0000
From: Douglas Seay <seay@absyss.fr>
To: Dragos Alexandru <dralex@usa.net>
Subject: Re: Perl 5 manual
Message-Id: <332E86E1.1C0@absyss.fr>
Dragos Alexandru wrote:
>
> Hi!
>
> I've been looking for a good perl 5 manual. I would
> prefer it in HTML format. If you know where I can find
> it, please let me know.
>
> Please reply at: dralex@usa.net
>
> Thank you!
>
> Sincerely,
> Dragos
The man pages that come with perl are in pod format,
so you can use pod2html to convert them to html yourself.
doug seay
------------------------------
Date: 18 Mar 1997 03:50:30 GMT
From: greg@bic.mni.mcgill.ca (Greg Ward)
Subject: Re: Perl Browser
Message-Id: <5gl3e6$f7o@sifon.cc.mcgill.ca>
Rajat Aggarwal (rajat@cs.uh.edu) wrote:
: I am trying to write a perl program that will take a URL and retrieve
: the document from the URL. Also, it should retrieve all embedded
: documents within that specified URL.
This sort of thing is so easy with LWP (libwww-perl) that it's almost
eerie. You should *definitely* get LWP from your nearest CPAN site.
When you're done learning about LWP, you should then get the Tk package
(aka Tk/Perl) (latest version is 400.204 or thereabouts). The two
together are a pretty powerful combination; in fact, included with
Tk/Perl is a primitive web browser called tkweb. It's written in < 100
lines of code (although it pulls in a HELL of a lot of LWP and Tk
code!).
: I looked at the client/Server
: example in the Learning Perl book, but did not help much.
Waaaaay too low level. IMHO, this is severe masochism.
: I understand
: that http protocol just does anonymous ftps.
WRONG! HTTP and FTP are two entirely different protocols. Just because
most web clients allow you to access files in a similar way using either
protocol doesn't mean they're the same!
: I am not sure on how to implement this in Perl. Any suggestions on how
: to do this would be greatly appreciated.
As I said, you don't need to implement this -- LWP does it all for you.
Rejoice in the already invented wheel.
Greg
--
Greg Ward - Research Assistant greg@bic.mni.mcgill.ca
Brain Imaging Centre (WB201) voice: (514) 398-4965 (or 1996)
Montreal Neurological Institute fax: (514) 398-8948
Montreal, Quebec, Canada H3A 2B4
------------------------------
Date: 18 Mar 1997 10:02:37 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Perl DB?
Message-Id: <5glp7t$bbn@news-central.tiac.net>
In article <332DCAEC.2ED5@msmailgw.sdsmt.edu>,
Jon T. Day <jday@msmailgw.sdsmt.edu> wrote:
>Is there a perl database newsgroup?
>If anybody knows what the name of it is, I would appreciate
>it!
You might find some mailing lists in the links off the DBI link on
http://www.hermetica.com/ This contains information about the DBI/DBD
interface between perl 5 and various database backends - the DBI is an
abstract interface layer which sits in front of DBD drivers which actually
talk to the real databases. I know that there's a SYBPERL mailing list
which is active.
I know this doesn't answer your question, but I hope that it helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: Mon, 17 Mar 1997 21:50:18 GMT
From: reimann@merck.de (Wolfgang Reimann)
Subject: Re: Perl running on a VMSserver...
Message-Id: <332dbbd6.1501138@news>
On Mon, 10 Mar 1997 09:46:21 +0000, Alan Willis <a.willis@tay.ac.uk>
wrote:
> Hi all,
>
>hope someone out there can help me. I am looking for a way of returning
>the name of the current VMS node under Perl into a simple scalar
>variable. Obviously I cannot use something like
>
> $node=chop(`hostname`);
>
Have to mask the "$".
$UCX_Host = `write sys\$output f\$trnlnm("ucx\$inet_host")`;
print "UCX-Host: ", $UCX_Host ;
If you find a way to avoid the masking, i would be interested.
Wolfgang Reimann
Merck KGaA
------------------------------
Date: 18 Mar 1997 09:34:03 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Regex problem
Message-Id: <5glnib$afj@news-central.tiac.net>
In article <332DB810.457F@aur.alcatel.com>,
Bruno Pagis <pagib@aur.alcatel.com> wrote:
>Is there a way to express a number range in a regular
>expression. Say, I want to match a string like
>CCCC-[1-48] (means 4 C char followed by a - followed by a
>number between 1 and 48).
It depends on how much work you want to do and how much of a regex purist
you want to be.
You could look for 1 or 2 digit numbers and make sure that they are in the
range 1 .. 48 inclusive e.g.
if ($string =~ /^CCCC-(\d\d?)$/ and $1 >= 1 and $1 <= 48) {
...
}
or you could use a more explicit regex:
if ($string =~ /^ # beginning of string
CCCC- # followed by CCCC-
(?: # followed by
[1-9] # Single digit which is 1 .. 9 - 1 .. 9
| # or
[1-3]\d # 1 to 3 followed by any digit - 10 .. 39
| # or
4[0-8] # 4 followed by 0 to 8 - 40 .. 48
)
$ # and the end of string
/x) {
...
}
(or in older perls /^CCCC-([1-9]|[1-3]\d|4[0-8])$/ ...)
You might want to use 0?[1-9] for the 1 .. 9 range if you permit a leading
0.
Jeffrey Freidl has recently had his book 'Mastering Regular Expressions'
published by O'Reilley which is an invaluable aid in understanding
regexes.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: 17 Mar 1997 23:39:56 -0500
From: xess@lys.vnet.net (xess)
Subject: Reward for NExS Spreadsheet Plug-Ins
Message-Id: <5gl6as$fm9@lys.vnet.net>
XESS Corp. Encourages Third-Party Plug-Ins for the NExS Spreadsheet
============================================================================
X Engineering Software Systems (XESS Corp.) announces the initiation of a
program to encourage the creation of plug-ins for the NExS spreadsheet by
third-parties. Henceforth, the author of any code that XESS Corp. chooses to
publish on its Web site will receive a free license for the NExS Personal
Edition spreadsheet.
NExS Product Manager Dave Vanden Bout stated:
Many of our customers are interfacing NExS to other tools in
unique ways. We want to encourage them to share their creations
with others. We'll admit that a free copy of NExS is hardly
adequate compensation for the work that goes into many of these
plug-ins, but a small reward is better than no reward. And we are
not limiting this program to just plug-ins: anyone who has a NExS
spreadsheet for an interesting application or a document
explaining how to use NExS in a particular area is eligible for
this program. Just e-mail it to us. If we use it, we'll send you a
free NExS license.
Those interested in the various plug-ins currently available for the NExS
spreadsheet can check them out at www.xess.com. XESS Corp. provides these
plug-ins on an unsupported basis in the hopes that they might be useful to
users of the NExS spreadsheet. In addition, a free, 30-day version of the
NExS spreadsheet and the new conNExions-BETA API can also be downloaded for
the HP/UX, AIX, Digital UNIX, SunOS, Solaris and Linux platforms.
- 30 -
Previous news releases on the NExS Spreadsheet
-----------------------------------------------------------------------
* New Interface Between Perl and the NExS Spreadsheet
* Simulated Annealing Plug-In for NExS Released
* Genetic Algorithm Plug-In for NExS Released
* Updated Tcl/Tk Interface for the NExS Spreadsheet
* Linear Programming Plug-In for NExS Released
* Academic Pricing for NExS Personal Edition Introduced
* Free 30-Day Trial Licenses for NExS
* NExS Version 1.3-BETA Available
o New Features in NExS 1.3-BETA
o Bug Fixes from NExS 1.2 to NExS 1.3-BETA
* Buy NExS for UNIX, Get NExS for Linux Free!
* NExS Version 1.2 Available
--
|| Information Director XESS Corp. (919) 387-0076 ||
|| info-nexs@xess.com 2608 Sweetgum Dr. (800) 549-9377 ||
|| http://www.xess.com Apex, NC 27502 USA FAX:(919) 387-1302 ||
------------------------------
Date: Tue, 18 Mar 1997 12:11:16 +0000
From: Douglas Seay <seay@absyss.fr>
To: Peter Rozario <prozario@easyway.net>
Subject: Re: select statement in perl
Message-Id: <332E8664.555@absyss.fr>
Peter Rozario wrote:
>
> Can someone please help me with select(2) system call?
> Basically, I'm trying to do some socket programming. I need to
> write some info to the socket & and then read a response back.
> That part I've managed. But I need to make my program to be
> little more fault tolerant. I want to use `select`, to abort the
> read and write operation to the socket, if it takes more than a
> $TIMEOUT value, (say 10 sec).
> Say my socket handle is calledSOCKET ...
> then how do i fill in the values for select call, which
> looks something like select(RBITS,WBITS,EBITS,TIMEOUT).
> And when do i call the select function, and the write/read to
> the socket. If timeout does occur, how do i know that?
> Thanks in advance, for any suggestions.
You should read the fine man page. Yet me repeat that,
READ THE MAN PAGE. It was written to be used in situations
like this. It has sample code. The cryptic sequence
is "man perlfunc" and then look for select(). The
man page includes the following snippet
The usual idiom is:
($nfound,$timeleft) =
select($rout=$rin, $wout=$win, $eout=$ein, $timeout);
After doing this, just check $nfound. If it is 0,
then no handles are ready (aka-timeout). Non-0 value
means that at least one handle is ready.
After reading the select entry in "perlfunc", maybe you
might want to look at "perlipc" as it has lots of examples
and descriptions using easy to understand words.
doug seay
------------------------------
Date: Tue, 18 Mar 1997 11:19:12 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Setting PATH env. variable problem...
Message-Id: <adelton.858683952@aisa.fi.muni.cz>
ttran@simba.micro.ti.com (Tan B Tran) writes:
> Hi,
>
> I run into a strange problem which has gotten me stumped:
>
> I have a perl code which forks into a child process. Inside this child process, I add one path
> into the $ENV{PATH} env. variable by concatenating it (ie. $ENV{PATH} = "$ENV{PATH}:$newpath";)
> I have no problem with this command. However, when this process in turns forks another child,
> I do not see this new path reflected because when I run a which command, it returns an error
> message saying such and such a command is not found in the various path directories in $ENV{PATH}.
>
> Has anyone seen this problem before ?
I made a test script. Does this work for you?
$ perl
$ENV{PATH} = '/usr/bsd';
print `which date`, "\n";
$ENV{PATH} .= ':/sbin';
unless (fork())
{
print `which date`, "\n";
unless (fork())
{
print `which date`, "\n";
}
}
wait;
__END__
The output is:
date not in /usr/bsd
/sbin/date
/sbin/date
so the $PATH variable is respected.
Hope this helps.
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
I can take or leave it if I please
------------------------------------------------------------------------
------------------------------
Date: 18 Mar 1997 04:01:59 GMT
From: greg@bic.mni.mcgill.ca (Greg Ward)
Subject: Re: simple glob fails under Linux
Message-Id: <5gl43n$f7o@sifon.cc.mcgill.ca>
Sussex Silversmiths (sussex@interlog.com) wrote:
: I can't get directory globbing to work under the August 96 slackware
: distribution of Linux 2.0, Perl 5.003. The following expression yields no
: output in a rather full directory:
: while(<*>){print "name: $_ \n";}
: echo * works in the shell (bash) and when run from perl as:
: open(FOO, "echo * ... while(<FOO>) ...
: and readdir works properly, so I can work around this. The program using the
: globbing works properly on a BSD system I tried. What needs to be upgraded?
: Linux or Perl or both.
Do you have csh (or tcsh) installed? Lack of csh used to be a
problem with some Linux distributions. What distribution are you using?
Anyways, IMHO the glob thing is one of Perl's ugliest misfeatures.
Using opendir/readdir is far more elegant, powerful, flexible, and
efficient. (Just don't forget to closedir!)
Greg
--
Greg Ward - Research Assistant greg@bic.mni.mcgill.ca
Brain Imaging Centre (WB201) voice: (514) 398-4965 (or 1996)
Montreal Neurological Institute fax: (514) 398-8948
Montreal, Quebec, Canada H3A 2B4
------------------------------
Date: Sun, 16 Mar 1997 17:45:19 GMT
From: Gil Hirsch <gilh@sysdep.elex.co.il>
Subject: Re: Standard "Reaper" procedure doesn't work on Solaris.
Message-Id: <332C31AF.3BA5@sysdep.elex.co.il>
Gideon King wrote:
>
> I am using the standard "reaper" from the perlipc documentation to clean
> up child processes, and I find that it doesn't work under Solaris. The
> test can be reproduced using the standard code from the perlipc page. My
> test platforms have been:
> NeXTXTEP 3.3, Perl 5.002 - Works
> OpenStep 4.1, Perl 5.002 - Works
> Solaris, Perl 5.002 - doesn't work
> Solaris, Perl 5.003 - doesn't work
>
> The offending code is:
> sub REAPER
> {
> $SIG{CHLD} = \&REAPER; # loathe sysV
> $waitedpid = wait;
> logmsg "reaped $waitedpid" . ($? ? " with exit $?" : '');
> }
> $SIG{CHLD} = \&REAPER;
>
> The observed behaviour is:
> First time it's called, it works, but the server reports two "reaped"
> messages, the second one having a pid of -1.
> The second time, the client thinks it has connected, but the server
> doesn't register anything, and the client reports "uninitialized value"
> for anything that should be returned from the server.
> Third time, it works.
> Fourth time, it doesn't, etc.
>
> If I comment out the line
> $SIG{CHLD} = \&REAPER; # loathe sysV
> It doesn't give me the extra reaped message, but still doesn't work
> properly.
>
> If I comment it all out, it always works, but I get zombie processes lying
> around.
>
> Does anyone have any suggestions about how to solve this problem?
>
> Thanks.
Well, try this first:
sub REAPER {
$waitedpid = wait;
$SIG{CHLD} = \&REAPER; # loathe sysV
logmsg "reaped $waitedpid" . ($? ? " with exit $?" : '');
}
(notice how the order has changed...) - works on hp-ux with 5.001/2, but
not
with 5.003 (maybe a bug...).
Instead of fighting your way with SIGCHLD signals, try this double-fork
trick:
unless ($pid = fork) {
#child does nothing but fork:
unless (fork) {
#grandson can take his time....
sleep 30;
exit 0;
}
exit 0;
}
#child exits quickly, so waiting isn't expensive:
waitpid($pid,0);
The child (first fork) finishes very quickly, since all it does is fork
yet
another child (grandson), so waiting on it is hardly time-consuming.
After
the child is dead, grandson is left without a parent, and theoretically
should turn into a zombie when it exits... B U T... a process without a
parent, becomes an orphan, but no-one is really an orphan in UNIX
(except INIT, pid'd 1), and so, an orphan process receives the parent
pid 1 (INIT), and since INIT hasn't got the patience (or time) to wait()
for his orphans, when they exit - they simply die... and don't become
zombies!
To make a long story short - double forking allows you to run multiple
child
processes, in parallel, without accumulating zombies.
Hope this helps...
Gil.
--
------------------------------------------------------
Gil Hirsch E-Mail: gilh@sysdep.elex.co.il
Telrad Communications gilh@inter.net.il
------------------------------------------------------
------------------------------
Date: 18 Mar 1997 03:59:33 GMT
From: greg@bic.mni.mcgill.ca (Greg Ward)
Subject: Re: What is the best Perl book?
Message-Id: <5gl3v5$f7o@sifon.cc.mcgill.ca>
Brian Ling (gt2666b@prism.gatech.edu) wrote:
: I need to get a book on Perl and I wanted to know which one was the best.
: Thanks in advance.
For the experienced Unix hacker who needs to pick up Perl, and is not
afraid of being assaulted with all the gory details at once, get
*Programming Perl, 2nd ed.* by Larry Wall, Tom Christiansen, and Randal
Schwartz. Books on programming simply do not come any better than this.
For the rest of the world, you can't go wrong with Randal Schwartz's
*Learning Perl*. It's a much gentler introduction.
Both are published by O'Reilly & Associates and should be availble at
any decent computer bookstore; or see http://www.ora.com/.
Greg
--
Greg Ward - Research Assistant greg@bic.mni.mcgill.ca
Brain Imaging Centre (WB201) voice: (514) 398-4965 (or 1996)
Montreal Neurological Institute fax: (514) 398-8948
Montreal, Quebec, Canada H3A 2B4
------------------------------
Date: Mon, 17 Mar 1997 19:41:54 GMT
From: ross@valnet.es (Ross Howard)
Subject: Re: What's wrong with "an email" (was: How to spam - legitimately)
Message-Id: <5gk768$bl2$1@diana.ibernet.es>
Philip Eden <philip@weather.demon.co.uk> wrote:
>ross@valnet.es (Ross Howard) wrote:
>>Philip Eden <philip@weather.demon.co.uk> wrote:
><snip>
>>>Could it be that The Times is now a shameless hussey of a newspaper,
>>>populated by sub-literate hacks, pandering to the whim of the
>>>paper's proprietor? (Murdoch, R., for anyone who wonders). But
>>>then I do write for a competitor.
>>
>>The one whose style sheet neglects to remind staff writers that
>>"hussy" is written without an *e*, it would seem.
>>
>>(It's the a.u.e. equivalent of Murphy's Law: "The vehemence of your
>>bitching about the language proficiency of others is in direct
>>proportion to the probability that in so doing you will royally screw
>>up and make a right prat of yourself.")
>>
>>Ross Howard
>>
>>Ross Howard
>>
>Then it's a good job I an neither vehement nor a bitch. You're a
>harsh man Mr Howard. And so is your namesake.
I'm not harsh, Mr. Eden, and believe me when I tell you it was said
with exactly the same kind of smile (that you can't type around here
without all hell breaking loose) that you had on your face when
grouping many of the excellent professionals who have the misfortune
to have had their papers swallowed Murdoch as "sub-literate hacks"
(that's bitching -- albeit in the sub-category, joshing in
good-natured, comerades-in-arms-type professional rivalry). You can't
get away with both that and "hussey" in the same post. One, I'll buy,
but both?
And I have a namesake here?
Ross Howard
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 137
*************************************