[16238] in Perl-Users-Digest
Perl-Users Digest, Issue: 3650 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 13 11:05:38 2000
Date: Thu, 13 Jul 2000 08:05:18 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <963500718-v9-i3650@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 13 Jul 2000 Volume: 9 Number: 3650
Today's topics:
64 bit support <nomail@hursley.ibm.com>
Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! <bart.lateur@skynet.be>
Re: autoflushing not as good as closing? (Villy Kruse)
Re: autoflushing not as good as closing? <bob@bob-n.com>
Re: Beginner Question <bart.lateur@skynet.be>
Re: Beginner Question (Tad McClellan)
Re: Beginner with simple question on searching <jboes@eoexchange.com>
Bizarre BEGIN block problem <ed@nospam.com>
Re: Bizarre BEGIN block problem pkay01@my-deja.com
Re: Bug in Cookbook: default @_ argument list? nobull@mail.com
Re: Does file locking in perl on rh6.2 linux just not w nobull@mail.com
File::Find example <graham.wood@iona.com>
Re: File::Find example (Christian Kaufhold)
Re: File::Find example <westxga@my-deja.com>
Re: File::Find example (Tad McClellan)
Re: File::Find example (William Herrera)
Re: File::Find example melet@my-deja.com
Re: FormMail.pl across mutiple pages (Michel Dalle)
Re: FormMail.pl across mutiple pages (Will England)
getting process id from open on NT (Mike Burnett)
Grabbing Multiple Occurances WITHOUT Being Greedy jcochett@my-deja.com
Help! Using scalars to define line numbers. alexserve@my-deja.com
Re: Help! Using scalars to define line numbers. <uri@sysarch.com>
Re: Help!. Installed 5.6, now Crypt::xxx modules are b <doughera@lafayette.edu>
Re: Help, no cgi push! what else is there? <bart.lateur@skynet.be>
Re: Help, no cgi push! what else is there? richardstands@my-deja.com
Re: Help, no cgi push! what else is there? <bart.lateur@skynet.be>
Re: Help, no cgi push! what else is there? (Will England)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 13 Jul 2000 16:00:10 +0100
From: Derek Fountain <nomail@hursley.ibm.com>
Subject: 64 bit support
Message-Id: <396DD97A.B471C6C9@hursley.ibm.com>
How well supported are 64 bit integers from Perl on UNIX
(specifically AIX), Linux on IA32 and Windows NT? I quick
check suggests "they're not" would be the right answer. Is
there a module or something I can use? A search on CPAN came
up with nothing.
------------------------------
Date: Thu, 13 Jul 2000 14:24:58 +0200
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <9fbrmsgq6igv6djequtk0geo526mpdo3bf@4ax.com>
p3rlc0dr@my-deja.com wrote:
>And never forget: MATT RULER!
Maybe if you use it for some spanking.
--
Bart.
------------------------------
Date: 13 Jul 2000 10:41:50 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: autoflushing not as good as closing?
Message-Id: <slrn8mr5v8.4g9.vek@pharmnl.ohout.pharmapartners.nl>
On Wed, 12 Jul 2000 21:41:15 -0500, Bob Niederman <bob@bob-n.com> wrote:
>except it doesn't work. The initial output of nslookup starting up
>appears, but nothing happens after inputting a command. If the 'close
>$WTR' is uncommneted inside the while loop, however, then the output of
>the first command IS returned as expected. Of course, all subsequent
>commands fail due to writing on a closed filehandle.
>
>The program works as written if used with cat (rl.pl cat).
>
>I don't get it. Why isn't autoflushing $WTR (I've tried this with print
>or using syswrite, which also does no buffering) as good as closing the
>file?
>
>
I suspect that nslookup is not autoflushing. That is, nslookup has
produced the answers, but the answers will remain in the buffers of
nslookup until you close stdin for nslookup. Then the buffered replies
will be flushed from stdout in nslookup.
To get around it you might need to talk to nslookup through a pty/tty
pair, and there might be Perl modules that does that nicely. Most unix
commands changes buffering method when stdin and stdout is not a tty
device. A pty/tty pair is a tty device, but a regular pipe is not.
An alternative non-Perl solution is the expect command which is part
of tcl.
Villy
------------------------------
Date: Thu, 13 Jul 2000 07:30:51 -0500
From: Bob Niederman <bob@bob-n.com>
Subject: Re: autoflushing not as good as closing?
Message-Id: <396DB67B.4EE85C78@bob-n.com>
Villy Kruse wrote:
>
> On Wed, 12 Jul 2000 21:41:15 -0500, Bob Niederman <bob@bob-n.com> wrote:
>
> >except it doesn't work. The initial output of nslookup starting up
> >appears, but nothing happens after inputting a command. If the 'close
> >$WTR' is uncommneted inside the while loop, however, then the output of
> >the first command IS returned as expected. Of course, all subsequent
> >commands fail due to writing on a closed filehandle.
> >
> >The program works as written if used with cat (rl.pl cat).
> >
> >I don't get it. Why isn't autoflushing $WTR (I've tried this with print
> >or using syswrite, which also does no buffering) as good as closing the
> >file?
> >
> >
>
> I suspect that nslookup is not autoflushing. That is, nslookup has
> produced the answers, but the answers will remain in the buffers of
> nslookup until you close stdin for nslookup. Then the buffered replies
> will be flushed from stdout in nslookup.
>
> To get around it you might need to talk to nslookup through a pty/tty
> pair, and there might be Perl modules that does that nicely. Most unix
> commands changes buffering method when stdin and stdout is not a tty
> device. A pty/tty pair is a tty device, but a regular pipe is not.
>
> An alternative non-Perl solution is the expect command which is part
> of tcl.
>
> Villy
Actually, there is an expect module in perl - I'll probably give it a
shot. In never occurred to me that nslookup wouldn't autoflush, since
in interaactive mode, its responses appear imeediatley. But your
comment about the system changing behaviour when STDIN isn't a tty makes
sense. Thanx.
--
- Bob Niederman http://bob-n.com
Fight UCITA! http://www.4cite.org, http://bob-n.com/ucita
------------------------------
Date: Thu, 13 Jul 2000 14:22:17 +0200
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Beginner Question
Message-Id: <ekcrmscoc7cerk6vo51p8oeqp15ksf33vr@4ax.com>
The WebDragon wrote:
>The data structure of complex HOHOHOL's is quite pretty (IMHO) :
>
>my %complextable = (
> 'key1' => {
> 'subkeyA' => [ 'value1a', 'value2a', 'value3a', 'value4a' ],
> 'subkeyB' => [ 'value1b', 'value2b', 'value3b', 'value4b' ],
> 'subkeyC' => [ 'value1c', 'value2c', 'value3c', 'value4c' ]
> },
...
>);
That rather looks like a HoHoL to me, not a HoHoHoL.
--
Bart.
------------------------------
Date: Thu, 13 Jul 2000 08:09:00 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Beginner Question
Message-Id: <slrn8mrcas.9pu.tadmc@magna.metronet.com>
On 13 Jul 2000 07:33:27 GMT, The WebDragon <nospam@nospam.com> wrote:
>[I tend to think of the array/list terms as
>being interchangable -- correct me if I'm wrong,
perldoc -f push
push ARRAY,LIST
So now try interchanging those :-)
Perl FAQ, part 4 (5.6):
"What is the difference between a list and an array?"
oh gurus. :]
^^^^^
Enlightenment not required.
Just a bleeding edge perl :-)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 13 Jul 2000 10:01:24 -0400
From: Jeff Boes <jboes@eoexchange.com>
Subject: Re: Beginner with simple question on searching
Message-Id: <396dcdb8$0$1506$44a10c7e@news.net-link.net>
blue_haulic wrote:
>
> I have a Perl/CGI program that essentially searches certain
> emails by subject line and returns the subject line to an
> html page. My question is that the subject line is never
> constant. That is, the beginning of the subject line is the
> same, (i.e., News Story) but the other part of the subject
> line could be anything (on Zebras). How do I use a regular
> expression such as, if($temp =~/subject line/) {}, to search
> for all text starting with News Story and ending in
> anything. Is there a *.* designation or something to that
> effect that would allow me to simply search by the beginning
> of a text (i.e., if ($temp +~ /News Story*.*/). If not, is
> there another method to my maddness...lol. Thanks for your
> help.
>
$a = "News Story: Zebras Attack Tourists";
...
if ($a =~ /^News Story:\s+(.*)/) {
print 'I found a news story about "', $1, qq!"\n";
}
Explanation:
'^' at the start of a pattern matches the start of the string.
\s+ matches one or more whitespace characters (so you can have one, two,
or more spaces after the ':')
(.*) matches everything else and saves it for later use.
After a successful pattern match, $1 will contain the stuff matched by
the first () construct in the pattern, $2 the second, and so on.
--
Jeff Boes |Computer science is no more |jboes@eoexchange.com
Sr. S/W Engineer |about computers than astronomy|616-381-9889 ext 18
Change Technology|is about telescopes. |616-381-4823 fax
EoExchange, Inc. | --E. W. Dijkstra |www.eoexchange.com
------------------------------
Date: Thu, 13 Jul 2000 13:20:52 GMT
From: "Ed Foy" <ed@nospam.com>
Subject: Bizarre BEGIN block problem
Message-Id: <Umjb5.62289$_b3.1817863@newsread1.prod.itd.earthlink.net>
Greetings,
I am having a problem with a BEGIN block. There must be a simple answer
but I have been unable to find it after two weeks of debugging.
Environment: Perl 5.004 under UNIX.
What I am trying to accomplish is to redirect STDERR to STDOUT so that I
can see runtime errors via HTTP (this works). The problem is that I am
getting a compile error that I cannot resolve. Since everything
"appears" to work this "seems" to be a spurious problem; but, because I
cannot isolate the cause of the problem I can't be certain that the
error notification is really harmless. I've reduced the code to the
following (verbatim) to demonstrate the problem:
#!/usr/local/bin/perl5
require 5.004;
BEGIN {
print "Content-type: text/html\n\n";
open (STDERR, ">&STDOUT") or die "Cannot Redirect STDERR: $!";
}
my $Dummy = "";
exit;
The above code results in the following error message on compilation:
TEST.PL contains syntax errors.
Content-type: text/html\n\n
For some reason the "Content-type: text/html\n\n" is a problem. If I
comment out the print statement or move the print statement outside the
BEGIN block then there is no error. If I assign the string to a variable
it still fails as in:
BEGIN {
$foo = "Content-type: text/html\n\n";
print $foo;
open (STDERR, ">&STDOUT") or die "Cannot Redirect STDERR: $!";
}
The one response I received to a prior post about this problem indicated
that the above code compiles fine on Perl 5.002 running on OS/2 so long
as the require statement is removed. Not much help since I am running
under Perl 5.004 under UNIX, as stated earlier, on DEC ALPHA servers. I
need a solution that applies to my specific target environment - Perl
5.004 under UNIX.
If anyone can point to a solution to this problem it would very much be
appreciated. I have been unable to find anything in the Camel book or
perldocs or searching the web to explain this error.
Ed
------------------------------
Date: Thu, 13 Jul 2000 14:51:03 GMT
From: pkay01@my-deja.com
Subject: Re: Bizarre BEGIN block problem
Message-Id: <8kkl0e$g8t$1@nnrp1.deja.com>
In article <Umjb5.62289$_b3.1817863@newsread1.prod.itd.earthlink.net>,
"Ed Foy" <ed@nospam.com> wrote:
> Greetings,
>
> I am having a problem with a BEGIN block. There must be a simple
answer
> but I have been unable to find it after two weeks of debugging.
>
> Environment: Perl 5.004 under UNIX.
>
> What I am trying to accomplish is to redirect STDERR to STDOUT so
that I
> can see runtime errors via HTTP (this works). The problem is that I am
> getting a compile error that I cannot resolve. Since everything
> "appears" to work this "seems" to be a spurious problem; but, because
I
> cannot isolate the cause of the problem I can't be certain that the
> error notification is really harmless. I've reduced the code to the
> following (verbatim) to demonstrate the problem:
>
> #!/usr/local/bin/perl5
>
> require 5.004;
>
> BEGIN {
> print "Content-type: text/html\n\n";
> open (STDERR, ">&STDOUT") or die "Cannot Redirect STDERR: $!";
> }
>
> my $Dummy = "";
> exit;
>
> The above code results in the following error message on compilation:
>
> TEST.PL contains syntax errors.
> Content-type: text/html\n\n
>
> For some reason the "Content-type: text/html\n\n" is a problem. If I
> comment out the print statement or move the print statement outside
the
> BEGIN block then there is no error. If I assign the string to a
variable
> it still fails as in:
>
> BEGIN {
> $foo = "Content-type: text/html\n\n";
> print $foo;
> open (STDERR, ">&STDOUT") or die "Cannot Redirect STDERR: $!";
> }
>
> The one response I received to a prior post about this problem
indicated
> that the above code compiles fine on Perl 5.002 running on OS/2 so
long
> as the require statement is removed. Not much help since I am running
> under Perl 5.004 under UNIX, as stated earlier, on DEC ALPHA
servers. I
> need a solution that applies to my specific target environment - Perl
> 5.004 under UNIX.
>
> If anyone can point to a solution to this problem it would very much
be
> appreciated. I have been unable to find anything in the Camel book or
> perldocs or searching the web to explain this error.
>
> Ed
>
>
Why not try using the CGI module, and let the CGI functions do the
tricky stuff for you;
#! /usr/bin/perl -w
use CGI qw(:standard);
print
header,
start_html(-title=>'Example HTML Page'),
start_form,
h1("Enter text"),
p,
textfield(-name=>'whatever', -size=>50),
p,
hr,
submit(),
end_form,
end_html;
Hope that helps!
Pete
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 13 Jul 2000 12:12:08 +0100
From: nobull@mail.com
Subject: Re: Bug in Cookbook: default @_ argument list?
Message-Id: <u97laquvw7.fsf@wcl-l.bham.ac.uk>
Jeff Boes <jboes@eoexchange.com> writes:
> sub is_numeric { defined scalar &getnum }
The problem here is that "defined" can take either an expression or a
function name (with leading &) as an argument. Because of the way
"scalar" is handled by the parser the "defined" does not see it and so
does not realise that the thing following it is an expression.
This, I agree, IMNSHO is a bug. I don't know if it's been fixed in
later versions as I'm using 5.005_3 too.
> sub is_numeric { defined(scalar(&getnum(@_))) }
>
> then all is well.
I think I prefer:
sub is_numeric { defined do &getnum }
But then again do for subroutine calls is depreciated so perhaps this
is not such a good thing after all.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 13 Jul 2000 13:21:05 +0100
From: nobull@mail.com
Subject: Re: Does file locking in perl on rh6.2 linux just not work?
Message-Id: <u966qauspa.fsf@wcl-l.bham.ac.uk>
Frank Samuelson <fwslsm@cnsp.com> writes:
> I have read the man page several times and surfed the net over on
> file locking in perl, but I can't get it to work.
> open(FTEMP,"bucko") || die "Couldn't open bucko\n";
> $gg=flock(FTEMP,LOCK_EX);
As it happens you are looking in the wrong place. This has nothing to
do with Perl. To prevent denial of service attacks Linux (like most
(all?) Unicies (OSes?)) will not grant you an exclusive lock on a file
that you have opened in read-only mode.
BTW: when you "surfed the net" did you includea deja search? IIRC
this question does arrise here every week or two.
Perhaps this may be considered a documentation bug in "perldoc -f
flock" or more likely in Linux's "man 2 flock". I trust that you did
notice that "perldoc -f flock" told you to read "man 2 flock" for
details.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 13 Jul 2000 13:21:10 +0100
From: "Graham Wood" <graham.wood@iona.com>
Subject: File::Find example
Message-Id: <8kkcif$31c$1@bvweb.iona.com>
I've been writing heretical scripts using the Unix find command to list all
files below a specified directory and would like to become orthodox and
start using perl modules to do it instead.
I've read the perldoc File::Find entry but I think I missed something in
there.
Can someone show me a script that does the equivalent of just:
find * -print
ie just find and list all the files, using the File::Find module?
I tried:
sub mine{
print;
}
with
find(wanted=> \&mine);
find(\&mine);
find(mine);
and various other wild guesses but nothing worked.
Thanks in advance
Graham Wood
------------------------------
Date: Thu, 13 Jul 2000 13:28:26 +0200
From: ch-kaufhold@gmx.de (Christian Kaufhold)
Subject: Re: File::Find example
Message-Id: <8kkedc$c0k$2@f40-3.zfn.uni-bremen.de>
Graham Wood <graham.wood@iona.com> wrote:
> I've been writing heretical scripts using the Unix find command to list all
> files below a specified directory and would like to become orthodox and
> start using perl modules to do it instead.
>
> I've read the perldoc File::Find entry but I think I missed something in
> there.
>
> Can someone show me a script that does the equivalent of just:
> find * -print
> ie just find and list all the files, using the File::Find module?
#!/usr/bin/perl -w
use strict;
use File::Find;
sub print_name
{
print $File::Find::name
}
{
local $\ = "\n";
find(\&print_name, @ARGV ? @ARGV : '.');
}
Christian
------------------------------
Date: Thu, 13 Jul 2000 14:08:09 GMT
From: Glenn West <westxga@my-deja.com>
Subject: Re: File::Find example
Message-Id: <8kkifq$e6h$1@nnrp1.deja.com>
In article <8kkcif$31c$1@bvweb.iona.com>,
"Graham Wood" <graham.wood@iona.com> wrote:
> I've been writing heretical scripts using the Unix find command to
list all
> files below a specified directory and would like to become orthodox
and
> start using perl modules to do it instead.
>
> I've read the perldoc File::Find entry but I think I missed something
in
> there.
Not terribly descriptive was it? You need a second argument to tell
where to start the search.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 13 Jul 2000 09:30:40 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: File::Find example
Message-Id: <slrn8mrh40.a9t.tadmc@magna.metronet.com>
On Thu, 13 Jul 2000 13:21:10 +0100, Graham Wood <graham.wood@iona.com> wrote:
>
>I've read the perldoc File::Find entry but I think I missed something in
>there.
Probably something like providing the directories to start searching in...
:-)
>Can someone show me a script that does the equivalent of just:
> find * -print
>ie just find and list all the files, using the File::Find module?
>
>I tried:
>
>sub mine{
> print;
>}
>
>with
>find(wanted=> \&mine);
That isn't going to work.
It is the same as:
find('wanted', \&mine);
You are passing a string and a coderef there.
find() expects a coderef and a list of strings (dir names).
You can pass a hash*ref* as the first arg.
You get a hashref (i.e. reference to an anonymous hash)
from curly braces in Perl:
find( {wanted=> \&mine} );
But then you only have one argument. Still no list of dirs to start in.
>find(\&mine);
find(\&mine, '.');
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 13 Jul 2000 14:49:16 GMT
From: posting.account@lynxview.com (William Herrera)
Subject: Re: File::Find example
Message-Id: <396dd645.204639489@news.rmi.net>
On Thu, 13 Jul 2000 13:21:10 +0100, "Graham Wood" <graham.wood@iona.com> wrote:
>I've been writing heretical scripts using the Unix find command to list all
>files below a specified directory and would like to become orthodox and
>start using perl modules to do it instead.
>
>I've read the perldoc File::Find entry but I think I missed something in
>there.
>
>Can someone show me a script that does the equivalent of just:
> find * -print
>ie just find and list all the files, using the File::Find module?
Read the docs. Then, write your own code for wanted:
#--cut--
use File::Find;
find(\&wanted, '/.', '*');
sub wanted { print"$File::Find::name\n"; }
#--cut--
---
The above from: address is spamblocked. Use wherrera (at) lynxview (dot) com for the reply address.
------------------------------
Date: Thu, 13 Jul 2000 14:36:00 GMT
From: melet@my-deja.com
Subject: Re: File::Find example
Message-Id: <8kkk4e$fk3$1@nnrp1.deja.com>
hello,
@ARGV=("$data_dir") unless @ARGV; # your dirctory
sub PATH {
$file=basename($File::Find::name);
$directory=dirname($File::Find::name);
....
}
find(\&PATH,@ARGV);
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 13 Jul 2000 14:54:35 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: FormMail.pl across mutiple pages
Message-Id: <8kkldd$86v$1@news.mch.sbs.de>
In article <2767dd60.751af5cc@usw-ex0103-086.remarq.com>, Andy Barlow <andybarlow70NOanSPAM@hotmail.com.invalid> wrote:
>How can I make a form that is completed over 2 or possibly 3 web
>pages, but still sends all the information in together.
>
>Basically, someone completes a brief profile about themselves,
>clicks on a "proceed" button, to another page and completes more
>info and then presses "submit" which sends all the info to us.
You might have a look at
http://www.stonehenge.com/merlyn/WebTechniques/col40.html
for a similar problem of multi-page forms.
>We are using FormMail.pl
I'm sorry to hear that - my condolences.
Michel.
------------------------------
Date: Thu, 13 Jul 2000 14:56:37 GMT
From: will@mylanders.com (Will England)
Subject: Re: FormMail.pl across mutiple pages
Message-Id: <slrn8mrm8i.cam.will@mylanders.com>
On Thu, 13 Jul 2000 02:01:12 -0700, Andy Barlow
<andybarlow70NOanSPAM@hotmail.com.invalid> wrote:
>How can I make a form that is completed over 2 or possibly 3 web
>pages, but still sends all the information in together.
>
>Basically, someone completes a brief profile about themselves,
>clicks on a "proceed" button, to another page and completes more
>info and then presses "submit" which sends all the info to us.
>We are using FormMail.pl
>
You aren't going to like this answer. Write it yourself.
FormMail has many known problems. Formmail also cannot
really do what you want.
The basic idea is this:
(First call)
Page with form is written. user hits submit.
(second call)
Script accepts data from first call, writes that
to hidden form fields and generates a second form.
user hits submit.
(Third call)
Script accepts data from second call, which includes
all the hidden form fields from the first call and
writes that data to hidden form fields. Also writes
the form for the third page of the data form.
user hits submit.
(fourth call)
Script accepts data from third call, which includes all the
hidden form fields from first and second calls. Script
processes data and returns a "Thank you" page.
This is really a CGI qeustion rather than a perl question.
comp.infosystems.www.cgi is ---> thataway.
Feel free to post again once you start coding and hit a
snag.
Oh yes, you'll most likely want to use the CGI module
for writing this script. See http://stein.cshl.org/WWW/CGI/
HTH.
Will
--
"If Al Gore invented the Internet, then I invented spellcheck!"
Dan Quayle, quoted at the National Press Club, 8/3/1999
pgpkey at http://will.mylanders.com/pub_pgp.asc
Recovery page: http://will.mylanders.com/ will@mylanders.com
------------------------------
Date: 13 Jul 2000 13:53:04 GMT
From: mnb@ornl.gov (Mike Burnett)
Subject: getting process id from open on NT
Message-Id: <8kkhk0$blv$1@sws1.ctd.ornl.gov>
I've seen this question asked here but have not seen a reply. So I'll
ask again.
With perl running on NT (under IIS),
$pid = open(FH,"|myprog.exe");
does not return the process ID of myprog.exe. It returns 0 or 1
depending on the success of the open.
Is there a way with perl to get the PID of myprog.exe without having to
use Windows utilities such as tlist and parsing the results?
Mike Burnett
burnettmn@ornl.gov
------------------------------
Date: Thu, 13 Jul 2000 14:39:42 GMT
From: jcochett@my-deja.com
Subject: Grabbing Multiple Occurances WITHOUT Being Greedy
Message-Id: <8kkkba$fmk$1@nnrp1.deja.com>
I need to extract data that occurs multiple times from a line.
Example of a line:
P.CopyFile K(E(0),PD),K(Left(E(0),3)&D("QFDZDKFC"),D("NTQDZDKC-CBS"))
What I am look for (Need both D functions on seperate line AND just the
Arguments):
D("QFDZDKFC")
D("NTQDZDKC-CBS")
The Result I need to print:
QFDZDKFC
NTQDZDKC-CBS
Code #1:
while (<FILEHANDLE>) {
if ( m/D\("(\S*?)"\)/g){
print OUTPUT "$1\n"; #OUTPUT is the file
}
}
The Result of #1 using Example Line:
QFDZDKFC
Code #2:
while (<FILEHANDLE>) {
if ( m/D\("(\S*)"\)/g){ # The ? is missing
print OUTPUT "$1\n"; #OUTPUT is the file
}
}
The Result of #2 using Example Line:
QFDZDKFC"),D("NTQDZDKC-CBS
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 13 Jul 2000 13:49:42 GMT
From: alexserve@my-deja.com
Subject: Help! Using scalars to define line numbers.
Message-Id: <8kkhdf$d85$1@nnrp1.deja.com>
Hi,
I am writing a cgi script to view lines from a flat file database.
I can use numeric literals to define line numbers but when i replace
the numbers with scalar numbers (yes they are definitley numbers and
not strings) the script doesn't work properly.
if (20 ... 39) { #Refers to line numbers in text file
print "<a href=\"$page_url\">$software</a><br>\n";
} # Works fine but...
------------------------------------------------------------
if ($first_line ... $last_line) {
print "<a href=\"$page_url\">$software</a><br>\n";
} #this doesn't work, WHY?
I need scalar variables so I can define first and last lines to view
with a dynamic "GET" link. e.g. link:"Next 20 Entries".
Thanks, Alex
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 13 Jul 2000 14:21:51 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Help! Using scalars to define line numbers.
Message-Id: <x7hf9ujekg.fsf@home.sysarch.com>
>>>>> "a" == alexserve <alexserve@my-deja.com> writes:
a> if (20 ... 39) { #Refers to line numbers in text file
a> print "<a href=\"$page_url\">$software</a><br>\n";
a> } # Works fine but...
a> if ($first_line ... $last_line) {
a> print "<a href=\"$page_url\">$software</a><br>\n";
a> I need scalar variables so I can define first and last lines to view
a> with a dynamic "GET" link. e.g. link:"Next 20 Entries".
from perlop:
If either operand of scalar ".." is a constant expression, that
operand is implicitly compared to the $. variable, the current
line number.
so $first_line fails as it is not a constant expression. but it is easy
to fix. just compare your vars to $. explicitly:
if ($first_line == $. ... $last_line == $. ) {
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Thu, 13 Jul 2000 08:47:28 -0400
From: Andy Dougherty <doughera@lafayette.edu>
Subject: Re: Help!. Installed 5.6, now Crypt::xxx modules are broken.
Message-Id: <Pine.SOL.4.10.10007130844290.23925-100000@maxwell.phys.lafayette.edu>
On Thu, 13 Jul 2000, Robert Chalmers wrote:
> Installed 5.6 perl, (on FreeBSD 2.2) now
>
> Crypt-IDEA
> Crypt-DES
> Crypt-Blowfish
>
> Won't make - and the ones I installed on Perl5.2 are broken...
> A 'make' complains about "sv_undef" being undefined, and the make exits.
>
> Jeeeez. I really need these too. Does any kind soul have any idea what's
> happened here.? It's happening on all three Crypt modules.
Please read the INSTALL file included with the 5.6.0 source kit. In it,
right near the top, you will find a section
=head1 WARNING: This version requires an extra step to build old extensions.
This describes the usual fix for this type of problem.
--
Andy Dougherty doughera@lafayette.edu
Dept. of Physics
Lafayette College, Easton PA 18042
------------------------------
Date: Thu, 13 Jul 2000 14:32:29 +0200
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Help, no cgi push! what else is there?
Message-Id: <aadrms0ifkornd2iv3s0n894eg20rqm8er@4ax.com>
richardstands@my-deja.com wrote:
>What I need to do is have one CGI script call return a page that will
>refresh itself to show the progressive output of another process(that
>it spawns) that takes up to an hour to finish.
See Randal's column #20 for Web Techniques:
http://www.stonehenge.com/merlyn/WebTechniques/col20.html
In short: use server pull, i.e. a "meta" tag with attribute http-equiv
= "Refresh" and content = time in seconds. Then the browser will fetch
the updated page at reqular intervals.
--
Bart.
------------------------------
Date: Thu, 13 Jul 2000 13:29:56 GMT
From: richardstands@my-deja.com
Subject: Re: Help, no cgi push! what else is there?
Message-Id: <8kkg81$c9u$1@nnrp1.deja.com>
Thanks for your post! :o)
I guess I need to explain myself a little further. I am already using
the "meta" tag with the refresh option but I am not able to return that
page to the user as the script won't return at all until it has
completed which, as I mentioned, could be up to an hour(waiting for the
sub that creates all the output). The browser will surely timeout
before this. What I need is for the main script call to spawn a
completely new process that is not tied to the original so that the
latter can finish and return the "refresh" page. I know how to do this
on Unix/Apache with "fork()" but, unfortunately, I am stuck on Windows
NT Server with IIS.
-Rich
In article <aadrms0ifkornd2iv3s0n894eg20rqm8er@4ax.com>,
Bart Lateur <bart.lateur@skynet.be> wrote:
> richardstands@my-deja.com wrote:
>
> >What I need to do is have one CGI script call return a page that will
> >refresh itself to show the progressive output of another process(that
> >it spawns) that takes up to an hour to finish.
>
> See Randal's column #20 for Web Techniques:
>
> http://www.stonehenge.com/merlyn/WebTechniques/col20.html
>
> In short: use server pull, i.e. a "meta" tag with attribute http-
equiv
> = "Refresh" and content = time in seconds. Then the browser will fetch
> the updated page at reqular intervals.
>
> --
> Bart.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 13 Jul 2000 16:21:16 +0200
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Help, no cgi push! what else is there?
Message-Id: <o1krmssu0vjs41stdicuvlnvcjdluh84d9@4ax.com>
richardstands@my-deja.com wrote:
>I know how to do this
>on Unix/Apache with "fork()" but, unfortunately, I am stuck on Windows
>NT Server with IIS.
Ah. Poor you.
Try running a separate script with system().
--
Bart.
------------------------------
Date: Thu, 13 Jul 2000 15:01:07 GMT
From: will@mylanders.com (Will England)
Subject: Re: Help, no cgi push! what else is there?
Message-Id: <slrn8mrmh0.cam.will@mylanders.com>
On Wed, 12 Jul 2000 23:54:38 GMT, richardstands@my-deja.com
<richardstands@my-deja.com> wrote:
<snip wants to progressively display information as
a process runs>
You could look at NPH (non-parsed headers) CGI.
http://stein.cshl.org/WWW/CGI/#nph
I'm not familair with IE not accepting server push,
but if the browser works at say, spamcop.net then this
will work.
You may want to create an account at spamcop.net and
see how their system works using NPH. The lookup
processes can take quite a few seconds to complete.
HTH
Will
--
"If Al Gore invented the Internet, then I invented spellcheck!"
Dan Quayle, quoted at the National Press Club, 8/3/1999
pgpkey at http://will.mylanders.com/pub_pgp.asc
Recovery page: http://will.mylanders.com/ will@mylanders.com
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 3650
**************************************