[8692] in Perl-Users-Digest
Perl-Users Digest, Issue: 2309 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 13 15:17:44 1998
Date: Mon, 13 Apr 98 12:00:30 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 13 Apr 1998 Volume: 8 Number: 2309
Today's topics:
Re: [Q] find largest value in key of associative array? (brian d foy)
Re: [Q] find largest value in key of associative array? (Mark-Jason Dominus)
advertise script <dmeyaard@mediaport.org>
arrays of arrays and loop constructs <beckerr@softrends.com>
Re: Bill Gates should be invited to O'Reilly's "Free So (Aaron Denney)
Re: Bill Gates should be invited to O'Reilly's "Free So <ben@hayamasa.demon.co.uk>
Re: Bill Gates should be invited to O'Reilly's "Free So <ben@hayamasa.demon.co.uk>
Re: Bill Gates should be invited to O'Reilly's "Free So <ben@hayamasa.demon.co.uk>
Re: Bill Gates should be invited to O'Reilly's "Free So (Aidan Cully)
editing /etc/group file jtaylor@snet.net
How to upload multiple graphic files at once ? krzych@altavista.net
Re: Info Regarding Perl 5.005 <brianm@kodak.com>
Re: Intermittent Perl problems <Scott_LeWarne@BigFoot.com>
Re: Intermittent Perl problems <joneil@cks.ssd.k12.wa.us>
looking for a good win32 perl editor. <jamesht@idt.net>
Re: Need to find web-based e-mail client in Perl! (Abigail)
Perl is `netlike jazz': (Tom Rokicki)
Re: Profiling resource use (brian d foy)
Re: Project involving Word <c..bojswbo@04.usenet.us.com>
Re: Random Banner Problem <upsetter@shore.net>
RE: running `ls $file` on a nt workstation in a search <tony@corcoll.demon.co.uk>
Service Name with white space <ashah@videoserver.com>
Re: Sharing a constant between scripts <rsgoheen@pobox.com>
Re: Sockets within a loop problem (Mark-Jason Dominus)
SOLVED: qx scalar returned in a list context (James B. Crigler)
split problem <scott@rappahannock-web.com>
Subtle syntax error with "print" and sub references <annis@wazor.biostat.wisc.edu>
Time:: modules <rlluhman@iastate.edu>
Username/password required w/ Netscape, Help! <aricr@arconsultinginc.com>
Re: Username/password required w/ Netscape, Help! (Abigail)
Re: wc -l in perl is?????? (Mark-Jason Dominus)
WebAdverts yavin4@new-york.crosswinds.net
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 13 Apr 1998 13:39:32 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: [Q] find largest value in key of associative array?
Message-Id: <comdog-ya02408000R1304981339320001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6gt77c$jng$1@monet.op.net>, mjd@op.net (Mark-Jason Dominus) posted:
>In article <01bd66cb$a9542460$1ff8aecc@direct.ca.direct.ca>,
>Stephen_Chan <schan_ca@rocketmail.com> wrote:
>>What's the fastest way to find the largest key value
> ($max_value) = sort { $b <=> $a } values %aa;
why is everyone trying to sort? you only need to look at each
key once!
also, anyone interested might try the max() function from the
builtin module.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: 13 Apr 1998 14:25:11 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: [Q] find largest value in key of associative array?
Message-Id: <6gtla7$lvv$1@monet.op.net>
Keywords: from just another phildelphia perl hacker
In article <comdog-ya02408000R1304981339320001@news.panix.com>,
brian d foy <comdog@computerdog.com> wrote:
>why is everyone trying to sort?
Because it leads to smaller code.
> you only need to look at each key once!
I posted the each-key-once solution too, but I think there's a place
for the sort solution.
------------------------------
Date: Mon, 13 Apr 1998 17:45:14 +0200
From: "Dick Meijaard" <dmeyaard@mediaport.org>
Subject: advertise script
Message-Id: <6gtg1q$4163@reader1.wxs.nl>
Hello,
I'm looking for a perl script especially for advertising.
Anybody can add an advertisement, but also delete or change with a password,
with the possibility that old advertisements are deleting after a checked
date.
Do you have a script? mail me with the attachement.
Thank you!
Dick Meijaard
dick@meijaard.nl
------------------------------
Date: Mon, 13 Apr 1998 16:54:00 +0000
From: Ross Becker <beckerr@softrends.com>
Subject: arrays of arrays and loop constructs
Message-Id: <35324328.41EFDAD7@softrends.com>
I've been playing with perl for a while now, lately, I have been
doing some stuff
where I generated arrays of anonymous arrays, as in:
push @mylist, [$foo, $bar];
now, when I wish to unroll this list of lists, I have found there to be
very little in
terms of a "natural" expression, for pulling out those values as I
looped...
what *I* reguarded as natural was this:
foreach ($foo, $bar) (@mylist) {
dosomething;
}
but, that simply does not work... I ended up being forced into the
following:
while (($foo, $bar) = @{shift @mylist}) {
dosomething;
}
which I reguard as being less than entirely natural. I know that I
could use foreach
to drop into a scalar, and pull the scalar apart in the first statement
of the loop,
but as a perl hacker(tm), that solution is less than appealing to me.
I am assuming that there was a concious decision to not allow the first
syntax I
expressed, but what I was wondering, was if someone who's more intimate
with perl than I could point out why the first syntax would be a bad
idea, or if it
would actually be something useful.
Thanks,
Ross Becker
beckerr@softrends.com
------------------------------
Date: 13 Apr 1998 18:01:13 GMT
From: wnoise@ugcs.caltech.edu (Aaron Denney)
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <slrn6j4kog.4hf.wnoise@puree.ugcs.caltech.edu>
On Sun, 12 Apr 1998 11:44:30 GMT, Chris Nandor <pudge@pobox.com> wrote:
> In article <35302a80.6655982@newsreader.cais.net>,
> perl.babe@mailexcite.com (Sandra Anderson) wrote:
>
> # No to put too fine a point on it, information does not long to be
> # free. It longs to live and grow and be distributed widely, which
> # means someone has go to come up with the cash to pay the printers,
> # publishers, authors, the drivers of the trucks full of books, the
> # clerks at the store, the people working for the computer companies,
> # etc.
>
> Not to put too fine a point on it (:-), but information does not long to
> do anything, does not will to do anything. We will it to be certain
> things, and as we change, those wills change.
Not to put too fine a point on it, but while information does not long
to be free, it is a useful approximation to consider it as if it did.
The information that is most widely replicate tends to last the
longest. If information is not widely replicated, it tends to die
out. The upshot is that we see the information that does "want to be
free". This is just another case of evolution in action, complete with
mutations, competition, parasites, symbionts, and widely varied
ecosystems. (An idea that gains much currency in the modern US
probably won't experience the same kind of success in somewhere like
medieval France or Spain. The other ideas provide the wrong
environment.) In a similar way, uni-cellular creatures do not have any
"desire" to reproduce and avoid being eaten, but nevertheless it is a
very good way of understanding their behaviour. If they didn't behave
that way, they wouldn't be around.
--
Aaron Denney
------------------------------
Date: Mon, 13 Apr 1998 19:20:56 +0100
From: Ben Bullock <ben@hayamasa.demon.co.uk>
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <35325788.28B5940E@hayamasa.demon.co.uk>
Sandra Anderson wrote:
>
> On Sat, 11 Apr 1998 10:14:17 +0100, Ben Bullock
> <ben@hayamasa.demon.co.uk> wrote:
> No to put too fine a point on it, information does not long to be
> free. It longs to live and grow and be distributed widely, which
> means someone has go to come up with the cash to pay the printers,
> publishers, authors, the drivers of the trucks full of books, the
> clerks at the store, the people working for the computer companies,
> etc.
You are misunderstanding what I mean by `free'. If you
want to find out about what I mean by `free' please look at
the WWW site www.gnu.org which has lots of articles
about issues of `free software' which explain things probably
better than I can. Anyway, I am not refering to `free' in terms
of monetary cost.
Thank you.
--
Ben Bullock
------------------------------
Date: Mon, 13 Apr 1998 19:24:47 +0100
From: Ben Bullock <ben@hayamasa.demon.co.uk>
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <3532586F.301661F1@hayamasa.demon.co.uk>
Russ Allbery wrote:
>
> In comp.lang.perl.misc, Ben Bullock <ben@hayamasa.demon.co.uk> writes:
>
> > OK, it's not a computer program. But it is a document in
> > machine-readable form. The distributed Perl documents were offered as
> > examples of free documentation, but in the case of the Perl FAQ they are
> > not free.
>
> Sure they are.
I am using the word free in a specific sense. I posted an
explanation of what I meant. In that sense they are not free.
In some other sense of the word free they might be, but in my
sense of the word, which I posted a careful explanation of, they
aren't.
--
Ben Bullock
------------------------------
Date: Mon, 13 Apr 1998 19:29:48 +0100
From: Ben Bullock <ben@hayamasa.demon.co.uk>
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <3532599C.3CE80693@hayamasa.demon.co.uk>
Russ Allbery wrote:
> So you were talking about source code. Now you're talking about
> documentation. This qualifies as switching from source code to
> documentation.
When I refered to `my original article' I was refering to the
Usenet message which had message I.D.
"6ggdss$h5s$1@nnrp1.dejanews.com" the original article
with this title to these newsgroups.
> I specifically addressed that in my message, but you snipped it.
I am very sorry to have snipped this vital part of your message.
Unfortunately I did not see this part of your message.
I have your message
in front of me and I still can't see it. Would you be so kind
as to point it out to me?
Thankyou.
--
Ben Bullock
------------------------------
Date: 13 Apr 1998 18:32:16 GMT
From: aidan@panix.com (Aidan Cully)
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <6gtlng$h5v@news1.panix.com>
In article <m3pvini8g2.fsf@stoli.spirits.org.au>,
<nathanh@chirp.com.au> wrote:
>Stefaan.Eeckels@ecc.lu (Stefaan A Eeckels) writes:
>
>> I wonder if RMS ever anticipated that his 'free software' would
>> be the last bastion against Microsoft?
>
>It is not his free software.
>
>It is *our* free software.
Much as I hate to debate silly nit-picking arguments like this,
>From the GPLv2:
> 9. The Free Software Foundation may publish revised and/or new versions
>of the General Public License from time to time. Such new versions will
>be similar in spirit to the present version, but may differ in detail to
>address new problems or concerns.
>
>Each version is given a distinguishing version number. If the Program
>specifies a version number of this License which applies to it and "any
>later version", you have the option of following the terms and conditions
>either of that version or of any later version published by the Free
>Software Foundation. If the Program does not specify a version number of
>this License, you may choose any version ever published by the Free Software
>Foundation.
I haven't seen much software that _requires_ version 2, so the licenses of
most GPL'ed software can be replaced by an arbitrary future license from
the FSF.. The only promise we have that the future GPL will be something
under which we'd like to license our software is the phrase "similar in
spirit to the present version", which I doubt (IANAL) is enforcable in
court. (I'd love to see counterexamples to this.) People complaining
about Troll-tech's license.. Well.. I agree with them, but the GPL seems
to be heir to the same sort of problems as are objected to in the Troll
license.
Anyway, the end result is it _is_ the FSF's free software, even if they
don't own the copyright.
--aidan
--
Aidan Cully "Umm.. Could you call back? My house is on fire."
Panix Staff --Tom Waits
aidan@panix.com
------------------------------
Date: Mon, 13 Apr 1998 12:46:47 -0600
From: jtaylor@snet.net
Subject: editing /etc/group file
Message-Id: <6gtj26$dta$1@nnrp1.dejanews.com>
I am trying to write a little script that will update the group file with a
new user. I thought about reading in the whole line and apending to it, then
writing it out. I also thought about just prepending the new user's name to
the begining of the list. The problem is that I don't know how to write to a
certain section of the file and I would also like to get the info by doing
something like:
$user = "luser";
@groups = ("group1", "group2", "group3");
foreach (@groups) {
@old_line = (getgrnam($_))[0..3];
@new_line = push(@old_line, $user);
# then some code that I can't figure out like:
# Replace the " " (spaces) with "," (commas) and then
# write the new line to the /etc/group file in place of
# the old line.
# OR
# just write the $user to the begining of the user section
# and be done with it, so it looks like this:
# ----------OLD LINE ------
# group1:!:500:user1,user2,user3,user4
# ----------NEW LINE ------
# group1:!:500:luser,user1,user2,user3,user4
Thanks for any help in advance.
Joshua Taylor
jtaylor@snet.net
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Mon, 13 Apr 1998 12:55:43 -0600
From: krzych@altavista.net
Subject: How to upload multiple graphic files at once ?
Message-Id: <6gtjiv$elo$1@nnrp1.dejanews.com>
Hi Does anybody know how to upload many graphic files at the push of a
button? 100 pictures or so? Can I do it in Perl?
Chris
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Mon, 13 Apr 1998 13:35:41 -0400
From: Brian Mathis <brianm@kodak.com>
Subject: Re: Info Regarding Perl 5.005
Message-Id: <35324CED.E56015B5@kodak.com>
This is a multi-part message in MIME format.
--------------597860BFEBA9C29DC22E4A93
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Mark Osbourne wrote:
>
> Randal Schwartz <merlyn@stonehenge.com> writes:
>
> > And you should *definitly* upgrade to 5.005 when it comes out. Turns
> > out there's a CERT-ifiable security bug in all versions of 5.004, so
> > 5.005 is now the only Perl that is known-security-bug-free.
>
> Could someone post the relevant URL to the CERT advisory or bulletin?
> I took a look at the CERT site and couldn't find any reported
> vulnerability for Perl 5.004. Last one I could find dealt with sperl
> or suidperl in 5.003.
>
> -- Mark Osbourne O-
> -- marko@lexis-nexis.com
It seems like the general concensus is not not report this until 5.005
comes out, otherwise, every "stable" version of perl will be
CERTified... We can't have that now, can we...
Brian
--------------597860BFEBA9C29DC22E4A93
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Brian Mathis
Content-Disposition: attachment; filename="vcard.vcf"
begin: vcard
fn: Brian Mathis
n: Mathis;Brian
org: US&C Intranet Services
adr: Mail Code: 01269;;343 State Street;Rochester;New York;14560-1269;6/15/KO, USA
email;internet: brianm@kodak.com
tel;work: 1(716)724-7960
tel;fax: 1(716)724-2496
x-mozilla-cpt: ;0
x-mozilla-html: FALSE
version: 2.1
end: vcard
--------------597860BFEBA9C29DC22E4A93--
------------------------------
Date: Mon, 13 Apr 1998 09:39:49 -0700
From: "Scott LeWarne" <Scott_LeWarne@BigFoot.com>
Subject: Re: Intermittent Perl problems
Message-Id: <6gtlev$gkj@news.or.intel.com>
Line 17? You don't even know what is on line 17 of my script?
Are you trying to be funny? I don't get it?
-Scott LeWarne
Abigail wrote in message <6gmkn3$23d$2@client3.news.psi.net>...
>Scott LeWarne (Scott_LeWarne@BigFoot.com) wrote on MDCLXXXIII September
>MCMXCIII in <URL: news:6gm7qm$de5@news.or.intel.com>:
>++ I'm having intermittent problems with several perl scripts on a server
>++ running IIS 3.0. 90% of the time, they work fine. But sometimes, users
get
>++ an error message that says,
>++
>++ "CGI Error The specified CGI application misbehaved by not returning a
>++ complete set of HTTP headers. The headers it did return are: "
>++
>++ It doesn't list anything for the headers that it did return. I have
seen
>++ this error in several places in the MS knowledge base, but they all
>++ reference specific headers being returned rather than none at all.
>++
>++ Does anyone have any idea what might be causing this problem? I usually
>++ have to reboot the server to correct the problem. I'm not a Perl
expert,
>++ but the scripts seem to be written ok and they work most of the time.
>
>
>I think you have an error in line 17.
>
>
>
>Abigail
>--
>perl5.004 -wMMath::BigInt -e'$^V=new
Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$
^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=substr($]=>$|=>5)*(q.2
5..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: Mon, 13 Apr 1998 11:46:14 -0700
From: Jerome O'Neil <joneil@cks.ssd.k12.wa.us>
To: Scott LeWarne <Scott_LeWarne@BigFoot.com>
Subject: Re: Intermittent Perl problems
Message-Id: <35325D75.C69735BF@cks.ssd.k12.wa.us>
Scott LeWarne wrote:
> Line 17? You don't even know what is on line 17 of my script?
> Are you trying to be funny? I don't get it?
>
I think that's the whole point, Scott. To sum up your complaint:
I have a web server that barfs occasionaly with some CGI scripts written in
Perl.
Not much to go on there. What is your script supposed to do? How about some
code? If you realy want to impress us, tell us what you have done to
troubleshoot and debug up to this point. It's much easier to debug when you
aren't asked to use the psychic method.
> >I think you have an error in line 17.
---
Jerome O'Neil (joneil@cks.ssd.k12.wa.us)
Seattle Public Schools (http://www.ssd.k12.wa.us)
Information Services (Who I don't speak for)
------------------------------
Date: Mon, 13 Apr 1998 12:51:47 -0400
From: James <jamesht@idt.net>
Subject: looking for a good win32 perl editor.
Message-Id: <353242A3.C8FC35D6@idt.net>
Hello all,
I'm ready to pull my hair out.
Any suggestions?
jamesht@idt.net
------------------------------
Date: 13 Apr 1998 17:19:54 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Need to find web-based e-mail client in Perl!
Message-Id: <6gthfq$nm6$1@client3.news.psi.net>
Elmira Alimova (ea187@columbia.edu) wrote on MDCLXXXVI September MCMXCIII
in <URL: news:353227C4.9329DD6B@columbia.edu>:
++ Hello! My school is installing web kiosks for the students. Idea is to
++ enable them to get mail also. If anyone knows of perl script that will
++ work as a web-based e-mail client,let me know. Help is greatly
++ appreciated.
Why jump through extra hoops if many web browsers already have
mail functionality build in?
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET", "http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content)) =~ /(.*\))[-\s]+Additional/s) [0]'
------------------------------
Date: 13 Apr 1998 10:53:49 -0700
From: rokicki@cello.hpl.hp.com (Tom Rokicki)
Subject: Perl is `netlike jazz':
Message-Id: <6gtjfd$1v9@cello.hpl.hp.com>
perl -e 'print "Netlike"&"jazz"'
------------------------------
Date: Mon, 13 Apr 1998 13:34:17 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Profiling resource use
Message-Id: <comdog-ya02408000R1304981334170001@news.panix.com>
Keywords: from just another new york perl hacker
In article <35313BB1.2D62@cfcl.com>, dick@cfcl.com posted:
>Eric Bohlman wrote:
>
>>> Perl programs: CPU time, I/O requests, RAM consumption.
>>
>> I'd say that the Benchmark module is "known," given that it comes with
>> the standard distribution. Is there anything you want to do that you
>> can't do with it?
>
>Known it is. But it does none of what I need. The one second
>resolution is useless for in vivo testing. The perldoc says
what's this one second resolution stuff? the only thing measured
at that resolution is the real time, since it uses time(). the
CPU times are measured using times().
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: 13 Apr 1998 18:30:21 GMT
From: Anirvan Chatterjee <c..bojswbo@04.usenet.us.com>
Subject: Re: Project involving Word
Message-Id: <6gtljt$phj$1@samba.rahul.net>
Mark-Jason Dominus <mjd@op.net> wrote:
> I don't think there are any, because Microsoft never tells anyone what
> their file formats are.
This is wrong. There are thousands of valid criticisms of Microsoft;
this just happens not to be one of them. Go to www.microsoft.com, and
search for things like "word file formats" in their developer
resources area; they ask you to register online before you see their
"premium" content, but besides that annoyance, it's cerainly easily
available. I can't vouch for how complete the documentation is, but
most makers of non-free software probably don't even begin to make
their file formats public, so this is certainly a decent start.
_____________________________________________________________________
Anirvan Chatterjee . anirvan @ chatterjee.net . PGP 2048/0xE2D13BA9
Fast & free new/used multi-bookstore searching @ http://www.mxbf.com/
------------------------------
Date: 13 Apr 1998 17:12:20 GMT
From: Art Cohen <upsetter@shore.net>
Subject: Re: Random Banner Problem
Message-Id: <6gth1k$dh4@fridge.shore.net>
WS010 <WS010@dvvlap.be> wrote:
: Jeremy,
: <img src="MyScript.cgi">: nobody is going to stop you if you
: write that, but it won't make happen what you want.
Why not? Assuming that his script generates a random number and then
selects an image based on that number, it should work fine. Check out
www.phish.com for an example of almost exactly this same syntax.
--Art
National Ska/Reggae Calendar: www.ziplink.net/~upsetter/ska/calendar.html
Boston Ska Home Page: www.ziplink.net/~upsetter/ska/index.html
------------------------------
Date: Sun, 12 Apr 1998 03:38:15 +0100
From: tony Hitchinson <tony@corcoll.demon.co.uk>
Subject: RE: running `ls $file` on a nt workstation in a search script pro blem?
Message-Id: <C455575623CED111941500409520680E5041@BETTY>
ls does not work under NT. as NT command language is Dos based try using
dir instead this
I have this problem quite alot as I switch between Unix and NT so I have
written a batch file in NT called LS that simple say dir in it and I
have written a shell script in Unix call dir. This way I never get it
wrong
Tony Hitchinson
It's can't rain all the time
> -----Original Message-----
> From: Iqbal [SMTP:um@say.what]
> Posted At: Wednesday, April 08, 1998 4:08 PM
> Posted To: misc
> Conversation: running `ls $file` on a nt workstation in a search
> script problem?
> Subject: Re: running `ls $file` on a nt workstation in a search
> script problem?
>
> tim pickup wrote:
> >
> > I have to implement a standard search script on a nt workstation and
> > am
> > using a version of Matts search script. The script runs ok but
> > returns no
> > hits. The problem is that no files are gathered to search through.
> >
> > the relevent bits of code are
> >
> > ....
> > $basedir = "C:/inetpub/wwwroot/pages/";
> > @files = ('*.htm','*/*.htm');
> > ....
> >
> > sub get_files {
> > chdir($basedir);
> > foreach $file (@files) {
> > $ls = `ls $file`;
> > @ls = split(/\s+/,$ls);
> > foreach $temp_file (@ls) {
> > print $temp_file;
> > #===============this prints out nothing on execution==========
> > if (-d $file) {
> > $filename = "$file$temp_file";
> > if (-T $filename) {
> > push(@FILES,$filename);
> > }
> > }
> > elsif (-T $temp_file) {
> > push(@FILES,$temp_file);
> > }
> > }
> > }
> > }
> >
> > the key line is $ls = `ls $file`;
> > What exactly does this line do. I figure it is saying something like
> > get a
> > list of all files that are of the type <*/*.htm> for example.
> > If so then it isn't getting hold of any files.
> >
> > Have tried several variations on the $basedir but i don't think this
> > is the
> > problem.
> > Have run the script fine on other servers. This leads me to believe
> > that it
> > isn't the code at fault, but rather the implementation of this file
> > gathering technique on the nt workstation.
> >
> > The perl interpreter is version 5.004.. downloaded from perl.com
> >
> > Thanks
> >
> > tim
>
> Not sure, but does ls even work on NT, write a quick one liner, or try
> it from the command line, but I dont think it gives directory listing.
> I
> could be completely wrong but...
>
> Iqbal
------------------------------
Date: 13 Apr 1998 16:10:21 GMT
From: "Amit Shah" <ashah@videoserver.com>
Subject: Service Name with white space
Message-Id: <01bd66f7$2e931bb0$fa0314ac@ashah>
When I try to refer to a service having white space(s) in the name of the
service
perl ( version 5.003_07 ) script fails to execute with this message.
No such file or directory at Q:\USERS\ASHAH\service_mode.plx line ##.
Here is my code, the first part of which is just a copy from example from
help,
the second part is where I added my code and having problem with.
I can NOT change the name of service, so if you have anything else for me
to try,
I will really appreciate that.
Thanks much,
-Amit
ashah@videoserver.com
################# code
## Working part follows
use Win32::Service;
print "\tStatus of DHCP client service\n";
Win32::Service::GetStatus("", "DHCP", \%status) || die $!;
foreach $key (keys %status)
{
print $key, '=', $status{$key}, "\n";
}
## NOT working part follows
print "\tStatus of Conference Controller service\n";
Win32::Service::GetStatus("", "Conference Controller",\%status) ||
die $!;
foreach $key (keys %status)
{
print $key, '=', $status{$key}, "\n";
}
------------------------------
Date: Mon, 13 Apr 1998 10:18:21 -0700
From: Robert Goheen <rsgoheen@pobox.com>
Subject: Re: Sharing a constant between scripts
Message-Id: <353248DD.4033F1D6@pobox.com>
Andrew M. Langmead wrote:
>
> Robert Goheen <rsgoheen@pobox.com> writes:
>
> >Sounds good. But how would I apply this to an array or hash that I
> >wanted to use across several scripts?
>
> The constant pragma accepts a list as an argument.
>
> use constant LIST => qw(foo bar baz);
>
> but lists don't get inlined the way scalars do.
Not to show any more ignorance than I already have, but I'm not certain
if I completely understand what you mean by this last statement. Could
you perhaps elaborate a bit for me?
>
> >Actually, on a nit-picky point too, is there any way to use a constant
> >as defined above within double quotes, and have Perl substitute the
> >value of the constant?
>
> Since constants defined by the constant module are functions, you have
> to use the method described in the FAQs entry "How do I expand
> function calls in a string?"
D'oh! I asked a question that's in the FAQ.
>
> print <<EOF;
>
> bla bla bla.
> <A HREF="mailto:@{[AUTHOR]}>mail me</A>
> bla bla bla.
>
> EOF
>
> Or you could use something like Text::Template instead of double quotes.
Hmm. I'm not familiar with this module. Of course, rather than asking
for help, I'll just go away and RTFM. . . .
Thanks!
> --
> Andrew Langmead
----
Robert S. Goheen
rsgoheen@pobox.com
------------------------------
Date: 13 Apr 1998 13:02:03 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Sockets within a loop problem
Message-Id: <6gtgeb$l61$1@monet.op.net>
In article <MPG.f9b1e1ff391c7999896b8@news.interport.net>,
<cblack@qni.com> wrote:
>I'm writing an IRC gamebot and need to check the socket for commands for
>a specific amount of time.
You use the `select' function for that. Actually there are two
totally unrelated select functions. The one you want has four
arguments, not one argument; see `perlfunc'. You may also want to
investigate the IO::Select module which may provide a better interface
to the same functionality.
>I read in the perl documentation that $| = 1; can be used to avoid
>socket stalls within loops, but it doesn't seem to work.
You probably need to do that *also*. $|=1 means that when you write
data on the socket, it is sent on the network immediately; the default
is to wait until you've written a large amount of data and then to
send it all at once.
Your problem is totally unrelated to this. Look up `select'.
------------------------------
Date: 13 Apr 1998 13:22:44 -0400
From: crigler@seo.com (James B. Crigler)
Subject: SOLVED: qx scalar returned in a list context
Message-Id: <lziuodprff.fsf@jim.seo.com>
In the sub that follows, the qx() call was resulting in all the lines
of the external program being assigned to $z[0]. (I found the answer
just as I was beginning to compose this message.) Of course, the
problem is the "|| die" business forcing a scalar context, and one
solution is extra parens around "@z = qx(...)".
But I was unable to find this metioned in the man or the faq. In fact,
the man says this:
Binary "||" performs a short-circuit logical OR operation.
That is, if the left operand is true, the right operand is
not even evaluated. Scalar or list context propagates
down to the right operand if it is evaluated.
Assuming I missed it in the documentation (which is likely), where
should I have looked?
sub snarfdata {
my $which = $_[0];
my @z;
@z = qx(egitimew.pl $ARGV[0] $which) || die "Couldn\'t read data!\n";
## other stuff deleted
@z;
}
--
Jim Crigler <crigler@seo.com>
Schwartz Electro-Optics, Inc. Voice: (407)298-1802 x200
3404 N. Orange Blossom Trl. Fax: (407)290-9666
Orlando FL 32804-3498 USA
------------------------------
Date: Mon, 13 Apr 1998 14:30:44 +0000
From: scott <scott@rappahannock-web.com>
Subject: split problem
Message-Id: <35322157.22DDF3B4@rappahannock-web.com>
Can anyone tell me what's going on with this...
The DATABASE has five pipe delimited fields, each record separated by a newline.
I wanted to split the records into fields, but all I can get is a count of the fields.
open (DATABASE,"$db_file");
while ($dbrows = <DATABASE>){
($one, $two, $three, $four, $five) = split (/\|/,$dbrows) || &Error;
print "$dbrows<br>\n"; #this works ok, returns each record.
print "$one<br>\n"; #this returns the number of fields.???? what i expected
was the contents of the first field.
print "$two<br>\n"; #this returns nothing
print "something<br>\n";
}
--
Thanks,
Scott Prince
--
Thanks,
Scott Prince
Rappahannock Web Development
http://www.rappahannock-web.com
------------------------------
Date: 13 Apr 1998 12:38:01 -0500
From: William Annis <annis@wazor.biostat.wisc.edu>
Subject: Subtle syntax error with "print" and sub references
Message-Id: <jt4szxvczq.fsf@wazor.biostat.wisc.edu>
Normally, I'm a lazy typist and a moderately lazy reader. One
result of this is that I prefer, where possible, to avoid strange
notations where a simpler one is available. For example, when using
subroutine references, I prefer to avoid using the indirection
notation we all know and love from our C/C++ days. That is, I prefer:
&$subref($arg);
to
$subref->($arg);
which I find a bit peculiar and unattractive, although I appreciate
the notational completeness it fulfills.
I just ran into a case where that syntax is required. Please
note:
----------------------------------------
$fh = \*STDOUT;
$filter = sub {
my $a = shift;
print "Filtered: $a";
};
print $fh "Hello\n";
&$filter("Cool"); # 1.a. Perfectly fine.
&{$filter}("Cool"); # 1.b. Also fine, if verbose.
print $fh &{$filter}("Cool"); # 2. Syntax error
print $fh "" . &{$filter}("Cool"); # 3. This is fine.
print $fh &{$filter}("Cool") . ""; # 4. Syntax error here, too.
print $fh $filter->("Cool"); # 5. This works, too.
----------------------------------------
Now, case 1.a. is how I would normally prefer to call a
subroutine reference. There are times when I have hash tables full of
sub refs, so in those cases I would use case 1.b., which is actually
easier for me to read in those cases.
Please observe case 2. This produces a syntax error. It
drove me nuts. I checked the standard places (Camel, Leopard, faq),
and no one seems to discuss this quirk. Note that using "print"
without a filehandle, like so:
print &$filter("Cool");
works just fine, too.
The thing that makes me most suspicious is the business in
case 3. This string coercion trick has been in my brain so long, I
don't recall where it comes from. What I want to know is why case 3
runs and case 2 won't even compile (nor will case 4, strangely).
Is this a bug? Both solutions look a bit, well, unattractive
to me, and I worry about these things in my programs.
--
William Annis - System Administrator - Biomedical Computing Group
(608) 263 8625 annis@biostat.wisc.edu Finger for PGP key.
------------------------------
Date: Mon, 13 Apr 1998 11:20:46 -0500
From: "Rick" <rlluhman@iastate.edu>
Subject: Time:: modules
Message-Id: <6gte3g$3ud$1@news.iastate.edu>
Can you add Time:: modules to the Novell's Intranetware? If so, how?
RICK
------------------------------
Date: Mon, 13 Apr 1998 12:18:27 -0400
From: Aric Rosenbaum <aricr@arconsultinginc.com>
Subject: Username/password required w/ Netscape, Help!
Message-Id: <35323AD2.4919E3D6@arconsultinginc.com>
I've installed Gurusamy Sarathy's distribution of Perl, version 5.004_02
on a web server running IIS.
When I access the perl script from Internet Explorer, everything is OK.
However, when I use Netscape, I get a dialog window that asks me for my
username and password.
I have the web server set up to "Allow annonymous" and "Windows NT
challenge/response". In addition, the virtual directory has execute but
not read rights.
It baffles me that IE and Netscape behave differently.
Any help would be greatly appreciated.
-- Aric
------------------------------
Date: 13 Apr 1998 17:21:46 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Username/password required w/ Netscape, Help!
Message-Id: <6gthja$nm6$2@client3.news.psi.net>
Aric Rosenbaum (aricr@arconsultinginc.com) wrote on MDCLXXXVI September
MCMXCIII in <URL: news:35323AD2.4919E3D6@arconsultinginc.com>:
++ I've installed Gurusamy Sarathy's distribution of Perl, version 5.004_02
++ on a web server running IIS.
++
++ When I access the perl script from Internet Explorer, everything is OK.
++ However, when I use Netscape, I get a dialog window that asks me for my
++ username and password.
There's nothing Perly about your question.
Ask in the appropriate server group.
(Followups set)
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: 13 Apr 1998 11:59:11 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: wc -l in perl is??????
Message-Id: <6gtcof$kon$1@monet.op.net>
In article <3531499C.3A3B58B5@hpl.hp.com>, Larry Rosler <lr@hpl.hp.com> wrote:
>I can guess why slurping the entire file into an array is slower than
>reading it line by line. Probably the overhead involves appending line
>after line to an array that has not been preallocated.
No, I don't think it does do that. It allocates the lines onto the
stack, and then creates the array all at once with the `aasdign' op.
You might want to look at perl -Dxt output in a case like this.
------------------------------
Date: Mon, 13 Apr 1998 12:29:59 -0600
From: yavin4@new-york.crosswinds.net
Subject: WebAdverts
Message-Id: <6gti2m$bnl$1@nnrp1.dejanews.com>
I need help setting up webadverts, whoever helps me will recieve free
impressions on the soon to be exchange. E-mail me
yavin4@new-york.crosswinds.net. Thanks
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 2309
**************************************