[19936] in Perl-Users-Digest
Perl-Users Digest, Issue: 2131 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 14 14:06:38 2001
Date: Wed, 14 Nov 2001 11:05:12 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1005764711-v10-i2131@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 14 Nov 2001 Volume: 10 Number: 2131
Today's topics:
Re: Accessing NT Network Neighbourhood <s.i.warhurst@rl.ac.uk>
Re: backward compatible? <pne-news-20011114@newton.digitalspace.net>
Re: code phrases (Houda Araj)
distributing balanced elements across entities (RE solu (=?ISO-8859-1?Q?sh=F2wd=F6g?=)
Re: ebcdic, was Re: Unencoding <uri@stemsystems.com>
Re: help with system calls (not a path problem) <kestrel@mit.edu>
Re: help with system calls (not a path problem) <kestrel@mit.edu>
Learning Perl Book Example problem <tatkins@aug.com>
Re: Learning Perl Book Example problem <Tassilo.Parseval@post.rwth-aachen.de>
Re: Learning Perl Book Example problem <echang@netstorm.net>
Re: Learning Perl Book Example problem <tatkins@aug.com>
Match a pattern plus the next 3 lines... (rab)
Re: Match a pattern plus the next 3 lines... <Tassilo.Parseval@post.rwth-aachen.de>
Re: Match a pattern plus the next 3 lines... <Laocoon@eudoramail.com>
Re: Match a pattern plus the next 3 lines... <Tassilo.Parseval@post.rwth-aachen.de>
Re: Need help with strange performance problem processi (Tim Moose)
Re: Newbie Question, pls HELP!! nobull@mail.com
Performance issues related to $&, $` and $' <witkowsk@pop900.gsfc.nasa.gov>
Re: Performance issues related to $&, $` and $' <uri@stemsystems.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 14 Nov 2001 16:41:36 -0000
From: "S Warhurst" <s.i.warhurst@rl.ac.uk>
Subject: Re: Accessing NT Network Neighbourhood
Message-Id: <9su6s1$pp6@newton.cc.rl.ac.uk>
"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message
news:3BF29522.EB81402F@stomp.stomp.tokyo...
[..]
> Develop logical search terms related to network file permissions,
> moving network files and similar. You will find answers after
> looking through a lot of search engine returns.
Thanks for having a look. I found various pages on permissions issues but
none specific to what I want to do yet.. ie: mainly Unix & things like
setting the permissions on the script itself with CHMOD. Also, some pages
mentioned the user account the web server runs under and setting uid's..
"nobody" came up often but I tihnk these terms were Unix again. IIS on NT
runs on a special user account, but I can't find one for Apache in NT User
Manager, so maybe it doesn't work in teh same way as IIS.
Will keep looking anyway, as I really need to crack this one.
Regards
Spencer
------------------------------
Date: Wed, 14 Nov 2001 17:10:32 +0100
From: Philip Newton <pne-news-20011114@newton.digitalspace.net>
Subject: Re: backward compatible?
Message-Id: <qn55vt8ga11hmrre982u06u5qbc2thbrvf@4ax.com>
On Wed, 14 Nov 2001 16:08:01 +0100, "Fringel" <robert@context.nl> wrote:
> Is the new version of Perl 5.6 backward compatible with the script written
> for Perl 5.005.
Mostly, yes.
> Or are there cases known for wich I have to edit my script in order to run
> them in v5.6.
If you download the source distribution, have a look at the file
pod/perl56delta.pod and (if you're really curious) Changes5.6. Possibly
also pod/perldelta.pod.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: 14 Nov 2001 09:08:57 -0800
From: Houda.araj@cogmedia.com (Houda Araj)
Subject: Re: code phrases
Message-Id: <36cd2dbf.0111140908.4bea77d7@posting.google.com>
What do you mean by highlight?
This is an example of what I meant by highlight text.
Source.txt
Your AdWords text ads appear on search result pages for the keywords
you buy, and can be targeted by language and country. So, to reach
collectors of tin toys you might buy the keywords "toy collector,"
"tin toys," etc.
Phrases.txt
AdWords text
Keywords
tin toys
Expected output (highlighted text)
Your (AdWords text) ads appear on search result pages for the
(keywords) you buy, and can be targeted by language and country. So,
to reach collectors of (tin toys) you might buy the keywords "toy
collector," "tin toys," etc.
------------------------------
Date: 14 Nov 2001 10:09:26 -0800
From: showdog@my-deja.com (=?ISO-8859-1?Q?sh=F2wd=F6g?=)
Subject: distributing balanced elements across entities (RE solution preferred)
Message-Id: <187c116b.0111141009.24c93067@posting.google.com>
here's my dilemma
I have a string such as (linebreaks for clarity, actually all on one
line):
=c1 =it foo
=c2 bar
=c3 baz =ro
=c4 yadda yadda
=c5 =it still more text =ro
where the =it and =ro are the opening and closing elements. What I
need in the result is (again, linebreaks for clarity):
=c1 =it foo =ro
=c2 =it bar =ro
=c3 =it baz =ro
=c4 yadda yadda
=c5 =it still more text =ro
any suggestions? I have _no_ idea how to do this -- I've tried
negative look ahead assertions and such but no joy!
Thanks in advance
------------------------------
Date: Wed, 14 Nov 2001 18:45:36 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: ebcdic, was Re: Unencoding
Message-Id: <x7n11pgpga.fsf@home.sysarch.com>
>>>>> "AJF" == Alan J Flavell <flavell@mail.cern.ch> writes:
AJF> In the URI-encoded string, the three-character sequence %xy,
AJF> where x and y are hexadecimal digits, represents the ASCII-based
AJF> coding of the desired octet in the URI itself; but the three
AJF> individual characters, % , x , and y would, at this point in the
AJF> protocol (i.e on the EBCDIC CGI interface between the CGI process
AJF> and its HTTPD) be expressed in EBCDIC characters.
AJF> Has that made it any clearer, or just added more confusion ?!?
that is clearer to me. :) and now can you describe how to dynamically
output an html page with hrefs which have encoded urls in them? i refuse
to take on your metnal therapy bills if you attempt that.
we all agree that there are all sorts of places to confuse which char set
is used in which place in the data stream. you can have ascii encoding
but represented by ebcdic, etc. who does what to what and where and when
is not specified anywhere i think and is up to the server/cgi design.
AJF> Now don't get me started on IBM mainframe Postscript format. As I
AJF> recall it, the Postscript directives were in ASCII and the embedded
AJF> data in EBCDIC. Or maybe it was the other way around, and I sure
AJF> don't want to remember. :-{
GACK! and in postscript (like lisp or perl or anything with eval), code
and data are potentially interchangeable.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
-- Stem is an Open Source Network Development Toolkit and Application Suite -
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Wed, 14 Nov 2001 14:00:56 -0500
From: "J" <kestrel@mit.edu>
Subject: Re: help with system calls (not a path problem)
Message-Id: <3bf2bf68$0$3930$b45e6eb0@senator-bedfellow.mit.edu>
Thanks -- I upgraded to build 630 and this time installed Perl to the same
drive as Windows, and the problem has disappeared!
-- J
"Jessica Bull" <jessica.bull@broadwing.com> wrote in message
news:YOvI7.152514$7x1.11449104@bin4.nnrp.aus1.giganews.com...
> Maybe try to update your ActivePerl to the most recent build? I run build
> 629 and do not have any of the problems you list. (I also use the same
OS)
> I believe the latest build is 630. I am not sure this will fix your
problem
> (which is strange) but it may be worth a shot.
>
>
------------------------------
Date: Wed, 14 Nov 2001 14:03:17 -0500
From: "J" <kestrel@mit.edu>
Subject: Re: help with system calls (not a path problem)
Message-Id: <3bf2bff5$0$3932$b45e6eb0@senator-bedfellow.mit.edu>
Well, I've got it working now (see reply above) but I greatly appreciate the
link. Thanks!
-- J
"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message
news:3BF28CD7.2BBC1877@stomp.stomp.tokyo...
> J wrote:
>
> (snipped)
>
> > The problem appears to be that Perl can't find the command shell
(cmd.exe),
> > even though it's sitting in the default location c:\WINNT\system32
(which
> > *is* in my PATH).
>
> > My last hope was ENV{PERL5SHELL}, which the perlwin32 and perlrun
manpages
> > say can be used to control the shell that perl uses to run system() and
> > backtick commands. However, I set that to
>
> > C:\\WINNT\\system32\\cmd.exe\ /x/c
>
> > (and verified it interpolates to "C:\WINNT\system32\cmd /x/c")
>
> > and it still didn't work.
>
> > Any ideas, anyone?
>
>
> http://aspn.activestate.com/ASPN/Mail/Message/perl-win32-porters/681576
>
>
> Godzilla!
------------------------------
Date: Wed, 14 Nov 2001 12:33:36 -0500
From: "Tom Atkins" <tatkins@aug.com>
Subject: Learning Perl Book Example problem
Message-Id: <1005759225.585101@savina>
I am trying to run the examples in the O'Reilly book with Red Hat 7.1. When
I enter the problem as written, just the first Hello World example, set the
execute permission I get errors from bash. If I enter perl and then the file
name it runs OK with no errors. I thought all Linuxes recognized the #! as
calling for the named processor but I get errors from bash not perl.
Thanks for any help
------------------------------
Date: Wed, 14 Nov 2001 18:39:00 +0100
From: "Tassilo v. Parseval" <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Learning Perl Book Example problem
Message-Id: <9sua7k$rg1$06$1@news.t-online.com>
On Wed, 14 Nov 2001 12:33:36 -0500, Tom Atkins wrote:
> I am trying to run the examples in the O'Reilly book with Red Hat 7.1. When
> I enter the problem as written, just the first Hello World example, set the
> execute permission I get errors from bash. If I enter perl and then the file
> name it runs OK with no errors. I thought all Linuxes recognized the #! as
> calling for the named processor but I get errors from bash not perl.
They do, but I just assume you have the wrong shebang line.
ethan@ethan:~$ which perl
/usr/bin/perl
Then '#! /usr/bin/perl -w' must be the first line in your script.
If 'which perl' produces /usr/local/bin/perl then you have to say
'#! /usr/local/bin/perl -w'.
Tassilo
--
We must die because we have known them.
-- Ptah-hotep, 2000 B.C.
------------------------------
Date: Wed, 14 Nov 2001 17:56:31 GMT
From: "E.Chang" <echang@netstorm.net>
Subject: Re: Learning Perl Book Example problem
Message-Id: <Xns915984B0949F3echangnetstormnet@207.106.92.86>
"Tom Atkins" <tatkins@aug.com> wrote in
news:1005759225.585101@savina:
> I am trying to run the examples in the O'Reilly book with Red Hat
> 7.1. When I enter the problem as written, just the first Hello
> World example, set the execute permission I get errors from bash.
> If I enter perl and then the file name it runs OK with no errors. I
> thought all Linuxes recognized the #! as calling for the named
> processor but I get errors from bash not perl.
The #! (shebang) line is the proper way to specify the location of the
Perl interpreter.
You haven't told us your shebang line, the error message, the location
of perl on your system, or any information about how you are creating
the file, so it's difficult to guess what might be wrong.
If the error message is "No such file or directory" there is something
incorrect in the line. One possiblilty is that the path is incorrect.
Do "which perl" to find the correct path.
--
EBC
------------------------------
Date: Wed, 14 Nov 2001 13:43:59 -0500
From: "Tom Atkins" <tatkins@aug.com>
Subject: Re: Learning Perl Book Example problem
Message-Id: <1005763459.133783@savina>
which perl shows /usr/bin/perl
the first line of my script (created with pico total 2 lines) is
#!/usr/bin/perl (I tried a space after ! also)
enter test1 command not found
enter . test1 bash errors
enter perl test1 gets Hello World!
all done in the directory where the file resides
I check and the execute bit is set
"Tom Atkins" <tatkins@aug.com> wrote in message
news:1005759225.585101@savina...
> I am trying to run the examples in the O'Reilly book with Red Hat 7.1.
When
> I enter the problem as written, just the first Hello World example, set
the
> execute permission I get errors from bash. If I enter perl and then the
file
> name it runs OK with no errors. I thought all Linuxes recognized the #! as
> calling for the named processor but I get errors from bash not perl.
>
> Thanks for any help
>
>
------------------------------
Date: 14 Nov 2001 09:48:31 -0800
From: richardbriggs@att.com (rab)
Subject: Match a pattern plus the next 3 lines...
Message-Id: <900b7105.0111140948.5c17a4ff@posting.google.com>
How can I make a script that will search a log file for a text
pattern, say "ERROR" then upon finding the pattern also give me the
next 3 lines in the file?
------------------------------
Date: Wed, 14 Nov 2001 18:55:57 +0100
From: "Tassilo v. Parseval" <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Match a pattern plus the next 3 lines...
Message-Id: <9sub7d$tbk$00$1@news.t-online.com>
On 14 Nov 2001 09:48:31 -0800, rab wrote:
> How can I make a script that will search a log file for a text
> pattern, say "ERROR" then upon finding the pattern also give me the
> next 3 lines in the file?
Assuming FILE is the handle and you are reading in a while-loop:
while (<FILE>) {
if (/PATTERN/) {
push @three_lines, scalar <FILE> for 1 .. 3;
}
}
I suppose someone will have a more elegant solution. I don't like this
'scalar <FILE>' thing very much.
Tassilo
--
The most important service rendered by the press is that of educating
people to approach printed matter with distrust.
------------------------------
Date: Wed, 14 Nov 2001 19:26:25 +0100
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: Match a pattern plus the next 3 lines...
Message-Id: <Xns9159C5CCE5945Laocooneudoramailcom@62.153.159.134>
"Tassilo v. Parseval" <Tassilo.Parseval@post.rwth-aachen.de> wrote in
news:9sub7d$tbk$00$1@news.t-online.com:
> On 14 Nov 2001 09:48:31 -0800, rab wrote:
>> How can I make a script that will search a log file for a text
>> pattern, say "ERROR" then upon finding the pattern also give me the
>> next 3 lines in the file?
>
> Assuming FILE is the handle and you are reading in a while-loop:
>
> while (<FILE>) {
> if (/PATTERN/) {
> push @three_lines, scalar <FILE> for 1 .. 3;
> }
> }
>
> I suppose someone will have a more elegant solution. I don't like this
> 'scalar <FILE>' thing very much.
while (<INPUT>) {
next unless /ERROR/;
$error .= <INPUT> for 1..3
}
> Tassilo
Lao
------------------------------
Date: Wed, 14 Nov 2001 19:33:42 +0100
From: "Tassilo v. Parseval" <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Match a pattern plus the next 3 lines...
Message-Id: <9sude6$jba$02$1@news.t-online.com>
On Wed, 14 Nov 2001 19:26:25 +0100, Laocoon wrote:
> "Tassilo v. Parseval" <Tassilo.Parseval@post.rwth-aachen.de> wrote in
>> while (<FILE>) {
>> if (/PATTERN/) {
>> push @three_lines, scalar <FILE> for 1 .. 3;
>> }
>> }
>>
>> I suppose someone will have a more elegant solution. I don't like this
>> 'scalar <FILE>' thing very much.
>
> while (<INPUT>) {
> next unless /ERROR/;
> $error .= <INPUT> for 1..3
> }
Well, sure. But then you have to split to get an array. But who knows,
it might serve the purpose of the original poster.
Tassilo
--
Don't take life so serious, son, it ain't nohow permanent.
-- Walt Kelly
------------------------------
Date: 14 Nov 2001 08:13:32 -0800
From: wtmoose@yahoo.com (Tim Moose)
Subject: Re: Need help with strange performance problem processing large files
Message-Id: <48a86175.0111140813.250c8ab1@posting.google.com>
> #!/bin/perl
> use strict; # *chanting* Always, always, always...
> use warnings; # *chanting* Always, always, always...
> # and even:
> use diagnostics;
>
> # Use all the help you get.
> Check the return of open. or die "Could not open file. $!"
Thanks, but as the original message suggests, this is a sample program
that I wrote to exhibit the problem I'm having with a larger script.
There is no need for these statements here unless they affect
performance in some way that I am unaware of.
> | } else {
> | # Delete three characters. Is that so bad?
> | s/....//;
>
> That's four dots!?
> Why not
> substr($_, 3);
Typo. I mean't "four". Besides, substr($_, 3) is not equivalent to
s/...//. The latter expression deletes three characters. Again, this
program is setup to intentionally exhibit a peculiar performance
problem.
> I suggest you first start using strict and warnings. Sorry I couldn't help
> any more.
Thanks for the tip.
Tim
------------------------------
Date: 14 Nov 2001 18:24:31 +0000
From: nobull@mail.com
Subject: Re: Newbie Question, pls HELP!!
Message-Id: <u94rnxky74.fsf@wcl-l.bham.ac.uk>
bhattey@hotmail.com (bhattey) writes:
> Subject: Newbie Question, pls HELP!!
The above subject line is grossly rude.
The word 'Question' is almost always redundant in Usenet subject
lines.
'Please help' in subject lines is considered rude.
The use of exclaintion marks is considered rude.
'Newbie' in subject lines is usually read as 'person too lazy to read
the manual'. If this is true you should not post. If this is false
you should avoid giving the wrong impression.
Your subject line contains no useful information.
What little information it does contain - that you believe that this
is a "newbie question" is in fact inaccurate. As a newbie you can't
know if your question is a newbie question or, as in this case, a more
subtle and advanced question that you've stumbled upon early on.
> Operation `eq': no method found, left argument in overloaded package
> CGI::Cookie, right argument has no overloaded magic...
> if ($user_matched == 1 && $cookie eq "") {
Well the error message is pretty explict!
$cookie is a GCI::Cookie object. CGI::Cookie uses overloading which
means that if you try to apply most of Perl's builtin operators to
$cookie it will in fact want to call a method on the object instead.
However CGI::Cookie does not define (either directly or indirectly) a
method to implement the eq operator. Futhermore the thing on the
other side of the eq is not an object with overloading so Perl can't
look there for a method to implement eq. So it gives up.
Arguably if an package using overloading fails to define a any string
comparison operators Perl should fall back on the stringify operator.
Anyhow, this has been fixed CGI::Cookie version 1.20 which _does_ define a
method to be used for implementing the cmp operator and thus
indirectly for implementing the eq operator.
That said you are probably testing the wrong thing anyhow. You
probably don't want to explicitly check that $cookie has string
equality with the null string. You probably really want to simply
check that $cookie is false (in Perl terms). Now that bit _is_ a
newbie question.
if ($user_matched == 1 && !$cookie ) {
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 14 Nov 2001 13:35:53 -0500
From: Michael Witkowski <witkowsk@pop900.gsfc.nasa.gov>
Subject: Performance issues related to $&, $` and $'
Message-Id: <3BF2B989.C611942F@pop900.gsfc.nasa.gov>
Can any one give me a heads up on the following?
In programming perl, I've found the following
claim relaited to performance:
"Avoid $& and its two buddies, $` and $'. Any
occurrence in your program causes all matches
to save the searched string for possible future
reference. (However, once you've blown it, it
doesn't hurt to have more of them.)"
First, does any of this apply to matched groups
(ie $1, $2 etc)? If not, am I correct in assuming
that forcing my own match for $`, $& and $'
into $n variables will be more efficient than using
the $[`'&] variables?
Second, how global is the "blown it" clause on
using the $[`'&] variables. If I blow it in a
procedure does it blow it all over my program or
is it limited to that procedure? Also, does the
"blown it" clause apply to all subsequent matches
regardless of their use of the $[`'&] variables?
Performance is becoming quite important to my
project right now so any info on this or other items
(not obvious in the manuals) would be appreciated.
Thanks
Michael Witkowski
------------------------------
Date: Wed, 14 Nov 2001 19:01:21 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Performance issues related to $&, $` and $'
Message-Id: <x7herxgoq1.fsf@home.sysarch.com>
>>>>> "MW" == Michael Witkowski <witkowsk@pop900.gsfc.nasa.gov> writes:
MW> First, does any of this apply to matched groups
MW> (ie $1, $2 etc)? If not, am I correct in assuming
MW> that forcing my own match for $`, $& and $'
MW> into $n variables will be more efficient than using
MW> the $[`'&] variables?
no, $1 and friends are fine. they are locally scoped.
MW> Second, how global is the "blown it" clause on using the $[`'&]
MW> variables. If I blow it in a procedure does it blow it all over
MW> my program or is it limited to that procedure? Also, does the
MW> "blown it" clause apply to all subsequent matches regardless of
MW> their use of the $[`'&] variables?
yes, $& will make all of your program's regexes do a full copy of the
original string, even modules that you load. the problem that $& is not
locally scoped so perl can't ever know when you might refer to it so it
always has to copy the original string so it can be used by $&. with $1
it will only copy the string if you do explicit grabs in the regex with
(). so the penalty is only for the regexes which need it.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
-- Stem is an Open Source Network Development Toolkit and Application Suite -
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
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.
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 2131
***************************************