[24936] in Perl-Users-Digest
Perl-Users Digest, Issue: 7186 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 28 06:12:03 2004
Date: Tue, 28 Sep 2004 03:10:17 -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 Tue, 28 Sep 2004 Volume: 10 Number: 7186
Today's topics:
Re: Precedence of exponentiation <Joe.Smith@inwap.com>
Re: Precedence of exponentiation <Joe.Smith@inwap.com>
Re: Precedence of exponentiation <Joe.Smith@inwap.com>
Re: Precedence of exponentiation <nemo@weathersong.net>
Re: Precedence of exponentiation <nemo@weathersong.net>
printing array problem <soundz@techie.com>
Re: printing array problem <mark.clements@kcl.ac.uk>
Re: printing array problem (Anno Siegel)
Re: printing array problem <Graham.T.Wood@oracle.com>
Re: printing array problem <soundz@techie.com>
Re: printing array problem (Anno Siegel)
Re: Problem in getting results on browser ... <Joe.Smith@inwap.com>
process control <nospamcyatlmatt@hotmail.com>
Re: process control <jurgenex@hotmail.com>
Re: process control <Joe.Smith@inwap.com>
Re: process control <nospamcyatlmatt@hotmail.com>
Re: process control <nospamcyatlmatt@hotmail.com>
Re: process control <jurgenex@hotmail.com>
Re: process control (mike)
question on capturing keys (justme)
Re: question on capturing keys (Walter Roberson)
Re: Using "system" command - is it "bad practice" for p <tintin@invalid.invalid>
Re: Using "system" command - is it "bad practice" for p <Joe.Smith@inwap.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 28 Sep 2004 07:35:27 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Precedence of exponentiation
Message-Id: <3v86d.122127$MQ5.77934@attbi_s52>
David Frauzel wrote:
> The double standard, coupled with
> the illogical precedence to begin with, smells of some onerous backwards
> compatibility that probably isn't even relevant any longer.
>
> In building a token parser based on Perl ...
Perl acts differently when it is expecting a term as opposed to when it
is expecting an expression, as in 2**-4.
Perl cannot be parsed simply by looking at tokens.
My favorite example is this:
cat temp.pl
print time / 2 ; # / ; die "This die() is *not* executed!!";
print sort / 2 ; # / ; warn "This warn() *is* executed.";
perl -l temp.pl
-Joe
------------------------------
Date: Tue, 28 Sep 2004 07:42:19 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Precedence of exponentiation
Message-Id: <vB86d.122157$MQ5.34240@attbi_s52>
David Frauzel wrote:
> Arrangement of
> nodes in a hierarchical tree is accomplished using precedence.
Except when certain ops in the grammer have mandatory arguments, in which
case the creation of said arguments is an even higher precedence.
-Joe
------------------------------
Date: Tue, 28 Sep 2004 07:47:04 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Precedence of exponentiation
Message-Id: <YF86d.271861$mD.184752@attbi_s02>
David Frauzel wrote:
> Exactly. So (in the parser) its right side seems to regard ** with
> different precedence than does its left. Right? Er, correct...?
It's not precedence. It's grammer. The way you've phrased the question
indicates that you may not fully understand how yacc and other
compiler compilers work. There's more to parsing than just precedence.
-Joe
------------------------------
Date: Tue, 28 Sep 2004 08:01:21 GMT
From: David Frauzel <nemo@weathersong.net>
Subject: Re: Precedence of exponentiation
Message-Id: <1096358481.+REFL6EXh2AXJkQo5lHw+g@teranews>
Joe Smith <Joe.Smith@inwap.com> wrote in
news:3v86d.122127$MQ5.77934@attbi_s52:
> Perl acts differently when it is expecting a term as opposed to when
> it is expecting an expression, as in 2**-4.
Yes. It seems to be a fairly simple matter to predict what's expected next,
so that such distinctions as the following can be made...
> Perl cannot be parsed simply by looking at tokens.
> My favorite example is this:
>
> cat temp.pl
> print time / 2 ; # / ; die "This die() is *not* executed!!";
> print sort / 2 ; # / ; warn "This warn() *is* executed.";
> perl -l temp.pl
The lexer catches that, though, not the parser. :) It's still all a matter
of tokens - but / / must be recognized as m// in the lexer. A recursive
character-based (state machine) lexical analyzer should be able to handle
such situations.
I think I finally grok'ed my problem, though. I was completely ignoring
that unary minus is right-associative. (Well, and I'm not sure that's all
of it, but I've isolated the bug in my parser and I'm testing a fix for
it.)
------------------------------
Date: Tue, 28 Sep 2004 08:12:20 GMT
From: David Frauzel <nemo@weathersong.net>
Subject: Re: Precedence of exponentiation
Message-Id: <1096359140./ih6GymGWS5LnQ786zj4ZQ@teranews>
Joe Smith <Joe.Smith@inwap.com> wrote in news:YF86d.271861$mD.184752
@attbi_s02:
> It's not precedence. It's grammer. The way you've phrased the question
> indicates that you may not fully understand how yacc and other
> compiler compilers work. There's more to parsing than just precedence.
Yes, there's also associativity, and the very interesting behavior of list
operators (rightward). And I do mean to brush up on yacc one of these days.
I was looking at it when I was first drawing up a blueprint for my parser,
and it seemed far more complex than was necessary for my needs. (And a
little antiquated, for that matter.)
I've been successful so far with my own lexer / parser, so whether or not
I'm using the de facto yacc standard for a parser seems almost beside the
point. :D Though it's made me realize, at least, that my parser questions
aren't really that relevant to the Perl NG, despite that my grammar is
based on Perl.
------------------------------
Date: Tue, 28 Sep 2004 00:56:35 -0700
From: Mark Day <soundz@techie.com>
Subject: printing array problem
Message-Id: <41591933.5030006@techie.com>
Any tips on what I'm doing wrong here appreciated.
I'm using perl version 5.6.1 on Win98,
and this test script i've written, I was hoping would print each element
of this array, on a new line, then print the array again in reverse order.
What actually output's is the same array twice with all elements printed
on the same line.
What is wrong with my attempt to reverse the array, adn why does each
scalar not print on a new line?
thanks.
--code snippet---
#!C:\perl\bin\perl
@array = qq(1 2 3 4 5 6 7 8 9 10 11 12 baker's dozen);
foreach (@array)
{
print $_;
print "\n";
}
@array = reverse @array;
foreach (@array) {
print $_;
print "\n";
}
------------------------------
Date: Tue, 28 Sep 2004 10:06:36 +0200
From: Mark Clements <mark.clements@kcl.ac.uk>
Subject: Re: printing array problem
Message-Id: <41591b89$1@news.kcl.ac.uk>
Mark Day wrote:
> Any tips on what I'm doing wrong here appreciated.
>
> I'm using perl version 5.6.1 on Win98,
>
> and this test script i've written, I was hoping would print each element
> of this array, on a new line, then print the array again in reverse order.
>
> What actually output's is the same array twice with all elements printed
> on the same line.
>
> What is wrong with my attempt to reverse the array, adn why does each
> scalar not print on a new line?
>
> thanks.
>
> --code snippet---
>
> #!C:\perl\bin\perl
>
> @array = qq(1 2 3 4 5 6 7 8 9 10 11 12 baker's dozen);
qq() gives you an interpolated string - man perlop. what you are
effectively doing here is
@array = "1 2 3 4 5 6 7 8 9 10 11 12 baker's dozen";
which will set $array[0] to "1 2 3 4 5 6 7 8 9 10 11 12 baker's dozen"
and leave the rest of the array empty.
you probably mean
my @array = qw(1 2 3 4 5 6 7 8 9 10 11 12 baker's dozen);
though that will give you "baker's" and "dozen" as separate array elements.
You can also skip the
@array = reverse @array
step
ie
foreach( reverse @array){
...
Mark
------------------------------
Date: 28 Sep 2004 08:09:53 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: printing array problem
Message-Id: <cjb68h$mt4$1@mamenchi.zrz.TU-Berlin.DE>
Mark Day <soundz@techie.com> wrote in comp.lang.perl.misc:
> Any tips on what I'm doing wrong here appreciated.
>
> I'm using perl version 5.6.1 on Win98,
>
> and this test script i've written, I was hoping would print each element
> of this array, on a new line, then print the array again in reverse order.
>
> What actually output's is the same array twice with all elements printed
> on the same line.
>
> What is wrong with my attempt to reverse the array, adn why does each
> scalar not print on a new line?
>
> thanks.
>
> --code snippet---
>
> #!C:\perl\bin\perl
>
> @array = qq(1 2 3 4 5 6 7 8 9 10 11 12 baker's dozen);
[snip]
Look up what qq() does. I guess you meant to say qw() instead.
Anno
------------------------------
Date: Tue, 28 Sep 2004 09:11:43 +0100
From: Graham Wood <Graham.T.Wood@oracle.com>
Subject: Re: printing array problem
Message-Id: <41591CBF.9413704D@oracle.com>
Mark Day wrote:
>
> hoping would print each element
> of this array, on a new line, then print the array again in reverse order.
>
> What is wrong with my attempt to reverse the array, adn why does each
> scalar not print on a new line?
>
>
> #!C:\perl\bin\perl
>
> @array = qq(1 2 3 4 5 6 7 8 9 10 11 12 baker's dozen);
Your problem is that you're using qq which will surround the contents of
the parenthesis with double quotes rather than qw which will surround
each word in the parenthesis with double quotes. You are basically
creating and array with one element in it: "1 2 3 4 5 6 7 8 9 10 11 12
baker's dozen" and reversing this then gives you the same single element
in reverse order.
Replace qq with qw and see what happens.
Graham
>
> foreach (@array)
>
> {
>
> print $_;
>
> print "\n";
>
> }
>
> @array = reverse @array;
>
> foreach (@array) {
>
> print $_;
>
> print "\n";
>
> }
------------------------------
Date: Tue, 28 Sep 2004 01:09:08 -0700
From: Mark Day <soundz@techie.com>
Subject: Re: printing array problem
Message-Id: <41591C24.9090601@techie.com>
Mark Clements wrote:
> qq() gives you an interpolated string - man perlop. what you are
> effectively doing here is
>
> @array = "1 2 3 4 5 6 7 8 9 10 11 12 baker's dozen";
>
> which will set $array[0] to "1 2 3 4 5 6 7 8 9 10 11 12 baker's dozen"
> and leave the rest of the array empty.
>
> you probably mean
>
> my @array = qw(1 2 3 4 5 6 7 8 9 10 11 12 baker's dozen);
> though that will give you "baker's" and "dozen" as separate array elements.
>
> You can also skip the
>
> @array = reverse @array
>
> step
>
> ie
>
> foreach( reverse @array){
>
> ...
>
> Mark
Great! thanks.
------------------------------
Date: 28 Sep 2004 08:47:21 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: printing array problem
Message-Id: <cjb8ep$mt4$5@mamenchi.zrz.TU-Berlin.DE>
Graham Wood <Graham.T.Wood@oracle.com> wrote in comp.lang.perl.misc:
> Mark Day wrote:
[...]
> > @array = qq(1 2 3 4 5 6 7 8 9 10 11 12 baker's dozen);
>
> Your problem is that you're using qq which will surround the contents of
> the parenthesis with double quotes rather than qw which will surround
> each word in the parenthesis with double quotes.
That is wrong. "qw()" treats the whole string as single quoted,
then splits the result on whitespace.
Anno
------------------------------
Date: Tue, 28 Sep 2004 06:18:34 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Problem in getting results on browser ...
Message-Id: <_m76d.62443$wV.46850@attbi_s54>
Karuna wrote:
> And this happens (sudden exit at browser level) exactly at
> 3-4 mins from the time I would have started running tests.
Browsers will give up and decide that the server is not responding
if they don't get any output for 3 minutes. You have to output
something to keep the browser happy.
http://www.stonehenge.com/merlyn/WebTechniques/col20.html
-Joe
------------------------------
Date: Mon, 27 Sep 2004 23:12:16 -0400
From: Matt <nospamcyatlmatt@hotmail.com>
Subject: process control
Message-Id: <10lhvgcr519bk10@corp.supernews.com>
I am having a process control problem with one of my Perl scripts.
Basically, I have a couple lines at the beginning of my script that are of
the form:
system("export path1"); #Note path1 and path2 are just dummy strings here
system("export path2");
system("catutil -i file1 -o file2");
The problem I am having is that I don't want to execute the catutil command
until the exports are done above. From what I read, I thought a system
command would pause until the process was done, but it doesn't appear to
work that way in this case. I'm thinking this might be because the exports
are shell commands?
Anyway, what I did as a workaround seems to work. What I did was take the
exports out of the perl program and create an executable file that had the
following lines:
export path1
export path2
perlfile.pl
This works, but now I have a shell wrapper doing some things before calling
the perl program. Is there a way to get this to work without the shell
wrapper (i.e. self contained in the perl program).
Thank you so much in advance for your help.
------------------------------
Date: Tue, 28 Sep 2004 06:46:58 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: process control
Message-Id: <CN76d.5276$ku4.1474@trnddc01>
Matt wrote:
> I am having a process control problem with one of my Perl scripts.
> Basically, I have a couple lines at the beginning of my script that
> are of the form:
>
> system("export path1"); #Note path1 and path2 are just dummy strings
> here
Ok, so you are forking a new process which will do something called export
and then terminate.
> system("export path2");
And then you are forking a second process which will do some other export
and then terminate.
> system("catutil -i file1 -o file2");
And then you are forking a third process. None of those three processes has
anything to do with the others.
> The problem I am having is that I don't want to execute the catutil
> command until the exports are done above. From what I read, I
> thought a system command would pause until the process was done, but
system() does wait until the called program terminates.
> it doesn't appear to work that way in this case. I'm thinking this
> might be because the exports are shell commands?
No, that is not the problem. You have a serious misunderstanding about how
environments are inherited and propagated between processes. If you start
three sibling processes then they will inherit their environment from their
parent, not from each other. Please see the FAQ:
I {changed directory, modified my environment} in a perl script. How come
the change disappeared when I exited the script? How do I get my changes to
be visible?
Why don't you set the environment directly in your Perl script instead of
forking a child process (check the %ENV hash in "perldoc perlvar")?
jue
------------------------------
Date: Tue, 28 Sep 2004 06:49:55 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: process control
Message-Id: <nQ76d.271798$mD.28466@attbi_s02>
Matt wrote:
> The problem I am having is that I don't want to execute the catutil command
> until the exports are done above. From what I read, I thought a system
> command would pause until the process was done, but it doesn't appear to
> work that way in this case. I'm thinking this might be because the exports
> are shell commands?
You already posted this question. Didn't you like any of the answers
that you've received?
> system("export path1");
That will create a new shell process, set one variable in the process,
then that process exits, completely negating the export.
> system("export path2");
Same.
> system("catutil -i file1 -o file2");
That fails because you have not set the enviroment variables.
$ENV{path1}='/usr/foo'; $ENV{path2}='/usr/bar'; system("...");
> Is there a way to get this to work without the shell wrapper
That's in the FAQ. You should read it.
-Joe
------------------------------
Date: Tue, 28 Sep 2004 00:45:35 -0400
From: Matt <nospamcyatlmatt@hotmail.com>
Subject: Re: process control
Message-Id: <10li4v774nvvkda@corp.supernews.com>
NO! Actually, I didn't post this question. Thanks though.
Joe Smith wrote:
> Matt wrote:
>
>> The problem I am having is that I don't want to execute the catutil
>> command
>> until the exports are done above. From what I read, I thought a system
>> command would pause until the process was done, but it doesn't appear to
>> work that way in this case. I'm thinking this might be because the
>> exports are shell commands?
>
> You already posted this question. Didn't you like any of the answers
> that you've received?
>
>> system("export path1");
>
> That will create a new shell process, set one variable in the process,
> then that process exits, completely negating the export.
>
>> system("export path2");
>
> Same.
>
>> system("catutil -i file1 -o file2");
>
> That fails because you have not set the enviroment variables.
>
> $ENV{path1}='/usr/foo'; $ENV{path2}='/usr/bar'; system("...");
>
>> Is there a way to get this to work without the shell wrapper
>
> That's in the FAQ. You should read it.
> -Joe
------------------------------
Date: Tue, 28 Sep 2004 00:53:42 -0400
From: Matt <nospamcyatlmatt@hotmail.com>
Subject: Re: process control
Message-Id: <10li5ef7ldgi27e@corp.supernews.com>
Yes, it is very possible that I have a serious misunderstanding about how
environments are inherited and propogated between processes. I will work
on that. However, process control is a little beyond the scope of what I
typically need to do with Perl.
In any case, I was looking for a more general answer to the question. Not
so much how do I solve that exact problem, but how can you execute a system
command so that it completes before moving on to the next process. Why
would an executable shell wrapper of the following form work:
command1
command2
perlscript.pl
However, when I try to integrate command1 and command2 into perlscript.pl
using
system("command1");
system("command2");
it doesn't work.
Thanks.
Jürgen Exner wrote:
> Matt wrote:
>> I am having a process control problem with one of my Perl scripts.
>> Basically, I have a couple lines at the beginning of my script that
>> are of the form:
>>
>> system("export path1"); #Note path1 and path2 are just dummy strings
>> here
>
> Ok, so you are forking a new process which will do something called export
> and then terminate.
>
>> system("export path2");
>
> And then you are forking a second process which will do some other export
> and then terminate.
>
>> system("catutil -i file1 -o file2");
>
> And then you are forking a third process. None of those three processes
> has anything to do with the others.
>
>> The problem I am having is that I don't want to execute the catutil
>> command until the exports are done above. From what I read, I
>> thought a system command would pause until the process was done, but
>
> system() does wait until the called program terminates.
>
>> it doesn't appear to work that way in this case. I'm thinking this
>> might be because the exports are shell commands?
>
> No, that is not the problem. You have a serious misunderstanding about how
> environments are inherited and propagated between processes. If you start
> three sibling processes then they will inherit their environment from
> their parent, not from each other. Please see the FAQ:
> I {changed directory, modified my environment} in a perl script. How
> come
> the change disappeared when I exited the script? How do I get my changes
> to be visible?
>
> Why don't you set the environment directly in your Perl script instead of
> forking a child process (check the %ENV hash in "perldoc perlvar")?
>
> jue
------------------------------
Date: Tue, 28 Sep 2004 07:51:23 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: process control
Message-Id: <%J86d.5280$ku4.2426@trnddc01>
[Please do not top post]
[Please do not blindly full quote]
Matt wrote:
> Yes, it is very possible that I have a serious misunderstanding about
> how environments are inherited and propogated between processes. I
> will work on that. However, process control is a little beyond the
> scope of what I typically need to do with Perl.
Ok, fine, whatever.
> In any case, I was looking for a more general answer to the question.
> Not so much how do I solve that exact problem, but how can you
> execute a system command so that it completes before moving on to the
> next process.
What you describe above is the designed behaviour of system() already.
If you experience a different behaviour then please post a minimal but
complete Perl program, such that others can reproduce the problem (or more
likely point out where you have a misunderstanding in your expectations).
> Why would an executable shell wrapper of the following
> form work:
>
> command1
> command2
> perlscript.pl
>
> However, when I try to integrate command1 and command2 into
> perlscript.pl using
>
> system("command1");
> system("command2");
>
> it doesn't work.
Without knowing what command1, command2, and perlscript.pl do there is no
way of telling.
jue
------------------------------
Date: 28 Sep 2004 02:47:08 -0700
From: s99999999s2003@yahoo.com (mike)
Subject: Re: process control
Message-Id: <dfd17ef4.0409280147.5c229cb1@posting.google.com>
Matt <nospamcyatlmatt@hotmail.com> wrote in message news:<10lhvgcr519bk10@corp.supernews.com>...
> I am having a process control problem with one of my Perl scripts.
> Basically, I have a couple lines at the beginning of my script that are of
> the form:
>
> system("export path1"); #Note path1 and path2 are just dummy strings here
> system("export path2");
>
> system("catutil -i file1 -o file2");
>
> The problem I am having is that I don't want to execute the catutil command
> until the exports are done above. From what I read, I thought a system
> command would pause until the process was done, but it doesn't appear to
> work that way in this case. I'm thinking this might be because the exports
> are shell commands?
>
> Anyway, what I did as a workaround seems to work. What I did was take the
> exports out of the perl program and create an executable file that had the
> following lines:
>
> export path1
> export path2
> perlfile.pl
>
> This works, but now I have a shell wrapper doing some things before calling
> the perl program. Is there a way to get this to work without the shell
> wrapper (i.e. self contained in the perl program).
>
> Thank you so much in advance for your help.
hi
maybe you could look up perldoc -f system. There , there is method to
get exit status. You could check for exit status before proceeding to
the next system() command in your script. For exporting variables, the
%ENV hash can be used. Hope it helps a bit...
------------------------------
Date: 27 Sep 2004 19:41:05 -0700
From: eight02645999@yahoo.com (justme)
Subject: question on capturing keys
Message-Id: <c0837966.0409271841.381f9805@posting.google.com>
hi
i read that Term::ReadKey can capture keys typed on the keyboard.so if
i code a perl script to capture keys typed using Term::ReadKey and run
the perl script as background process in Windows
environment(Win32::process maybe?), will it still capture any keys
typed?
thanks..
------------------------------
Date: 28 Sep 2004 03:29:28 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: question on capturing keys
Message-Id: <cjalqo$57r$1@canopus.cc.umanitoba.ca>
In article <c0837966.0409271841.381f9805@posting.google.com>,
justme <eight02645999@yahoo.com> wrote:
:i read that Term::ReadKey can capture keys typed on the keyboard.so if
:i code a perl script to capture keys typed using Term::ReadKey and run
:the perl script as background process in Windows
:environment(Win32::process maybe?), will it still capture any keys
:typed?
No, Term::ReadKey only reads keystrokes on the device or file
whose filehandle it operates on. On Unix systems, that is usually
either STDIN or /dev/tty . In either case, it's the input stream to
a single process, not to the overall system.
Unix is inherently a multiuser operating system, and does not have
the concept of "the keyboard" as such -- at the Term::ReadKey level,
it just knows about byte streams, which could be coming from any
of a number of different sources. One of those sources might happen
to be the only keyboard physically attached to the computer, but
unix does not make that distinction at the Term::ReadKey level,
and is equally happy dealing with keystrokes coming via the network
from machines halfway around the world.
The Term::Readkey module is more or less intended to be a portable
emulation of the way Unix handles bytestreams that might come from
keyboards [but might not.]
Historically, there was much more of an assumption in Windows
that there was *a* keyboard, and that it is physically attached
to the computer, and that the one and only user is typing on it.
Modern versions of Windows have cleaned all that up internally,
but still give ways to hook into keystrokes from "the" keyboard.
It isn't that Windows can do something that Unix cannot -- it's
more that Unix has a clear notion that there can be multiple
displays and multiple keyboards, and it divorces that from the level
that the majority of "Unix" operates at. In Unix, if you wanted
to "capture keys in the background", then the way to do it would
be to put a transparent window "on top" of the other windows for
a particular "display", and arrange to have that transparent
window receive all the <key> notifications... and to pass those
notifications on to the next window down after doing whatever it
needs to do. But that's operated on an event+callback structure,
not by using anything like the Term::ReadKey level. Keystrokes
that make it through the X event loop get turned into characters
that are sent to the character device driver that is the level
that Term::ReadKey interacts with.
I do not know what the method would be in MS Windows to read all the
keystrokes. It would depend in part on which version of Windows,
with noticable differences between the NT and non-NT versions.
("Windows XP" is an NT version, but Windows 98 was non-NT.)
When you are investigating these methods, you need to ask yourself
what is it -exactly- that you want to record. If, for example, the
user presses the left SHIFT key and releases it again, do you want
to record that press and that release? If the user is holding down
the left SHIFT key and presses the 'a' key, then do you want to receive
"<capital-A> pressed, <capital-A> released" notifications, or do you want
"<left-shift> pressed, <a> pressed, <a> released, <left-shift> released" ?
Do you need to differentiate between left-shift and right-shift? Do you
need to record only those keystrokes that occur within a particular window,
or do you need to record *all* keystrokes -- for example, do you need
to record that the user has just gone up to the window frame and gone
through the menus to "Save", or do you want to ignore that and just
record typing? Or just record mouse-positioning and button presses
within the window (e.g., for a "paint" program) ? What about when the
user is using non-English keyboards or non-English text: do you need
the "o" stroke seperate from the "umlaut" stroke to go over it, or
do you want just the "o-umlaut" character?
--
Admit it -- you peeked ahead to find out how this message ends!
------------------------------
Date: Tue, 28 Sep 2004 14:11:55 +1200
From: "Tintin" <tintin@invalid.invalid>
Subject: Re: Using "system" command - is it "bad practice" for perl?
Message-Id: <2rrvhrF1e2vn0U1@uni-berlin.de>
"John Davis" <tudmuf2b@onebox.com> wrote in message
news:7167a8d.0409271549.346b0779@posting.google.com...
>A couple of quick questions, it is considered "bad" perl programming
> (from a style perspective) to ever use the system() command to call
> UNIX level commands in a script, or should the "backtick"/exec method
> be used at all times (if possible).
They both do different things, so it depends on the circumstances.
On a general note, if you find your Perl script is full of system commands,
then you either aren't using the native Perl equivalents, or the script
would have been better written as a shell script.
------------------------------
Date: Tue, 28 Sep 2004 06:39:42 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Using "system" command - is it "bad practice" for perl?
Message-Id: <NG76d.168941$3l3.151446@attbi_s03>
John Davis wrote:
> A couple of quick questions, it is considered "bad" perl programming
> (from a style perspective) to ever use the system() command to call
> UNIX level commands in a script, or should the "backtick"/exec method
> be used at all times (if possible).
Use system() for anything that is interactive, like "vi", where the output
is expect to go directly to the screen (STDOUT).
Use backticks when you want to process the program's output yourself.
It's not a question of "bad" programming practice if you use the wrong
one; it's just that your program won't work with the wrong one.
-Joe
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 7186
***************************************