[15593] in Perl-Users-Digest
Perl-Users Digest, Issue: 3006 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 10 14:15:43 2000
Date: Wed, 10 May 2000 11:15:22 -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: <957982522-v9-i3006@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 10 May 2000 Volume: 9 Number: 3006
Today's topics:
Re: Strange Characters from Perl Script <bmb@ginger.libs.uga.edu>
Re: Strange Characters from Perl Script <nospam@devnull.com>
Re: Strange Characters from Perl Script <uri@sysarch.com>
System call (newbie) <crips@control.auc.dk>
Re: System call (newbie) <tony_curtis32@yahoo.com>
Re: System call (newbie) <crips@control.auc.dk>
Re: System call (newbie) <tony_curtis32@yahoo.com>
Re: System call (newbie) (Tad McClellan)
Re: System call (newbie) <crips@control.auc.dk>
Re: URGENT HELP WITH REGEXP REQUIRED <lr@hpl.hp.com>
Re: using Perl's RE to do basic manipulation of a flex (Bart Lateur)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 10 May 2000 11:34:09 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Strange Characters from Perl Script
Message-Id: <Pine.A41.4.10.10005101131240.12498-100000@ginger.libs.uga.edu>
On Wed, 10 May 2000, David Guiney wrote:
> Thanks very much for your reply. Your solution worked well and the tip for
> creating the form and parsing it within one script will be useful in the
> future.
>
> Since I recently started writing in perl I have collected a variety of read
> and parse routines. I hadn't actually went through all of them in fine
> detail to see what was going on, so when the script worked in Windows but
> not unix I didn't suspect a problem here. Some of the other routines which I
> have used in the past work also. I will not take any code on trust again!
>
> Thanks again,
>
> David
[snip]
You would do very well to heed Larry's suggestion:
>Replace your input parsing with CGI.pm, right away.
In particular, don't use the solution you are referring to above; it's
wrong.
--
Brad
------------------------------
Date: 10 May 2000 17:02:03 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: Strange Characters from Perl Script
Message-Id: <8fc4mb$7pv$1@216.155.32.13>
In article <3918C27F.A21D31E0@stomp.stomp.tokyo>, "Godzilla!"
<godzilla@stomp.stomp.tokyo> wrote:
[snip]
| I have tossed in a few of the most often used
| environmental variables for you. Hopefully
| these basic variables will work on your
| internet service provider.
[snip]
the 45-char linewrapping gets quite annoying.. any way you can change
that?
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: Wed, 10 May 2000 17:16:46 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Strange Characters from Perl Script
Message-Id: <x7ln1itjer.fsf@home.sysarch.com>
>>>>> "TW" == The WebDragon <nospam@devnull.com> writes:
TW> In article <3918C27F.A21D31E0@stomp.stomp.tokyo>, "Godzilla!"
TW> <godzilla@stomp.stomp.tokyo> wrote:
TW> [snip]
TW> | I have tossed in a few of the most often used
TW> | environmental variables for you. Hopefully
TW> | these basic variables will work on your
TW> | internet service provider.
TW> [snip]
TW> the 45-char linewrapping gets quite annoying.. any way you can change
TW> that?
that is the least of her annoying traits. stupidity and ignorance rank
much higher. and in general here we try to ignore her in hope she will
go away. only when we have to correct her idiotic code (which is too
often) do we follow up. note her technique of only pouncing on newbies
and selling them her line of goods. it always seems to work for one
exchange until the newbies wise up and see her for the troll she
is. purlmoron never jumps in on syntax and semantic threads, anything to
do with refs or objects, just trivial web related things. in fact she
can't even run perl without her web site so she make any non web things
into web things thereby complicating the issue.
so, it is best to simply ignore her. she has multiple aliases but
nothing disguises her lousy perl skills.
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: Wed, 10 May 2000 15:28:19 GMT
From: Jesper Birkholm Marcher Hansen <crips@control.auc.dk>
Subject: System call (newbie)
Message-Id: <Pine.GSO.4.10.10005101718001.24487-100000@prosit.control.auc.dk>
Hi!
I've tried to find some info about executing system calls, but I haven't
really found anything which describes what to do in "newbie language".
My problem is that I've written a perl script which executes a number of
system calls (using the "system" command) depending on some arguments. Now
when I try to make tab-completion on a command from my bash it works
nicely - that is, the script or binary which I try to find is located
somewhere in my PATH. However, when I try to execute this command with a
system call from perl, the command is not found. It seems that perl is not
paying attention to my PATH environment variable. Why is this and how do I
make it work?
I'm using a Solaris OS.
regards,
Jesper Hansen
------------------------------
Date: 10 May 2000 10:34:16 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: System call (newbie)
Message-Id: <87bt2ewhaf.fsf@shleppie.uh.edu>
>> On Wed, 10 May 2000 15:28:19 GMT,
>> Jesper Birkholm Marcher Hansen <crips@control.auc.dk> said:
> Hi! I've tried to find some info about executing system
> calls, but I haven't really found anything which
> describes what to do in "newbie language".
Ahhh, this isn't a "system call", you'd want "syscall" for
that. You want to run an external command from perl. The
name "system" is rather confusing initally though.
> My problem is that I've written a perl script which
> executes a number of system calls (using the "system"
> command) depending on some arguments. Now when I try to
> make tab-completion on a command from my bash it works
> nicely - that is, the script or binary which I try to
> find is located somewhere in my PATH. However, when I
> try to execute this command with a system call from
> perl, the command is not found. It seems that perl is
> not paying attention to my PATH environment
> variable. Why is this and how do I make it work?
I suspect you're not telling us something. Is this a CGI
program through some kind of web server? The CGI
environment is usually very restricted as a security
measure.
This site http://www.boutell.com/openfaq/cgi/ may help.
If it isn't CGI, then perhaps the command you're running
aren't real commands in the path, are they perhaps
functions or aliases in the shell?
hth
t
------------------------------
Date: Wed, 10 May 2000 16:23:52 GMT
From: Jesper Birkholm Marcher Hansen <crips@control.auc.dk>
Subject: Re: System call (newbie)
Message-Id: <Pine.GSO.4.10.10005101755530.24487-100000@prosit.control.auc.dk>
On 10 May 2000, Tony Curtis wrote:
> >> On Wed, 10 May 2000 15:28:19 GMT,
> >> Jesper Birkholm Marcher Hansen <crips@control.auc.dk> said:
>
> > Hi! I've tried to find some info about executing system
> > calls, but I haven't really found anything which
> > describes what to do in "newbie language".
>
> Ahhh, this isn't a "system call", you'd want "syscall" for
> that. You want to run an external command from perl. The
> name "system" is rather confusing initally though.
hmm...ok :)
>
> > My problem is that I've written a perl script which
> > executes a number of system calls (using the "system"
> > command) depending on some arguments. Now when I try to
> > make tab-completion on a command from my bash it works
> > nicely - that is, the script or binary which I try to
> > find is located somewhere in my PATH. However, when I
> > try to execute this command with a system call from
> > perl, the command is not found. It seems that perl is
> > not paying attention to my PATH environment
> > variable. Why is this and how do I make it work?
>
> I suspect you're not telling us something. Is this a CGI
> program through some kind of web server? The CGI
> environment is usually very restricted as a security
> measure.
>
Nope...it's not a CGI script. The commands I'm trying to run from my perl
script are both binaries, perl scripts and shell scripts. The first
problem I encounter is when trying to execute a binary called
"regngreyatts" (a home made executable).
From the bash it works without problems. However, when I try
to call "regngreyatts" with this command (from perl):
system "regngreyatts"
an error is generated, saying that the file wasn't found. I guess that
this is due to perl not using the PATH environment variable that I've set
up. As I've mentioned I assume that PATH works from the bash, since my
tab-completion
detects "regngreyatts".
Uhm...I hope this explains my problem a bit better.
> This site http://www.boutell.com/openfaq/cgi/ may help.
>
> If it isn't CGI, then perhaps the command you're running
> aren't real commands in the path, are they perhaps
> functions or aliases in the shell?
>
well...theres no aliases...and I'm not sure I understand the difference
between "real commands" and "functions".
> hth
> t
>
>
Jesper Hansen
------------------------------
Date: 10 May 2000 11:32:55 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: System call (newbie)
Message-Id: <8766smweko.fsf@shleppie.uh.edu>
>> On Wed, 10 May 2000 16:23:52 GMT,
>> Jesper Birkholm Marcher Hansen <crips@control.auc.dk> said:
> Nope...it's not a CGI script. The commands I'm trying to
Damn, that makes it trickier... :-)
> run from my perl script are both binaries, perl scripts
> and shell scripts. The first problem I encounter is when
> trying to execute a binary called "regngreyatts" (a home
> made executable). From the bash it works without
> problems. However, when I try to call "regngreyatts"
> with this command (from perl):
> system "regngreyatts"
> an error is generated, saying that the file wasn't
> found. I guess that this is due to perl not using the
> PATH environment variable that I've set up. As I've
> mentioned I assume that PATH works from the bash, since
> my tab-completion detects "regngreyatts".
The PATH will be passed over in the envirionment untouched
unless you do something to it. Is it possible that PATH
is not being exported for some reason? (Does PATH appear
as expected in the output from the command "printenv"?)
What does this output?
$ perl -e 'system("echo $ENV{PATH}")'
Is it what you'd expect? Is there something in your shell
rc files which distinguishes between interactive shells
and non-interactive ones?
Is this regngreyatts program in the current directory?
Could there be some problem with '.' not being on the PATH
(not that I'm advocating putting it there).
tony
tony
------------------------------
Date: Wed, 10 May 2000 11:49:21 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: System call (newbie)
Message-Id: <slrn8hj181.ii9.tadmc@magna.metronet.com>
On Wed, 10 May 2000 15:28:19 GMT, Jesper Birkholm Marcher Hansen <crips@control.auc.dk> wrote:
>I've tried to find some info about executing system calls,
Have you tried reading the description written by the folks
that wrote the system() code?
perldoc -f system
>but I haven't
>really found anything which describes what to do in "newbie language".
"/bin/sh -c" that means that system() uses the Bourne shell.
>My problem is that I've written a perl script which executes a number of
>system calls (using the "system" command) depending on some arguments. Now
>when I try to make tab-completion on a command from my bash it works
>nicely -
Bourne shell and bash are different programs, with different behavior.
File completion is an interactive thing anyway, what is it that
you are really trying to do?
Don't you know that names of the programs that you want to run?
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 10 May 2000 17:07:01 GMT
From: Jesper Birkholm Marcher Hansen <crips@control.auc.dk>
Subject: Re: System call (newbie)
Message-Id: <Pine.GSO.4.10.10005101845360.25710-100000@prosit.control.auc.dk>
On 10 May 2000, Tony Curtis wrote:
> >> On Wed, 10 May 2000 16:23:52 GMT,
> >> Jesper Birkholm Marcher Hansen <crips@control.auc.dk> said:
> > Nope...it's not a CGI script. The commands I'm trying to
>
> Damn, that makes it trickier... :-)
>
> > run from my perl script are both binaries, perl scripts
> > and shell scripts. The first problem I encounter is when
> > trying to execute a binary called "regngreyatts" (a home
> > made executable). From the bash it works without
> > problems. However, when I try to call "regngreyatts"
> > with this command (from perl):
>
> > system "regngreyatts"
>
> > an error is generated, saying that the file wasn't
> > found. I guess that this is due to perl not using the
> > PATH environment variable that I've set up. As I've
> > mentioned I assume that PATH works from the bash, since
> > my tab-completion detects "regngreyatts".
>
> The PATH will be passed over in the envirionment untouched
> unless you do something to it. Is it possible that PATH
> is not being exported for some reason? (Does PATH appear
> as expected in the output from the command "printenv"?)
>
Well...the printenv command prints all my environment variables when run
from the bash. When run from my perl script using the command:
system "printenv";
the printout is the same.
> What does this output?
>
> $ perl -e 'system("echo $ENV{PATH}")'
>
> Is it what you'd expect? Is there something in your shell
> rc files which distinguishes between interactive shells
> and non-interactive ones?
>
The output is the same as when using "printenv" except that only the PATH
variable is printed (it's the correct path).
I don't think anything is distinguishing between
interactive/non-interactive shells.
> Is this regngreyatts program in the current directory?
> Could there be some problem with '.' not being on the PATH
> (not that I'm advocating putting it there).
>
The program is not in the current working directory. The reason for
calling "regngreyatts" without a path is that only the program name is
known. The path depends on where the user has placed the program, which
means that the user should make sure that PATH points that directory.
It doesn't seem that the '.' in my path is a problem.
> tony
>
>
> tony
>
>
Jesper
------------------------------
Date: Wed, 10 May 2000 10:10:32 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: URGENT HELP WITH REGEXP REQUIRED
Message-Id: <MPG.138337e87c881c5798aa4a@nntp.hpl.hp.com>
In article <39195477.18151064@news.skynet.be> on Wed, 10 May 2000
12:23:12 GMT, Bart Lateur <bart.lateur@skynet.be> says...
> vlad55@my-deja.com wrote:
>
> >my $newhtml =~ s/<!--[\n\t\r\ ]+VMySQLQueryParser$oldfunc\-->$old<!--
> >[\n\t\r\ ]+END[\n\t\r\ ]+-->/<!-- VMySQLQueryP ... .../gs;
>
> >treats the $oldfunc as a search pattern instead of static text, so if
> >the $func (or $old) contains chars like [,],(,),* etc.. it tries to
> >match them...
> >
> >is there a quick workaround this?
>
> In the pattern, repalce "$oldfunc" with
>
> \Q$oldfunc\E
>
> And please don't shout.
Just a couple of gratuitous observations:
[\n\t\r\ ]
seems to be your attempt to denote a whitespace character. If you don't
mind tossing "\f" into the soup (and why should you?), you can gain
clarity by replacing that character class by
\s
Also, the /s regex modifier affects only the interpretation of the '.'
metacharacter, of which there are none in your regex.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 10 May 2000 15:23:18 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: using Perl's RE to do basic manipulation of a flex file
Message-Id: <39197cd8.28488114@news.skynet.be>
Ron Grabowski wrote:
>>I understood that. The problem that I have, and the reason why I didn't
>>reply before, is with the //s modifier. Apparently you want to allow
>>multiline code blocks. That implies that you cannot process this data
>>one line at a time? Ooh...
>
>That is correct. In my original post I said:
>
> The information between the brackets that
> contain the 'return' does not have to be on one-line:
>
> {ANOTHER_TOKEN}[0-9]
>
> blah();
> return TOKEN2 ;
> }
> is valid too.
There must be an opening brace missing. Now, maybe this has to be on the
same line as the pattern. That would give us something to hold on to. If
not, reliably differentiating between patterns and code blocks won't be
that easy.
>What I'm trying to do doesn't seem all that difficult. I have a beginning
>pattern and an ending pattern and I want to match everything inside of those
>two.
Except that you can't really say that there will only be opening and
closing braces. These could be nested! A "}" could be part of a literal
string in the code! Basically, you need to poperly parse the C code
block in order never to make any mistakes.
Perhaps you could take a look at the module Text::Balanced, which is
part of the Parse::RecDescent package. This package allows you to do do
Yacc stuff in plain Perl; with perl output. Certainly, a grammar
directed parser would succeed flawlessly, but perhaps it's a bit too
much (It ain't too fast).
But, and this is what I was trying to come to: Parse::RecDescent does
pretty much what you're trying to do here: the grammars consist of
grammar elements, and *plain perl code*. The grammar parser must be able
to distinguish the Perl code from the elements, and Text::Balanced is
the tools that is used to do that. I think. I haven't studied it that
closely just yet.
--
Bart.
------------------------------
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 3006
**************************************