[12779] in Perl-Users-Digest
Perl-Users Digest, Issue: 189 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 19 13:07:33 1999
Date: Mon, 19 Jul 1999 10:05:21 -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 Mon, 19 Jul 1999 Volume: 9 Number: 189
Today's topics:
Re: 2-d array sorting (Sami Rosenblad)
Re: 2-d array sorting (Larry Rosler)
Re: 2-d array sorting (Michel Dalle)
Access MSAccess database at Unix? <c8133594@comp.polyu.edu.hk>
almost a perl question <nead@neadwerx.com>
Re: CGI database question <mlopresti@bigfoot.com>
Re: CGI database question <gellyfish@gellyfish.com>
Re: CGI database question <mlopresti@bigfoot.com>
Re: CGI database question <rhrh@hotmail.com>
Re: Closing Web Browser Connection on Lengthy Processes bane_dewitt@my-deja.com
Re: getting the virtual host info... <pleduc@ca.ibm.com>
Re: hashes and arrays... <blair.kissel@mts.mb.ca>
How do I do a date string (ala from strftime) conversio (Gabriel Russell)
Re: Local CGI with ActivePerl <flavell@mail.cern.ch>
Network disk <michael.k@sapiens.com>
newbie: how to avoid croak lotharhaensler@my-deja.com
Re: newbie: how to avoid croak (Bart Lateur)
op/stat.t test 4 failure (Rand Bamberg)
Re: Padding numbers with 0's (Jason Stapels)
Perl deamon <paolo.noya@inferentia.it>
PGP and Perl <me@wavy.org>
PID of process created by "system" <lazar@micro.ti.com>
Re: PID of process created by "system" <lazar@micro.ti.com>
Re: PID of process created by "system" (Lack Mr G M)
Re: Q:Script too long, session times out?? danmex@my-deja.com
Re: reading from a file and THEN! <gellyfish@gellyfish.com>
Re: reading from a file and THEN! (Larry Rosler)
still buggy... <jgc5a@j2.mail.virginia.edu>
Re: still buggy... <aperrin@mcmahon.qal.berkeley.edu>
Re: still buggy... <ckaiser@stockholm.ptloma.edu>
Re: still buggy... <jgc5a@j2.mail.virginia.edu>
Re: still buggy... <jgc5a@j2.mail.virginia.edu>
Re: TPJ/Earthweb junk mail? (brian d foy)
using multiple array fields in foreach (Steve .)
which release supports qr/(?{...})/ <prlawrence@lehigh.edu>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 19 Jul 1999 17:51:03 +0300
From: blade@leela.janton.fi (Sami Rosenblad)
Subject: Re: 2-d array sorting
Message-Id: <blade-1907991751030001@durandal.janton.fi>
In article <3793197E.75A200FC@Infineon.com>, Vorname Nachname
<Vorname.Nachname@Infineon.com> wrote:
> I am quite new with Perl. I have a 2-dimensional array (list of lists)
> and I want to sort its lines by the first and the third column of every
> line, with first column having priority to third. To make it more clear:
>
> ( [6,1,1], [2,4,8], [2,9,1]) should become ( [2,9,1], [2,4,8], [6,1,1])
>
> Thanks for your help
perldoc -f sort
This does what you wanted:
#!/usr/bin/perl -w
my @lol = ( [6,1,1], [2,4,8], [2,9,1] );
my @sorted = sort { $a->[0] <=> $b->[0] ||
$a->[2] <=> $b->[2] } @lol;
--
Sami Rosenblad -- blade@leela.janton.fi -- running linux since 1999
------------------------------
Date: Mon, 19 Jul 1999 08:14:33 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: 2-d array sorting
Message-Id: <MPG.11fce0b5ccffa082989cf7@nntp.hpl.hp.com>
In article <37932317.28033980@news.uniplus.ch> on Mon, 19 Jul 1999
13:09:06 GMT, Andreas Fehr <backwards.saerdna@srm.hc> says...
> On Mon, 19 Jul 1999 14:26:38 +0200, Vorname Nachname
> >I am quite new with Perl. I have a 2-dimensional array (list of lists)
> >and I want to sort its lines by the first and the third column of every
> >line, with first column having priority to third. To make it more clear:
> >
> >( [6,1,1], [2,4,8], [2,9,1]) should become ( [2,9,1], [2,4,8], [6,1,1])
> >
>
> I found 'perldoc -f sort' very helpfull
Elementary-school level.
perlfaq4: "How do I sort an array by (anything)"
High-school level.
http://www.perl.com/CPAN/doc/FMTEYEWTK/sort.html
Undergraduate level.
http://www.hpl.hp.com/personal/Larry_Rosler/sort
Graduate-school level.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 19 Jul 1999 15:22:39 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: 2-d array sorting
Message-Id: <7mvfvn$8ke$1@news.mch.sbs.de>
In article <3793197E.75A200FC@Infineon.com>, Vorname Nachname <Vorname.Nachname@Infineon.com> wrote:
>
>I am quite new with Perl. I have a 2-dimensional array (list of lists)
>and I want to sort its lines by the first and the third column of every
>line, with first column having priority to third. To make it more clear:
>
>( [6,1,1], [2,4,8], [2,9,1]) should become ( [2,9,1], [2,4,8], [6,1,1])
>
>Thanks for your help
The following should do the trick, I think :
#!/usr/local/bin/perl -w
use strict;
my(@list,$out);
while (<DATA>) {
chomp;
push(@list, [ split ]);
}
foreach (sort {$a->[0] <=> $b->[0] || $a->[2] <=> $b->[2]} @list) {
print join(' ', @$_) . "\n";
# for testing only
if ($#$_ > 2) {
$out = join('',map(chr($_), @$_));
open(FILE,"$out|") || die "can't $out : $!";
while (<FILE>) {
print;
}
close(FILE);
}
}
exit;
__DATA__
112 101 114 108 100 111 99 32 45 102 32 115 111 114 116
6 1 1
2 4 8
2 9 1
There are probably more efficient ways to do it, though :-)
Michel.
------------------------------
Date: Tue, 20 Jul 1999 00:15:50 +0800
From: Carfield Yim <c8133594@comp.polyu.edu.hk>
Subject: Access MSAccess database at Unix?
Message-Id: <37934F36.B92B6C0E@comp.polyu.edu.hk>
I am a newbie of using perl to control database,
I wonder, can I control a access database (*.mdb) in unix?
I don't need to use the *.mdb at unix, I can download to windows to use.
But I hope that the user can change the content of a database at unix
server.
Using access in because the one will access database is only know
access.
Can any one help me?
------------------------------
Date: 19 Jul 1999 15:29:26 GMT
From: "Nick Downey" <nead@neadwerx.com>
Subject: almost a perl question
Message-Id: <01bed1fb$a797c310$53343d80@r52h83>
My apologies if this post is miss-placed, but I feel that there are people
here who have the knowledge and experience to answer this question. Perhaps
you could recommend where to post ?
Approach one: write a (extensive) perl script to generate and process an
html form:
if( $cgi->param() ) {
process form
}
else {
print form
}
Approach two: write an html page with form tags and a perl script to
process it.
I have currently used approach one, and the perl script is about 400 lines
or so. Honestly I personally don't care about the length, but I want to be
'industry' compliant, if there is such a thing. i.e. Am I going to kill my
web server this way ?
Thanks very much.
------------------------------
Date: Mon, 19 Jul 1999 10:55:00 -0400
From: matt <mlopresti@bigfoot.com>
Subject: Re: CGI database question
Message-Id: <37933C44.61D4593A@bigfoot.com>
I think this is a valid question, if you would like to call me a hacker then so-be-it. I
use Perl on a daily basis, using it as a reporting tool with sql Anyhwhere. I have
decide to broden my use of Perl and begin to develope certain db functions that I need
for the web. To call me hacker is not totally true, to call me curious is more the
truth, one must practice to become as good as some of the "experts" in here. To have
questions answered in a sarcastic manner is not helping people to become interested in
Perl. If you are trying to frustrate people enough to go and use another programming
language then keep it up, I know the power of Perl and I'm not going anywhere.
matt wrote:
> Thanks for the response, and yes db->row() is a type-o. I expect this to create a
> drop down option list for instance above this statement is the beginning of the form
> and the static data needed to create the form, then an sql statement gets the
> requested data from the db and updates $db_field, the code inside of the while loop
> creates the option drop down list. Does this sound like it makes sense? I am
> basically trying to create an option box on the fly.
>
> The error I get from the Apache server web server is: premature end of script
> header.
> Now, when I take out the <FORM .............>, the <SELECT.............>, and
> </FORM>, </SELECT>. I get no errors and I get data.
>
> -Matt
>
> Abigail wrote:
>
> > matt (loprestim@toad.net) wrote on MMCXLVII September MCMXCIII in
> > <URL:news:37925280.D6ED0793@toad.net>:
> > ## I am trying to use CGI to access an access database, and what I want to
> > ## do is retrieve values from the database, and populate a drop down
> > ## selection list like:
> > ##
> > ## <SELECT NAME="name">
> > ## while (db->row){
> > ## print "<OPTION>$db_field";
> > ## }
> > ## </SELECT>
> > ##
> > ## This does not work. Are there other ways to do this without writing out
> > ## top a file?
> >
> > "This does not work"... that's a very broad statement. Assuming the missing
> > $ in front of 'db' is a typo, what do you expect to happen? What happened?
> > How is $db_field for instance updated?
> >
> > Abigail
> > --
> > echo "==== ======= ==== ======"|perl -pes/=/J/|perl -pes/==/us/|perl -pes/=/t/\
> > |perl -pes/=/A/|perl -pes/=/n/|perl -pes/=/o/|perl -pes/==/th/|perl -pes/=/e/\
> > |perl -pes/=/r/|perl -pes/=/P/|perl -pes/=/e/|perl -pes/==/rl/|perl -pes/=/H/\
> > |perl -pes/=/a/|perl -pes/=/c/|perl -pes/=/k/|perl -pes/==/er/|perl -pes/=/./;
> >
> > -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
> > http://www.newsfeeds.com The Largest Usenet Servers in the World!
> > ------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 19 Jul 1999 16:06:51 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: CGI database question
Message-Id: <37933f0b@newsread3.dircon.co.uk>
matt <loprestim@toad.net> wrote:
> I am trying to use CGI to access an access database, and what I want to
> do is retrieve values from the database, and populate a drop down
> selection list like:
>
> <SELECT NAME="name">
> while (db->row){
> print "<OPTION>$db_field";
> }
> </SELECT>
>
Er, this is not valid Perl code please can you post the actual code you
are using.
/J\
--
"Over the years I've always had Max Factor in my box" - Tina Earnshaw,
Chief Make-Up Artist, Titanic
------------------------------
Date: Mon, 19 Jul 1999 11:39:33 -0400
From: matt <mlopresti@bigfoot.com>
Subject: Re: CGI database question
Message-Id: <379346B5.EFCBE867@bigfoot.com>
Thanks Johnathan,
Here's the actual code:
#!/perl/bin/perl #required for apache
use Win32::ODBC;
print "Content-type: text/html\n\n";
print "<FORM ...........>";
print "<SELECT NAME= xxxxxxxx>";
$DSN ="xxxxxxx";
if (!($db = new Win32::ODBC("DSN=xxxxxxxx;"))) {
print STDOUT "Error connecting to $DSN\n";
print STDOUT "Error: " . Win32::ODBC::Error() . "\n"; exit;
}
$SqlStatement = "SELECT company_dtl.company_name
FROM company_dtl;";
if ($db->Sql($SqlStatement)) {
print "SQL failed- Cannot find sxxxxx.company_dtl\n";
print "Error: ". $db->Error(). "\n"; $db->Close();
exit;
}
@FieldNames = $db->FieldNames();
while ($db -> FetchRow()) {
undef %Data;
%Data = $db->DataHash();
$co_name = $Data{$FieldNames[0]};
print "<option>$co_name";
}
$db->Close();
print "</FORM>";
print "</SELECT>";
Jonathan Stowe wrote:
> matt <loprestim@toad.net> wrote:
> > I am trying to use CGI to access an access database, and what I want to
> > do is retrieve values from the database, and populate a drop down
> > selection list like:
> >
> > <SELECT NAME="name">
> > while (db->row){
> > print "<OPTION>$db_field";
> > }
> > </SELECT>
> >
>
> Er, this is not valid Perl code please can you post the actual code you
> are using.
>
> /J\
> --
> "Over the years I've always had Max Factor in my box" - Tina Earnshaw,
> Chief Make-Up Artist, Titanic
------------------------------
Date: Mon, 19 Jul 1999 16:15:47 +0100
From: Richard H <rhrh@hotmail.com>
To: matt <loprestim@toad.net>
Subject: Re: CGI database question
Message-Id: <37934123.A5ACC28A@hotmail.com>
matt wrote:
>
> I am trying to use CGI to access an access database, and what I want to
> do is retrieve values from the database, and populate a drop down
> selection list like:
>
> <SELECT NAME="name">
> while (db->row){
> print "<OPTION>$db_field";
> }
> </SELECT>
>
> This does not work. Are there other ways to do this without writing out
> top a file?
> Any ideas?
>
> Thanks in advance,
> -Matt
> mlopresti@bigfoot.com
There's no reason why the above shouldn't work and I've done it, though
its not an ideal way of doing it, what happens to your HTML page if the
cursor fails for some reason??
The code you have posted will not be the sole source of the problem as
these bits have nothing to do with headers. Post other relevant bits.
Richard H
------------------------------
Date: Mon, 19 Jul 1999 16:03:11 GMT
From: bane_dewitt@my-deja.com
Subject: Re: Closing Web Browser Connection on Lengthy Processes
Message-Id: <7mvi7l$vv1$1@nnrp1.deja.com>
In article <7mv6fr$3kt$1@news1.Radix.Net>,
revjack <revjack@radix.net> wrote:
> See Randal's Web Techniques column with regard to this:
>
> http://www.stonehenge.com/merlyn/WebTechniques/col20.html
BINGO. That's what I was looking for. Thanks.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Mon, 19 Jul 1999 12:43:29 -0400
From: Paul Leduc <pleduc@ca.ibm.com>
Subject: Re: getting the virtual host info...
Message-Id: <379355B1.23DC659@ca.ibm.com>
Abigail wrote:
>
> But, but, but, the other x is different! Why do you expect 'www.xxx.com'
> and 'www.xxx.com' to be different?
>
> I don't see a problem, except that this is better asked in a different
> group.
>
The problem has been solved by a previous poster.. who suggested getting the port
using the environment variable $ENV{SERVER_PORT}
------------------------------
Date: Mon, 19 Jul 1999 12:01:52 -0500
From: Blair Kissel <blair.kissel@mts.mb.ca>
Subject: Re: hashes and arrays...
Message-Id: <379359FF.B37C1A72@mts.mb.ca>
Did you ever find a solution to your problem? I have almost the same
question and I was wondering if you solved yours. I need to compare a hash
value (a string) to a string to see if they are the same. if($value{key}
eq "string")
Thanks,
Blair Kissel
James Lovette wrote:
> how would I compare each element in an array to see if it matched any
> hash key?
>
> %dates = ("time1", "June 3 - June 10",
> "time2", "June 10 - June 17",
> "time3", "June 17 - June 24",
> "time4", "June 24 - July 1",
> "time5", "June 1 - July 8",
> "time6", "July 8 - July 15",
> "time7", "July 18 - July 22",
> "time8", "July 22 - July 29",
> "time9", "July 29 - August 5",
> "time10", "August 5 - August 12",
> "time11", "August 12 - August 19",
> "time12", "August 19 - August 26",
> "time13", "August 26 - September 2");
>
> is my hash, and the keys are possible values in an array (depending on
> what the user choses). how can I compare the two, so that i can
> tell if $value[5] = "time11" that $value[5] is also equal to "August 12
> - August 19"? thanks for the help.
------------------------------
Date: Mon, 19 Jul 1999 16:28:11 GMT
From: grussell@hushmail.com (Gabriel Russell)
Subject: How do I do a date string (ala from strftime) conversion to time_t?
Message-Id: <3793247c.508741461@news.supernews.com>
How do I do a date string (ala strftime) to time (ala gmtime)
conversion? I would guess that this is a faq but was unable to find
it.
Gabriel
------------------------------
Date: Mon, 19 Jul 1999 16:00:50 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Local CGI with ActivePerl
Message-Id: <Pine.HPP.3.95a.990719155142.22465J-100000@hpplus03.cern.ch>
On Mon, 19 Jul 1999, Floyd Morrissette wrote:
> I agree and can understand that these same people are frustrated because
> of having to answer the same questions over and over again especially
> when the answers are everywhere to be found. But I don't understand why,
> if they are tired of answering such questions, do they answer at all.
Because they know from experience that others will step right up and
provide bogus answers to the frequently asked questions. So, some of
them think "too bad, anyone who asks FAQs deserves to get bogus
answers". You don't hear from them. And that's what you're asking for.
Some of them think "what a pity, misleading newbies like that, I'd
better wade in". You're asking them to stop doing that.
> Thanks for your support.
If you stick with Perl, you'll come to realise that it was a kind
of "support" that does you no good whatever.
If you don't stick with Perl, then it hardly matters.
In fact, if you don't soon decide to align yourself with the usual
usenet way of doing things, you'll land up in the killfiles of all the
people who could help you. And no, I'm _not_ talking about me. I come
here to learn too, and I get impatient with a semi-infinite supply of
morons cluttering up the group with noise, when I'm trying to listen to
those who are able and willing to help. I'm happy for them to do the
helping in their own way, as long as they're willing to do it at all.
[your comprehensive quote of previous posting now removed in accordance
with usenet customs. f'up set]
------------------------------
Date: Mon, 19 Jul 1999 18:52:18 +0200
From: Michael Kovler <michael.k@sapiens.com>
Subject: Network disk
Message-Id: <379357C2.C7D8E1F4@sapiens.com>
Hello,
I am writing some CGI perl (ActiveState, IIS).
Suddenly, I find out that my perl doesn't see network disks.
Does anybody have idea how I can see network disks.
(As I understand I should logon to another user, but I didn't find any
way do it.)
Thanks for your assistance.
------------------------------
Date: Mon, 19 Jul 1999 14:52:16 GMT
From: lotharhaensler@my-deja.com
Subject: newbie: how to avoid croak
Message-Id: <7mve2r$u3s$1@nnrp1.deja.com>
Hi,
in my perl script I want to create a complete path including
subdirectories, so I use mkpath from File::Path.
This has some side-effects that I don't know how to handle.
If mkpath cannot create the path it "croaks", which means that my
script ends.
Is there anything I can do to avoid that?
I want to have full control over all subroutines that I call.
In other words, can avoid that croak stops execution of my script?
Thanks in advance.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Mon, 19 Jul 1999 15:43:30 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: newbie: how to avoid croak
Message-Id: <37934669.2201558@news.skynet.be>
lotharhaensler@my-deja.com wrote:
>in my perl script I want to create a complete path including
>subdirectories, so I use mkpath from File::Path.
>This has some side-effects that I don't know how to handle.
>If mkpath cannot create the path it "croaks", which means that my
>script ends.
>
>Is there anything I can do to avoid that?
Yes. Use "eval { CODE }". This is not the same as eval "codestring", as
CODE is compiled once, at compile time. But both have in common the
fact that otherwise fatal errors are no longer fatal. The "die" message
is saved in $@.
eval { $y = 0; $x = 3 / $y };
print "This code block died: $@" if $@;
Bart.
------------------------------
Date: Mon, 19 Jul 1999 15:26:36 GMT
From: rand@qualityic.com (Rand Bamberg)
Subject: op/stat.t test 4 failure
Message-Id: <37934128.12140234@news.jump.net>
Has anyone else seen a problem when running 'make test'
on a Linux 2.2.5-15 (Red Hat 6.0) perl5 install in a
directory living on a Solaris 2.6 box using NFS?
I found a response to a similar problem report in the
archives of perl5-porters:
On 1998/08/28, Nick Ing-Simmons wrote:
>Where did you have the perl5.004_04/t directory when you
>ran that test? Some of the "stat" tests are known to fail
>on tmpfs (e.g. /tmp) or ClearCase view storage as those
>file systems are not quite as strict about things as normal
>(ufs). The same can be true of Network Appliance "Toaster" NFS
>served file systems (but that seems to vary with how they
>are configured)
So I'm inclined to think this is just a Linux/Solaris
NFS weirdness, and safe to ignore.
-Rand.
------------------------------
Date: 19 Jul 1999 13:57:50 GMT
From: jmstapel_n0spam@mtu.edu (Jason Stapels)
Subject: Re: Padding numbers with 0's
Message-Id: <7mvasu$dch$1@campus1.mtu.edu>
Abigail (abigail@delanet.com) wrote:
: *LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
<SNIP>
: *LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
Hey lighten up man, I was tired that day I guess. I've been dealing with this
Y2k Sh_t for God known how long and I've seen enough 2 digit dates to last
a life time.
: How on earth you think this code will ever produce '201' is beyond
: me. You certainly didn't test it.
No, that wasn't exact return results, but it got my point across now didn't
it?
: And your question here is?
: Perhaps you should ask your mother to read you the documentation.
: It's unlikely you are able to.
Well, if you would have looked at the replies first, you would have seen
that the nice guy from HP helped me out (w/o insulting me too much). So
in the meantime, why don't you try to keep alittle of the criticism to
youself, and stick with a 4 line .sigfile.
j
------------------------------
Date: Mon, 19 Jul 1999 18:07:59 +0200
From: "Paolo Noya" <paolo.noya@inferentia.it>
Subject: Perl deamon
Message-Id: <newscache$1wk4ff$jab$1@traminer.inferentia.it>
I'm an umble perl programmer, I wrote a program dispatcher that start more
instances of another daemon program on a Linux machine and exit without
wait.
Dispatcher look like:
for @param
if ($pid = fork) {next;}
elsif (defined $pid) { exec 'perl', $prog, $_; }
else {next;}
}
exit;
All work fine, but to avoid possible zoombies in case of premature child
termination before parent ones, I added $SIG{CHLD}='IGNORE'.
After this change on dispatcher every pipe I call in child process end with
this error:
'No child processes'.
What's my error?
Thanks in advance
Paolo
perl -e 'eval join qq,\n,,@q=(q,for(@q){ #Just,,q,@_=split;
#Another,,q!push(@m,$_[1]=~m,.(.*),)}
#Perl!,q.print(join(qq,\40,,@m),qq,\n,) #Hacker.)'
------------------------------
Date: Mon, 19 Jul 1999 17:40:55 +0100
From: David Stringer <me@wavy.org>
Subject: PGP and Perl
Message-Id: <3gAQ1PAXU1k3EwQD@wavy.org>
I am trying to use a script to manipulate PGP data. I have installed PGP
2.6.3i , PGP:Pipe and PGP:Sign. Unfortunately all the docs I can find
for PGP:Pipe and PGP:Sign do not give instructions how they intend the
code to be used.
Could anyone be gracious enough point me to some good docs or give me a
basic rundown of the available methods.
Any other advice relevant to using PGP and Perl together could also be
most helpful.
Thanks.
--
David Stringer
------------------------------
Date: Mon, 19 Jul 1999 11:08:45 -0500
From: Marco Lazar <lazar@micro.ti.com>
Subject: PID of process created by "system"
Message-Id: <37934D8C.5FA62AA9@micro.ti.com>
Hi,
is there a way to find the process id (pid) of a process which
was started by invoking the system ("name_of_program") function ?
Thanks and regards,
Marco
------------------------------
Date: Mon, 19 Jul 1999 11:14:04 -0500
From: Marco Lazar <lazar@micro.ti.com>
Subject: Re: PID of process created by "system"
Message-Id: <37934ECB.2411B8E9@micro.ti.com>
Marco Lazar wrote:
> Hi,
>
> is there a way to find the process id (pid) of a process which
> was started by invoking the system ("name_of_program") function ?
>
> Thanks and regards,
> Marco
Oops,
forgot to mention that "name_of_program" could be invoked multiple
times.
------------------------------
Date: Mon, 19 Jul 1999 17:21:30 BST
From: gml4410@ggr.co.uk (Lack Mr G M)
Subject: Re: PID of process created by "system"
Message-Id: <1999Jul19.172130@ukwit01>
In article <37934D8C.5FA62AA9@micro.ti.com>, Marco Lazar <lazar@micro.ti.com> writes:
|>
|> is there a way to find the process id (pid) of a process which
|> was started by invoking the system ("name_of_program") function ?
Why would you wish to know? The call doesn't return until the
process it spawned has died, so the actual pid is of no value.
--
----------- Gordon Lack ----------------- gml4410@ggr.co.uk ------------
The contents of this message *may* reflect my personal opinion. They are
*not* intended to reflect those of my employer, or anyone else.
------------------------------
Date: Mon, 19 Jul 1999 15:25:35 GMT
From: danmex@my-deja.com
Subject: Re: Q:Script too long, session times out??
Message-Id: <7mvg0v$v1b$1@nnrp1.deja.com>
Thank you Abigail,
In article <slrn7o5959.tch.abigail@alexandra.delanet.com>,
abigail@delanet.com wrote:
> danmex@my-deja.com (danmex@my-deja.com) wrote on MMCXXXV September
> MCMXCIII in <URL:news:7lu492$sm8$1@nnrp1.deja.com>:
> []
> [] Does anybody out there know if it is posible for a perl program to
> [] execute another perl program and NOT wait for the output?
>
> fork() and exec();
>
> Abigail
> --
> sub A::TIESCALAR{bless\my$x=>A};package B;@q=qw/Hacker Another
> Perl Just/;use overload'""'=>sub{pop @q};sub A::FETCH{bless\my
> $y=>B}; tie my $shoe => 'A';print "$shoe $shoe $shoe $shoe\n";
>
> -----------== Posted via Newsfeeds.Com, Uncensored Usenet News
==----------
> http://www.newsfeeds.com The Largest Usenet Servers in the
World!
> ------== Over 73,000 Newsgroups - Including Dedicated Binaries
Servers ==-----
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 19 Jul 1999 15:29:38 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: reading from a file and THEN!
Message-Id: <37933652@newsread3.dircon.co.uk>
Knuth Posern <posern@Mathematik.Uni-Marburg.de> wrote:
> Hi.
>
> Is there ANY possiblity to NOTICE if a file that I read from with:
>
> open(FH, "bla");
> while (FH) {
> ##...
> }
>
> was deleted (e.g. with "rm bla") and NEW created...
>
>
If I understand you correctly then there is no need to detect if the
file was unlinked while you have it open as your file will not be
affected ... you are only unlinking the naem with rm not the storage
allocated.
/J\
--
"Gary Glitter pulls out of Children in Need" - BBC News Website
------------------------------
Date: Mon, 19 Jul 1999 08:07:25 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: reading from a file and THEN!
Message-Id: <MPG.11fcdf08d92c1d36989cf6@nntp.hpl.hp.com>
In article <37933652@newsread3.dircon.co.uk> on 19 Jul 1999 15:29:38
+0100, Jonathan Stowe <gellyfish@gellyfish.com> says...
> Knuth Posern <posern@Mathematik.Uni-Marburg.de> wrote:
> > Is there ANY possiblity to NOTICE if a file that I read from with:
> >
> > open(FH, "bla");
I don't mind leaving off the 'test-for-failure' incantation in a sketch
such as this.
> > while (FH) {
But I do mind leaving off the readline <> operator, even in a sketch
such as this.
> > ##...
> > }
> >
> > was deleted (e.g. with "rm bla") and NEW created...
I don't understand what is meant by 'NEW created'.
> If I understand you correctly then there is no need to detect if the
> file was unlinked while you have it open as your file will not be
> affected ... you are only unlinking the naem with rm not the storage
> allocated.
For completeness -- note that this applies to Unix-based file systems
only. Other file systems will not allow an unlink of an open file.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 19 Jul 1999 10:01:21 -0400
From: James Gerard Coleman <jgc5a@j2.mail.virginia.edu>
Subject: still buggy...
Message-Id: <Pine.A41.4.05.9907190958250.57430-100000@node7.unix.Virginia.EDU>
i'm having a bit of a problem with my loop...
while(<IN>) {
if ($_ =~ /authenticat/) { # look and see if value exists
push(@tempauth, $_); # put values into an array
$i++;
}
} # then loop through and find
for ($j=0; $j<=$#tempauth; $j++) { # all key values and match
for ($k=0; $k<=$#cryptokeys; $k++) {# with the lines. print.
if ($tempauth[$j] =~ $cryptokeys[$k]) {
print OUT "$j $tempauth[$j]";
}
}
}
what this is doing, is printing all the values of @tempauth twice.. i
added the counter value for $j, and for some reason, the if loop seems to
run twice, (getting duplicate lines when i only want/need one). any ideas
why? it seems to be clean to me, but then, i'm doing something wrong...
thanks in advance,
jim coleman
------------------------------
Date: Mon, 19 Jul 1999 07:54:12 -0700
From: Andrew J Perrin <aperrin@mcmahon.qal.berkeley.edu>
Subject: Re: still buggy...
Message-Id: <37933C13.A4083624@mcmahon.qal.berkeley.edu>
I'm not sure why you're getting the double looping, but rewriting some of the
code as following might at least clarify the situation. Good luck.
Andy Perrin
James Gerard Coleman wrote:
> while(<IN>) {
> if ($_ =~ /authenticat/) { # look and see if value exists
I assume authenticat would be replaced by a regular expression.
> push(@tempauth, $_); # put values into an array
> $i++;
Why the $i++? You've got the same value in $#tempauth, I think.
> }
> } # then loop through and find
> for ($j=0; $j<=$#tempauth; $j++) { # all key values and match
How about: foreach $auth (@tempauth) {
foreach $cryptokey (@kryptokeys) {
if ($auth eq $cryptokey) { #NOTE assuming you're looking for
string comparison
print OUT $auth; # not the regex you suggest. Also
doesn't print
} # the index $j you use.
}
}
> if ($tempauth[$j] =~ $cryptokeys[$k]) {
>
Using the =~ operator does a pattern match, e.g., $cryptokeys[$k] should
bea regular expression, s//, or tr//. If it is, okay - if not, use eq for
string comparison or == for numeric.
--
-------------------------------------------------------------
Andrew Perrin - NT/Unix/Access Consulting - aperrin@mcmahon.qal.berkeley.edu
I'M LOOKING FOR ANOTHER EXPERIENCED ACCESS
DEVELOPER - CONTACT ME IF INTERESTED.
http://www.geocities.com/SiliconValley/Grid/7544/
-------------------------------------------------------------
------------------------------
Date: 19 Jul 1999 10:23:06 -0500
From: Cameron Kaiser <ckaiser@stockholm.ptloma.edu>
Subject: Re: still buggy...
Message-Id: <fpHk3.19598$vw1.788842@newscene.newscene.com>
James Gerard Coleman <jgc5a@j2.mail.virginia.edu> writes:
>for ($j=0; $j<=$#tempauth; $j++) { # all key values and match
> for ($k=0; $k<=$#cryptokeys; $k++) {# with the lines. print.
> if ($tempauth[$j] =~ $cryptokeys[$k]) {
^^^^^^^^^^^^^^^
You may have a reason for writing this that way, but I tend to use
if ($tempauth[$j] =~ /$cryptokeys[$k]/) {
--
Cameron Kaiser * ckaiser@stockholm.ptloma.edu * posting with a Commodore 128
http://calvin.ptloma.edu/~spectre/ * "When in doubt, take a pawn." -- M:I
-- Supporting the Commodore 64 and 128: http://www.armory.com/~spectre/cwi/ --
head moderator comp.binaries.cbm * cbm special forces unit $ea31 [tincsf]
------------------------------
Date: Mon, 19 Jul 1999 11:35:23 -0400
From: James Gerard Coleman <jgc5a@j2.mail.virginia.edu>
To: Andrew J Perrin <aperrin@mcmahon.qal.berkeley.edu>
Subject: Re: still buggy...
Message-Id: <Pine.A41.4.05.9907191127140.57430-100000@node7.unix.Virginia.EDU>
On Mon, 19 Jul 1999, Andrew J Perrin wrote:
> I assume authenticat would be replaced by a regular expression.
>
> Why the $i++? You've got the same value in $#tempauth, I think.
>
yeah, i noticed that shortly after posting (older code i forgot to
delete).. oops..
> > }
> > } # then loop through and find
> > for ($j=0; $j<=$#tempauth; $j++) { # all key values and match
>
> How about: foreach $auth (@tempauth) {
> foreach $cryptokey (@kryptokeys) {
> if ($auth eq $cryptokey) { #NOTE assuming you're looking for
> string comparison
> print OUT $auth; # not the regex you suggest. Also
> doesn't print
> } # the index $j you use.
> }
> }
>
> > if ($tempauth[$j] =~ $cryptokeys[$k]) {
> >
>
> Using the =~ operator does a pattern match, e.g., $cryptokeys[$k] should
> bea regular expression, s//, or tr//. If it is, okay - if not, use eq for
> string comparison or == for numeric.
>
yeah, i'm comparing a single string to a line of text, so the eq doesn't
really do what i need it to do.. otherwise...
the foreach does clean up the loops a lot and make it easier to read..
thanks. i'm still getting the double compare though.. frustrating that
i can't figure out why. maybe i'll have to go try this on a different
machine (linux or sun or something other than nt...) to see if it's
something there...
back to the trenches...
jim coleman
------------------------------
Date: Mon, 19 Jul 1999 11:39:09 -0400
From: James Gerard Coleman <jgc5a@j2.mail.virginia.edu>
To: Cameron Kaiser <ckaiser@stockholm.ptloma.edu>
Subject: Re: still buggy...
Message-Id: <Pine.A41.4.05.9907191138280.57430-100000@node7.unix.Virginia.EDU>
On 19 Jul 1999, Cameron Kaiser wrote:
> James Gerard Coleman <jgc5a@j2.mail.virginia.edu> writes:
>
> >for ($j=0; $j<=$#tempauth; $j++) { # all key values and match
> > for ($k=0; $k<=$#cryptokeys; $k++) {# with the lines. print.
> > if ($tempauth[$j] =~ $cryptokeys[$k]) {
> ^^^^^^^^^^^^^^^
> You may have a reason for writing this that way, but I tend to use
>
> if ($tempauth[$j] =~ /$cryptokeys[$k]/) {
tried this.. same result... :(
thanks though.
------------------------------
Date: Mon, 19 Jul 1999 13:04:42 -0400
From: brian@pm.org (brian d foy)
Subject: Re: TPJ/Earthweb junk mail?
Message-Id: <brian-ya02408000R1907991304420001@news.panix.com>
In article <ORWANT.99Jul19090144@rising-sun.media.mit.edu>, orwant@media.mit.edu posted:
> That's a good idea. But note that there already is a link at the
> bottom of tpj.com pages with their privacy statement. Also note
> that if you navigate tpj.com through the sand traps to the "Edit
> Profile" putting green, you'll see a little box that you have to
> check if you *want* to get spam.
yes, theere is. i missed it before. it's at the very bottom of
the page in a very small font size. i have since read it. it clearly
states:
offer you the opportunity to opt out of receiving information
from our partners and third parties.
however, they never gave me the opportunity and did it anyway. this
leads me to beleive that this is simply rhetoric.
i can't log on to the site because i don't have a username and password.
furthermore, the site digusts with its gratuitous links to other,
unrelated Earthweb avenues of advertising.
no matter what you say Jon, i think you did a better job by yourself
than Earthweb could ever do. we didn't have these worries with you. :)
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: Mon, 19 Jul 1999 16:41:15 GMT
From: syarbrou@nospam.enteract.com (Steve .)
Subject: using multiple array fields in foreach
Message-Id: <3793541e.154114969@news.enteract.com>
Say I have the following:
@dir = ("1" , "2" , "3");
@dir2 = ("one" , "two" , "three");
I then do a:
foreach $dir (@dir)
{
....
}
What I now want to do is have the @dir2 parse thru along with the
@dir. So when $dir is equal to "1", then $dir2 would be equal to
"one", and when $dir1 equals "2" $dir2 would be "two". Kind of a
double foreach at the same time. How would you go about doing that?
Thanks
Steve
Newsgroup replies preferred. Remove nospam when responding thru
email.
------------------------------
Date: Mon, 19 Jul 1999 11:30:53 -0400
From: "Phil R Lawrence" <prlawrence@lehigh.edu>
Subject: which release supports qr/(?{...})/
Message-Id: <7mvgbg$vkq@fidoii.cc.Lehigh.EDU>
I want to use (?{...}) in my regexes, but it seems unsupported in my version
(5.00404). Which release begins support for this feature?
--
Phil R Lawrence
Lehigh University
Enterprise Systems Implementation
Programmer / Analyst
prlawrence@lehigh.edu - work
prlawrence@planetall.com - personal
--
until (!$self->{'plaid pants'}) { bless $self, $class }
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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 V9 Issue 189
*************************************