[9186] in Perl-Users-Digest
Perl-Users Digest, Issue: 2803 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 4 00:08:28 1998
Date: Wed, 3 Jun 98 21:00:28 -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 Wed, 3 Jun 1998 Volume: 8 Number: 2803
Today's topics:
-d ? 3 : 7 is ambiguous, how comes? <pinard@iro.umontreal.ca>
Re: -d ? 3 : 7 is ambiguous, how comes? <tchrist@mox.perl.com>
Re: -d ? 3 : 7 is ambiguous, how comes? (Larry Rosler)
Re: -d ? 3 : 7 is ambiguous, how comes? <pinard@iro.umontreal.ca>
Re: -d ? 3 : 7 is ambiguous, how comes? (Larry Rosler)
Re: -d ? 3 : 7 is ambiguous, how comes? <tchrist@mox.perl.com>
Re: [Q] system using grep (Martien Verbruggen)
Re: FORMAT to console (Martien Verbruggen)
Re: GIFgraph problems (brian d foy)
Re: How to read AND write to a programm? (RonaldWS)
Re: How to set timezone via cgi using perl (Larry Rosler)
Re: How to set timezone via cgi using perl (Larry Rosler)
ISO: Perl script that will index site for search enging <andreas@gson.com>
Re: map in void context regarded as evil - suggestion (Earl Hood)
Re: map in void context regarded as evil - suggestion (Earl Hood)
Re: map in void context regarded as evil - suggestion (Earl Hood)
newbie....and counters.. (HoneySiren)
Re: novice question: improving this code? birgitt@my-dejanews.com
Re: odbc and unix perl <sdh1@anchor.hotmail.com>
Re: Perl Search Engine (Martien Verbruggen)
Re: Program output piping under NT (for web browser) (Martien Verbruggen)
Re: Regex: parens inside quantifiers: can you capture a (brian d foy)
Re: Specialized Split (Martien Verbruggen)
Re: Submitting http request and getting/parsing resulti (Martien Verbruggen)
Re: Use of HTML, POD, etc in Usenet (was: Re: map in vo (Earl Hood)
Re: Win32 Perl and Unix Perl (Martien Verbruggen)
Re: X ticks with GIFgraph (brian d foy)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 04 Jun 1998 00:57:51 GMT
From: =?ISO-8859-1?Q?Fran=E7ois_Pinard?= <pinard@iro.umontreal.ca>
Subject: -d ? 3 : 7 is ambiguous, how comes?
Message-Id: <vraf7u2dbi.fsf@raptor.IRO.UMontreal.CA>
Hi, people. I'm curious about this one:
$ perl -e '-d ? 3 : 7'
Warning: Use of "-d" without parens is ambiguous at -e line 1.
Search pattern not terminated at -e line 1.
$ perl -v
This is perl, version 5.003 with EMBED
built under linux at Aug 21 1996 12:57:07
+ suidperl security patch
If I write (-d) instead of -d, the ambiguity disappears. From the given
message, I presume it has something to do with search patterns, but I do
not see how. Would some kind soul explain?
Oh, by the way, I have another mini-question. If I do:
@x = 1;
then all array elements receive one. Nice! That's what I want. :-) Yet,
seeking for some confirmation of this fact in the reference man pages, I
do not stumble on it, after having wandered a little. Where should I look?
--
Frangois Pinard mailto:pinard@iro.umontreal.ca
Join the free Translation Project! http://www.iro.umontreal.ca/~pinard
------------------------------
Date: 4 Jun 1998 01:32:54 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: -d ? 3 : 7 is ambiguous, how comes?
Message-Id: <6l4tg6$kbu$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
=?ISO-8859-1?Q?Fran=E7ois_Pinard?= <pinard@iro.umontreal.ca> writes:
:If I write (-d) instead of -d, the ambiguity disappears. From the given
:message, I presume it has something to do with search patterns, but I do
:not see how. Would some kind soul explain?
print if ?^From?;
:Oh, by the way, I have another mini-question. If I do:
: @x = 1;
:then all array elements receive one. Nice! That's what I want. :-)
Well, that's not what you get. I mean, not really. Sure, there's all
set to 1, but "all" here means only one of them. You really wrote:
@x = (1);
Not
@x = (1) x @x;
--tom
--
Build a system that even a fool can use, and only a fool will want to use it.
------------------------------
Date: Wed, 3 Jun 1998 18:25:31 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: -d ? 3 : 7 is ambiguous, how comes?
Message-Id: <MPG.fdf9764c4a2d767989696@hplntx.hpl.hp.com>
In article <vraf7u2dbi.fsf@raptor.IRO.UMontreal.CA>,
pinard@iro.umontreal.ca says...
...
> Oh, by the way, I have another mini-question. If I do:
>
> @x = 1;
>
> then all array elements receive one. Nice! That's what I want. :-) Yet,
> seeking for some confirmation of this fact in the reference man pages, I
> do not stumble on it, after having wandered a little. Where should I look?
...
"All array elements receive one" is true, because there is only one array
element ('1' is a list with one element). I hope that's not what you
wanted.
@x = 1;
means the same as
@x = (1);
--
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com
------------------------------
Date: Thu, 04 Jun 1998 02:16:07 GMT
From: =?ISO-8859-1?Q?Fran=E7ois_Pinard?= <pinard@iro.umontreal.ca>
Subject: Re: -d ? 3 : 7 is ambiguous, how comes?
Message-Id: <vrwwax29p2.fsf@raptor.IRO.UMontreal.CA>
Tom Christiansen <tchrist@mox.perl.com> writes:
> :If I write (-d) instead of -d, the ambiguity disappears. From the given
> :message, I presume it has something to do with search patterns, but I do
> :not see how. Would some kind soul explain?
>
> print if ?^From?;
-d ? 3 : 7
print if ?^From?
I'm not sure this is really fortunate. If I wrote:
-d ? 3 : 7 ?
then, and only then, it would make sense to interpret that -d is given the
result of the match as a directory name to test. I did not write a pattern.
You say that, instead of recognising the construct as a valid one, Perl
decides simultaneously that I forgot a trailing ?, and *then*, that the
construct is ambiguous?
Shouldn't it read it as written first, before hypothetizing various errors?
In the expression "-d ? 3 : 7", as written, I still do not see a possible
ambiguous interpretation. Is there one?
> :Oh, by the way, I have another mini-question. If I do:
> : @x = 1;
> :then all array elements receive one. Nice! That's what I want. :-)
>
> Well, that's not what you get. I mean, not really. Sure, there's all
> set to 1, but "all" here means only one of them. You really wrote:
> @x = (1);
> Not
> @x = (1) x @x;
I'm already used to write "@x = (1) x @x", indeed, and were just trying
to simplify this writing. I also quite agree that "@x = (1)" will only
set the first element to 1.
The `history' in the shell is useful, as it helped me retracing my
mistake :-). I did try:
perl -e '$x[1,2,3]=7;print $x[3]'
while I should have tried:
perl -e '@x[1,2,3]=7;print $x[3]'
>From this incorrect experiment, I drawed (sp?) an incorrect conclusion.
So, you say that a scalar in list context is interpreted as a list containing
only that scalar. I've no problem with that. However, PERLDATA(1) does
not say so in `List value constructors', neither PERLOP(1) in `Assignment
operators'. So, my mini-question stays, about where should I look to see
a statement of this specification. I ought to have read it somewhere! :-)
--
Frangois Pinard mailto:pinard@iro.umontreal.ca
Join the free Translation Project! http://www.iro.umontreal.ca/~pinard
------------------------------
Date: Wed, 3 Jun 1998 19:26:26 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: -d ? 3 : 7 is ambiguous, how comes?
Message-Id: <MPG.fdfa5ac619601b3989698@hplntx.hpl.hp.com>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <6l4tg6$kbu$1@csnews.cs.colorado.edu>, tchrist@mox.perl.com
says...
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc,
> =?ISO-8859-1?Q?Fran=E7ois_Pinard?= <pinard@iro.umontreal.ca> writes:
> :If I write (-d) instead of -d, the ambiguity disappears. From the given
> :message, I presume it has something to do with search patterns, but I do
> :not see how. Would some kind soul explain?
>
> print if ?^From?;
That is subtle! From Blue Camel, p. 85 top: "A file test operator is a
unary operator that takes one argument, either a filename or a
filehandle, ..." P. 86: "Note that -s/a/b/ does not do a negated
substitution." *That* is subtle too!
If a pattern can be 'a filename or a filehandle' is its value '' or 1
depending on whether it matches $_? Is that useful in any way? Perhaps
formal syntax has overcome DWIM in this case. (Not that there's anything
wrong with that, of course. :-)
--
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com
------------------------------
Date: 4 Jun 1998 03:02:53 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: -d ? 3 : 7 is ambiguous, how comes?
Message-Id: <6l52ot$c5$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
=?ISO-8859-1?Q?Fran=E7ois_Pinard?= <pinard@iro.umontreal.ca> writes:
:Shouldn't it read it as written first, before hypothetizing various errors?
:In the expression "-d ? 3 : 7", as written, I still do not see a possible
:ambiguous interpretation. Is there one?
All unops and listops are sensitive to the ambiguous tokens, like ?, /,
and <. Why do you think you can't say
if (-s < 10) {
print "ok";
}
Same reason. It thinks that < might be the start of a <glob>
sequence. Likewise with something like
if (print / 10) { warn "here" }
But not with
if (time / 10) { warn "cool" }
Because here alone we are not expecting a terminal in the grammar,
since time() is a nonop.
--tom
--
/* now make a new head in the exact same spot */
--Larry Wall in cons.c from the perl source code
------------------------------
Date: 4 Jun 1998 01:40:56 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: [Q] system using grep
Message-Id: <6l4tv8$fmf$1@comdyn.comdyn.com.au>
In article <35756AE3.6822@cig.mot.com>,
"Dave M. Lent [I]" <lentdm@cig.mot.com> writes:
> Thanks for your reply Tom, Mike and Jarkko! It turned out that $keyword
> had a newline character in it so I used chop to remove the newline and
> now the code is working. Thanks again!
It might be safer to use chomp for that.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | 75% of the people make up 3/4 of the
Commercial Dynamics Pty. Ltd. | population.
NSW, Australia |
------------------------------
Date: 4 Jun 1998 01:49:26 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: FORMAT to console
Message-Id: <6l4uf6$fmf$3@comdyn.comdyn.com.au>
In article <6l3k9d$146g@fidoii.cc.lehigh.edu>,
"Phil R Lawrence" <prl2@lehigh.edu> writes:
> Hello,
>
> I want to write to console from a database. My problem is with FORMATing the
> data. Is there a good way to send 24 lines at a time, wait for the user to
> strike ENTER, and then display the next screen? The best test I could cobble
> together follows, but output looks a little awkward. Any suggestions?
You're assuming that the user will have a screen 'size' of 24 lines.
This might be correct in many cases, but incorrect in many others.
If this runs on a unix box, you might consider doing what most
programs do, and that is running a pager (more or less). It might be a
good idea to check what the user's preferred pager if ($ENV{PAGER}).
If this is not running on a unix box, you might consider using
something that provides that functionalitly for you. Something like
'more' is always available.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | A Freudian slip is when you say one
Commercial Dynamics Pty. Ltd. | thing but mean your mother.
NSW, Australia |
------------------------------
Date: Wed, 03 Jun 1998 23:10:54 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: GIFgraph problems
Message-Id: <comdog-ya02408000R0306982310540001@news.panix.com>
Keywords: from just another new york perl hacker
In article <3575A4D1.EE0535E@pallas.tid.es>, Jurgen Koeleman <jurgen@pallas.tid.es> posted:
>I am using the module GIFgraph to display GIF output for a graph, but
>have a problem with it and don't know how to solve it.
>
>I want to use the ticks on the X-axis, but not for each data point.
>E.g. for all the minutes of the day there is a data point, but the
>ticks are only needed once every 60 minutes.
>I was suggested to use the parameter x_label_skip=60, but
>unfortunately this does not solve my problem. x_label_skip only
>affects the labels that can be placed with the ticks, but not the
>ticks themselves.
oops, didn't see this post before the other one.
you need to change some things in GIFgraph::axestype.pm to do
what you want. go to the function named draw_ticks and look
for the string
# Ticks and values for X axis
right under that you see a foreach loop. this loop draws the
ticks. you need to make the loop not draw the ticks when you
don't want them to. my hacked version of this function looks
like
# Ticks and values for X axis
for my $i (0..$s->{numpoints})
{
next if ( $i%($s->{x_label_skip}) and $i != $s->{numpoints} );
as far as i know, Martien is reworking the code to handle such
things. no idea about the schedule for that though.
>$g->set(
> 'x_ticks' => 1,
> 'tick_length' => 6,
> 'x_label_skip' => 1,
also, notice that when x_label_skip is 1, it prints *every* label.
> 'x_plot_values' => 1,
> );
good luck :)
--
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 T-shirts! <URL:http://www.pm.org/tshirts.html>
------------------------------
Date: 4 Jun 1998 01:26:22 GMT
From: ronaldws@aol.com (RonaldWS)
Subject: Re: How to read AND write to a programm?
Message-Id: <1998060401262200.VAA16207@ladder01.news.aol.com>
In article <6kn2j8$a70$1@malgudi.oar.net>, "Brian J. Sayatovic"
<bjs@iti-oh.com> writes:
>Look at perl's IPC::open2 routine -- it lets you connect filehandles to both
>a process's STDIN and STDOUT. Unfortunately, this doesn't work for Win32.
>
>
There is however an emulator for win32 and ActiveState perl or Perl versions
compiled with VC++ (which does not include the GSAR 5.004_02 release).
Please email RonaldWS@aol.com for a copy.
Ronald Schmidt
------------------------------
Date: Wed, 3 Jun 1998 17:58:20 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How to set timezone via cgi using perl
Message-Id: <MPG.fdf91066d0da975989695@hplntx.hpl.hp.com>
In article <3575d7b3.21004473@news.btinternet.com>,
Gellyfish@btinternet.com says...
> On Wed, 3 Jun 1998 15:47:05 -0700, Larry Rosler wrote :
>
> >You can determine the timezone of the processor on which the program is
> >executing without looking at the TZ environment variable. Some systems
> >(such as Windows/DOS) don't have such a variable, yet they know the
> >localtime. [Believe it or not, Unix guys. The existence of $ENV{TZ} is
> >a reliable differentiator between Unix and WinDOS. $^O is not
> >implemented in older perls such as 5.002, and $^O needs to be parsed in
> >any case.]
> >
>
> Actually that might need a little qualification:
>
> Microsoft(R) MS-DOS(R) Version 6.22
> (C)Copyright Microsoft Corp 1981-1994.
>
...
> PCTCP=C:\BTINTNET\pctcp.ini
> TZ=GMT + 0BST
...
>
> In the case of this setup the TZ variable is being used by PCTCP
> software. However I guess this is not that common nowadays..
Email discussion with Jonathan reveals that the TZ variable is being
*set* (added to AUTOEXEC.BAT) by the installation of the PCTCP software.
Note the nonstandard format (not TZ=GMT0BST). I think my generalization
survives.
Anyway, this is off the main point, which is that Perl *can* compute the
local timezone without using TZ. It uses the C library function
localtime(), which calls tzset(), which first looks for TZ; failing that,
it uses the Win32 API GetTimeZoneInformation( &tzinfo ). The Windows
systems have a snappy graphical interface for specifying the local
timezone manually, and know how to keep up with summer timezone changes
automatically.
--
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com
------------------------------
Date: Wed, 3 Jun 1998 18:34:52 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How to set timezone via cgi using perl
Message-Id: <MPG.fdf999a4986950b989697@hplntx.hpl.hp.com>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <6l4rb8$kp0$1@mathserv.mps.ohio-state.edu>, ilya@math.ohio-
state.edu says...
> [A complimentary Cc of this posting was sent to Larry Rosler
> <lr@hpl.hp.com>],
> who wrote in article <MPG.fdf72479e074fb5989693@hplntx.hpl.hp.com>:
...
> > You can determine the timezone of the processor on which the program is
> > executing without looking at the TZ environment variable. Some systems
> > (such as Windows/DOS) don't have such a variable, yet they know the
> > localtime.
>
> Nonsense. They know localtime only because of the stupid initial
> decision to run system clock in local time (with all the evil
> consequences people on DOSISH systems will).
My reference to Windows/DOS means 'DOS under Windows', which knows the
local timezone without using TZ because it is requested by Windows
setup when the system is installed.
> Thus they know localtime, but not globaltime (Win* may be different).
It sure is. Win* knows localtime because the setup activity sets the
clock (originally derived from the CMOS), and globaltime because the
setup activity determines what timezone the user is in.
> > [Believe it or not, Unix guys. The existence of $ENV{TZ} is
> > a reliable differentiator between Unix and WinDOS. $^O is not
> > implemented in older perls such as 5.002, and $^O needs to be parsed in
> > any case.]
>
> Another bullshit. Anybody may (and should - to run programs such as
> perl which care) set TZ on DOSISH machine as well.
Sorry, not bullshit at all. As detailed in my response to Jonathan
Stowe, the C library underlying Perl on Win32 has access to the system
variables set up by the initialization described above. It is true that
TZ can be set to override this, but it is not necessary and probably
inadvisable.
> Ilya
Larry
--
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com
------------------------------
Date: Wed, 03 Jun 1998 21:15:55 -0500
From: Andreas <andreas@gson.com>
Subject: ISO: Perl script that will index site for search enging.
Message-Id: <35760358.6CCF9A4E@gson.com>
I need to index a newspaper site for quicker searchability, anyone know
of a perl script that will do this ... or any suggestions?
Please reply through e-mail.
- Andreas
------------------------------
Date: 4 Jun 1998 02:44:26 GMT
From: ehood@geneva.acs.uci.edu (Earl Hood)
Subject: Re: map in void context regarded as evil - suggestion
Message-Id: <6l51ma$o21@news.service.uci.edu>
In article <6l48ft$2c3$2@client3.news.psi.net>,
Abigail <abigail@fnx.com> wrote:
>As for paragraphs being containers - that's follows from HTML being defined
>with SGML rules.
Not true, technically. Paragraphs were advocated as containers to
follow the philosophy used in developing SGML application and modeling
document data. SGML does not prohibit someone to define an application
where paragraph breaks are used instead of paragraph containers.
>The decision to move HTML towards SGML was proposed by
>Dan Conolly, back in 1992 or so.
Connolly.
--ewh
PS. What's this have to do with Perl?
--
Earl Hood | University of California: Irvine
ehood@medusa.acs.uci.edu | Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME
------------------------------
Date: 4 Jun 1998 03:15:03 GMT
From: ehood@geneva.acs.uci.edu (Earl Hood)
Subject: Re: map in void context regarded as evil - suggestion
Message-Id: <6l53fn$p8k@news.service.uci.edu>
In article <357434CC.7FCF9C89@negia.net>,
Dan Boorstein <danboo@negia.net> wrote:
>POD is great.
>POD is good.
>Let us thank it C<for> our effective C<and>
>relevant documentation C<format>.
Then label your post as text/x-pod, or equivalent media-type.
--ewh
--
Earl Hood | University of California: Irvine
ehood@medusa.acs.uci.edu | Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME
------------------------------
Date: 4 Jun 1998 03:12:42 GMT
From: ehood@geneva.acs.uci.edu (Earl Hood)
Subject: Re: map in void context regarded as evil - suggestion
Message-Id: <6l53ba$p2n@news.service.uci.edu>
In article <pudge-0206981245220001@192.168.0.3>,
Chris Nandor <pudge@pobox.com> wrote:
>In article <35741f81.7197152@news.btinternet.com>,
>Gellyfish@btinternet.com (Jonathan Stowe) wrote:
># Just a thought but shouldnt POD markup be deprecated in usenet
># postings just as HTML is ?
>
>Why?
For the same reasons as HTML.
(BTW, It can be argued that HTML is a more acceptable format than POD
since more news reading software has some form of HTML rendering
capabilities than POD rendering capabilities)
If you do not advocate MIME for USENET postings, then you can not
advocate media-types that are different from text/plain (Note, I am not
saying that you do not advocate MIME on USENET, but many do not, and
they criticize people who post MIME messages).
With such a broad reader base that USENET has, media-types should not
be adopted that is widely accepted and standardized. With newsreader
software not even treating text/plain messages right, I have little
faith in them dealing with other media-types properly.
Also, many alternatives to text/plain tend to ignore the types of
displays and software people use (USENET != WWW) and ignore those
with disabilities.
Note, markup like Setext or even text/enriched would be than POD
for supplying better some additions to plain 'ol text but still
be readable for non-capabable viewers. Personally POD is ugly to
read when it comes with its block constructs. What's more
readable:
This is a list in plain text:
o Item 1
o Item 2
This is the same list in POD:
=over 4
=item *
Item 1
=item *
Item 2
=back
For reference, HTML version:
<UL>
<LI>Item 1
<LI>Item 2
</UL>
--ewh
--
Earl Hood | University of California: Irvine
ehood@medusa.acs.uci.edu | Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME
------------------------------
Date: 04 Jun 1998 01:21:35 GMT
From: honeysiren@aol.com (HoneySiren)
Subject: newbie....and counters..
Message-Id: <1998060401213500.VAA15599@ladder01.news.aol.com>
hi everybody...
you could consider me a newbie to these kinds of newsgroups :)
in any case, i was wondering if anyone could help me.
i just moved to my friend's server, which supports cgi scripts so for the first
time i want to try out things with my webpage, java- and cgi-wise.
what exactly does making your own counter involve? i hear it involves cgi
scripts i believe but i'm not sure how to go about doing this sort of thing.
(bear with me...i'll learn .... :)
if anyone could email me about it and help me out i would appreciate it _so_
much.......
love, laura
honeysiren@aol.com
------------------------------
Date: Thu, 04 Jun 1998 01:23:47 GMT
From: birgitt@my-dejanews.com
Subject: Re: novice question: improving this code?
Message-Id: <6l4sv3$6gk$1@nnrp1.dejanews.com>
In article <6l4641$86d$1@monet.op.net>,
mjd@op.net (Mark-Jason Dominus) wrote:
>
>
> In article <brinton-0306980914230001@p026.intchg3.net.ubc.ca>,
> Ralph Brands <brinton@unixg.ubc.ca> wrote:
> > I am not a programmer, but have been able to develop a perl script
> >that does the following:
>
> Congratulations! You're now a programmer. You might as well admit it.
>
> If you're likely to be searching the same file repeatedly, a good
> strategy is to build an index database. The best way to do that is to
> do some research and to use someone else's search programs. Check
> around. (I'd recommend one, but I don't know the answer myself.)
>
[snip an outstanding answer]
It is for answers like these that I wouldn't want to miss
reading c.l.p.m anymore. What a kind and helpful answer!
Thanks.
Birgitt Funk
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Tue, 2 Jun 1998 07:01:20 -0400
From: "Scott" <sdh1@anchor.hotmail.com>
Subject: Re: odbc and unix perl
Message-Id: <6l524i$lj9$1@camel18.mindspring.com>
>I thought Unix didn't support ODBC? I could be wrong though.
Yes, Unix does support ODBC, or open database connectivity. That's the
whole point of it.
It isn't W32DBC...
Anyway, what you need to do is hunt down the DBD module which is the
connectivity. I believe that
the ODBC module is in the early alpha state, the last I looked.
What database are you trying to talk with? ODBC is the slow way to go.
There are other modules
out there that talk directly to a bunch of databases out there. Ingres,
Oracle, Informix, Sybase, and
so forth. You will need some of the database libraries to compile into the
perl code though.
------------------------------
Date: 4 Jun 1998 02:45:52 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Perl Search Engine
Message-Id: <6l51p0$g2j$1@comdyn.comdyn.com.au>
In article <3573162A.92BF7855@wpo.iupui.edu>,
Brandy Skirvin <bskirvin@wpo.iupui.edu> writes:
>
> --------------B162EACCA346ECA9DC0F7B6E
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
Please don't do this. Usenet is a plain text medium. There is no place
here for HTML and other browser dependent markup languages. Besides
that, your post is about 150% larger because of the HTML.
> Hi there.
>
> I am using a search engine using PERL. I am not a PERL programer so I
It's perl if you talk about the program, Perl if you talk about the
language. Not PERL.
> am using a basic search engine written by another programmer. I am
> using the script to search the HTML files on my web site. The script
> searches in the directory that I specify and opens all the HTML files
> and compares the string used on the search form. Then it returns a page
> with the links to those files.
Not exactly efficient if the site gets large.
> My question is this: What could I write/Include to the script so it can
> avoid including on the search resutls the HTML pages that are named as
> ("left_pagename.html" or "header_pagename.html" , and
> "body_pagename.html"?
Ok, even though it's very unclear what you ask here, I'll interpret it
as: how to make sure that the result pages from this program are not
included in other searches this program does: exclude the names from
the list of files the program searches.
That will depend highly on how your program does this. You might be
able to use grep on some readdir results. You might need to change a
sub that is called by File::Find functionality. How are we supposed to
know? I don't see any code.
And, before you post 6000 lines of code: Please, try to isolate the
part that builds the list of files to search, and post just that
little bit. Not all of it.
> Please help me with this, I don't know any PERL.
Then, seriously, you shouldn't be trying to program in it. Not unless
you are willing to learn it.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | 75% of the people make up 3/4 of the
Commercial Dynamics Pty. Ltd. | population.
NSW, Australia |
------------------------------
Date: 4 Jun 1998 02:49:22 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Program output piping under NT (for web browser)
Message-Id: <6l51vi$g2j$2@comdyn.comdyn.com.au>
In article <3575B8BA.91D68732@umbc.edu>,
Martin Cadirola <mcadir1@umbc.edu> writes:
> Hello!!!
Don't shout.
> print "Content-Type: text\html\n\n";
Check that type. It's wrong.
This has absolutely nothing to do with perl, of course. The perl
program was running fine. You're just printing crap. You would have
known that if you had bothered to read some of the CGI documentation:
Perl CGI FAQ and (no offense) Idiot's guide:
http://www.perl.com/CPAN/doc/FAQs/cgi/idiots-guide.html
http://www.perl.com/CPAN/doc/FAQs/cgi/perl-cgi-faq.html
Section 9 of the perl FAQ:
# perldoc perlfaq9
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Make it idiot proof and someone will
Commercial Dynamics Pty. Ltd. | make a better idiot.
NSW, Australia |
------------------------------
Date: Wed, 03 Jun 1998 23:05:25 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Regex: parens inside quantifiers: can you capture all of them?
Message-Id: <comdog-ya02408000R0306982305250001@news.panix.com>
Keywords: show off!
In article <357558E5.D7FFECB9@matrox.com>, Ala Qumsieh <aqumsieh@matrox.com> posted:
>Peter Scott wrote:
>
>> # animal foods mammal? sounds
>>
>> $_ = "dog kibble biscuits pal Y bark woof";
>> @fs = /(\w+) (?: \s+ (\w+) )* \s+ ([YN]) (?: \s+ (\w+) )*/x;
>
>Are you sure you want to use (?:) here? This allows the matching of what's
>inside the brackets without the creation of a backreference! So whatever is
>matched there won't appear inside @fs.
that seems to be the point - he wants to group the whitespace with
the word next to it. the problem is the construct
(?: \s+ (\w+) )*
the (\w+) does create a backreference, but since the * says to match
zero or more times, it tries to match again. if it does, the matched
value goes into the same memory variable! it might seem that it
should create another memory, but that's what one gets for trying
to guess what Perl is going to do :)
>Also, the /x modifier is not needed
>unless your regexp spreads over multiple lines.
the x modifier tells the m// to ignore whitespace - all of those
spaces between the // would be literal without them.
[interestingly, i'm looking at a slide titled "Lexing with Perl" from
a particular Perl class taught by a particular Perl personality. :)]
rather than trying to write one messy, one might write a tokenizer so
one can play with the \G and friends:
#!/usr/bin/perl
$_ = "dog kibble biscuits pal Y bark woof";
#get the animal name.
#use the g modifier to remember where we left off
m/^(\w+)/g;
$animal = $1;
#now tokenize the string
{
#\G anchors the match to where we ended
#c keeps a failed match from resetting pos()
if( /\G \s+ ([YN])/gcx )
{
$mammal = $1;
$find_sounds = 1; print "find = $find_sounds";
}
elsif( $find_sounds and /\G \s+ (\w+)/gcx )
{
push @sounds, $1
}
elsif( /\G \s+ (\w+)/gcx )
{
push @foods, $1
}
else
{
print "Why am i here?\n";
last
}
redo
}
print "Animal: $animal\nMammal: $mammal\nFoods: @foods\nSounds: @sounds\n"
> My solution might not be the best one, but it works:
>
>$_ = "dog kibble biscuits pal Y bark woof";
>$_ =~ /^(\w+)\s*(.*)\s*([YN])\s*(.*)\s*$/x;
>print "$1: $2 $3 $4\n";
>
>$2 and $4 contain a list (if any) of the foods and sounds, respectively.
nope - $2 and $4 and any other thingy beginning with a $ is a scalar,
not a list. scalars hold single values.
furthermore, notice your own useless use of the x modifier, which
you just (incorrectly) ranted about above!
and then, notice how the greediness affects things! might as well
leave out some of those \s*, since they are useless as well!
--
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 T-shirts! <URL:http://www.pm.org/tshirts.html>
this is a three regex tour!
------------------------------
Date: 4 Jun 1998 02:27:58 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Specialized Split
Message-Id: <6l50ne$fvi$1@comdyn.comdyn.com.au>
In article <6l4aa2$h9i@spool.cs.wisc.edu>,
horn@beaner.cs.wisc.edu (Jeffrey Horn) writes:
> I am looking for a slick way to split on a given character/pattern
> only if that character/pattern does not fall between opening and closing
> parens.
>
> Thus if I were to split on /\+\-/
surely you mean [+-]? Your regexp matches a + followed by a -.
>
> (1-3)+(2+5)
>
> would only split into two elements:
>
> (1-3)
> (2+5)
And how would ((1-3)+(2+5)) split? Things like these can nest, and
that poses a bit of a problem for regexps. They tend to get very
complex very fast.
You might have a look at perlfaq6, the question 'Can I use Perl
regular expressions to match balanced text?'
Assuming there's no nesting:
Another problem you have, is that the + in the middle, does fall
between a ( and a )
(1-3)+(2+5)
^ ^ ^
reversing the problem ,and just looking for a + or - that falls
between a ) and a ( will break for things like:
5+(1-3)-4
Of course, you could look for any [+-] that falls between the
start of the string and a (, a ) and a (, or a ) and the end of a
string, but that gets a bit nasty. Besides, you'd need all kinds of
lookaheads and I'm not even sure if they'll suffice for this. And that
wouldn't solve the problem of nesting parentheses.
You might be able to do it with a regexp, and I am sure that Eli will
tell you so, if it can be done, but I wouldn't even try. I'd probably
use something like the script referred to in perlfaq6
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | I'm just very selective about what I
Commercial Dynamics Pty. Ltd. | accept as reality - Calvin
NSW, Australia |
------------------------------
Date: 4 Jun 1998 01:43:35 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Submitting http request and getting/parsing resulting page?
Message-Id: <6l4u47$fmf$2@comdyn.comdyn.com.au>
In article <6l2j5o$uq1$1@nnrp1.dejanews.com>,
sylviamoestl@my-dejanews.com writes:
> Hello,
>
> I'd like to be able to do the following programatically in Perl:
>
> Take numerous URL strings (for example,
> http://www.xxx.com/test.spl?parameter=ABC)
> Send them out over the internet
> Return the page that the URL returns, be able to parse it out, etc.
Sounds like you might enjoy libwww (LWP) to get the documents, and
maybe HTML::Parser to parse them. You can get both from CPAN:
http://www.perl.com/CPAN.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | 75% of the people make up 3/4 of the
Commercial Dynamics Pty. Ltd. | population.
NSW, Australia |
------------------------------
Date: 4 Jun 1998 02:35:31 GMT
From: ehood@geneva.acs.uci.edu (Earl Hood)
Subject: Re: Use of HTML, POD, etc in Usenet (was: Re: map in void context regarded as evil - suggestion)
Message-Id: <6l515j$no4@news.service.uci.edu>
In article <896915435.549707@thrush.omix.com>,
Zenin <zenin@bawdycaste.org> wrote:
>Chris Nandor <pudge@pobox.com> wrote:
>: Huh? I have never seen a POD reader built-in to a newsreader. Hence, POD
>: in a post will look the same to everyone, necessarily.
>
> If you're using a format other then text/plain, by RFC 1036 it must
> be declared as such. Therefor, the reader would try to run whatever
> it had mapped to handle type text/x-pod, if it had such a tool
> available.
Finally, someone mentions RFCs. If you are going to use a format that
is different than text/plain, then you better label your message as
such so software can take the appropriate action. If I see C<map>, I
am going to say what the h*ll is that. This is a text/plain message.
Now we are getting into the realm of MIME, and we know how some people
feel about MIME postings on the USENET (at least in some newsgroups).
--ewh
--
Earl Hood | University of California: Irvine
ehood@medusa.acs.uci.edu | Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME
------------------------------
Date: 4 Jun 1998 02:01:53 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Win32 Perl and Unix Perl
Message-Id: <6l4v6h$fmf$4@comdyn.comdyn.com.au>
In article <6l48k6$2k4$1@ffx2nh2.uu.net>,
cspence@delphi-tech.com (Christopher Spence) writes:
> Besides os, what is the comparison of speed? Is there much of a difference?
And exactly _how_ are you going to exclude the OS from the comparison?
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au |
Commercial Dynamics Pty. Ltd. | What's another word for Thesaurus?
NSW, Australia |
------------------------------
Date: Wed, 03 Jun 1998 21:24:46 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: X ticks with GIFgraph
Message-Id: <comdog-ya02408000R0306982124460001@news.panix.com>
Keywords: from just another new york perl hacker
In article <3575339A.E84EF726@pallas.tid.es>, Jurgen Koeleman <jurgen@pallas.tid.es> posted:
>I am using the module GIFgraph to display GIF output for a graph, but
>have a problem with it and don't know how to solve it.
>
>I want to use the ticks on the X-axis, but not for each data point.
>E.g. for all the minutes of the day there is a data point, but the
>ticks are only needed once every 60 minutes.
>Does somebody know how to do this?
have you tried the x_label_skip option? see the docs for details.
if that doesn't do what you want, i'll tell you what to change in
GIFgraph::axestype.pm to make it work :)
--
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 T-shirts! <URL:http://www.pm.org/tshirts.html>
graphs are fun.
------------------------------
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 2803
**************************************