[17178] in Perl-Users-Digest
Perl-Users Digest, Issue: 4590 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 11 21:10:28 2000
Date: Wed, 11 Oct 2000 18:10:14 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <971313014-v9-i4590@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 11 Oct 2000 Volume: 9 Number: 4590
Today's topics:
Re: passing info with POST <flavell@mail.cern.ch>
Re: passing info with POST (brian d foy)
Re: passing info with POST (brian d foy)
Re: passing info with POST <flavell@mail.cern.ch>
Re: passing info with POST (Mark-Jason Dominus)
Re: passing info with POST (Mark-Jason Dominus)
Re: passing info with POST <jeff@vpservices.com>
Re: passing info with POST (Mark-Jason Dominus)
Re: passing info with POST (brian d foy)
Re: passing info with POST <flavell@mail.cern.ch>
Re: passing info with POST (brian d foy)
Re: passing info with POST <jeff@vpservices.com>
Re: passing info with POST <jeff@vpservices.com>
Re: passing info with POST <flavell@mail.cern.ch>
Re: pattern matching help ( ~s/// ) <jeff@vpservices.com>
Re: Please help with simple regexp. <lr@hpl.hp.com>
Re: regex challenge <david.obrien@ssmb.com.au>
Re: regex challenge <anmcguire@ce.mediaone.net>
Re: regex challenge <ren.maddox@tivoli.com>
Re: Return Value from DBI Execute? (Chris Fedde)
simulate keyboard activity bhaskaracharya@my-deja.com
Re: some questions stdenton@my-deja.com
Re: some questions (Craig Berry)
Re: Using a comparison routine in another package stdenton@my-deja.com
Re: Using each() on hash of hashes = Thanks <anmcguire@ce.mediaone.net>
Re: Using each() on hash of hashes dustintodd@my-deja.com
Re: Using SSI in perl program <elephant@squirrelgroup.com>
Re: Using Win32 in cgi-scripts <elephant@squirrelgroup.com>
Re: will perl 5 work w/o server on my PC (Craig Berry)
Win32::API & struct (help!) kurtgg@my-deja.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 11 Oct 2000 23:52:21 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: passing info with POST
Message-Id: <Pine.GHP.4.21.0010112339560.28061-100000@hpplus03.cern.ch>
On Wed, 11 Oct 2000, brian d foy wrote:
> > Check out a CGI tutorial somewhere. This has nothing specifically to
> > do with Perl.
>
> i have to disagree.
I'm sorry, I didn't make myself properly clear. I was recommending
the questioner to address the problem in a simpler fashion, without
using the URL query string in conjunction with a POST request.
_That_ would be perfectly standard non-Perl-specific stuff.
> to make this happen with CGI.pm, last time
> i looked, you had to uncomment a line of code.
I know what you're getting at, but...
> it's cleary documented
> in the source
Indeed it is, but that then causes the module to append the query
string to the POST data. In other words, a non-standard way of
getting precisely the same result as with the bog-standard method
(hidden field) that I was describing.
What I understood the hon. Usenaut to be requesting is what is
documented at http://stein.cshl.org/WWW/software/CGI/ under the
heading "Mixing POST and URL Parameters". However, I was - and am -
somewhat disinclined to promote this to the hon. Usenaut, as I'm given
to understand there may be browser bugs in this general area, and I
see no particular reason for not using the striaghtforward solution of
a hidden field (as I now see that others have also advocated).
> it's been useful to me for some things :)
Well, you're experienced enough to cope with the consequences ;-)
cheers
------------------------------
Date: Wed, 11 Oct 2000 18:18:46 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: passing info with POST
Message-Id: <brian-ya02408000R1110001818460001@news.panix.com>
In article <39e4df7d.4dde$116@news.op.net>, mjd@plover.com (Mark-Jason Dominus) posted:
> In article <brian-ya02408000R1110001455140001@news.panix.com>,
> brian d foy <brian@smithrenaud.com> wrote:
> >In article <39e4aecd.4650$1af@news.op.net>, mjd@plover.com (Mark-Jason Dominus) posted:
> >> If the request URL for a POST form includes a quesry string, as yours
> >> does, many browsers will send the data incorrectly. Some won't send
> >> the query string at all. Some will send it with the rest of the form
> >> via the reqest content. You cannot depend on this. (The standard is
> >> quite clear on what *should* be done, but as usual the browser writers
> >> have screwed it up.)
> >
> >is it clear?
>
> It's clear to me. Section 17.13.3 of the W3C HTML 4.01 spec says:
the parts that you quote don't say anything about a query string
in the ACTION URI for a POST. it says nothing about restricting
the values of the URI. a query string is a valid part of a URI,
and a URI is a valid value for the ACTION attribute. it is not forbidden
by the HTML specification and no other comments are made about valid
ACTION values other than only http schemes have defined behaviour.
i don't see how you think the specification is clear, or even
supports your assertion, on this issue.
perhaps you think that i meant to say that the field and value
pairs in the ACTION URI would show up in the message body. that is
not so. i expect them to show up in the request URI in the HTTP
request line. indeed, this is where CGI.pm looks for them if the
request method was POST.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: Wed, 11 Oct 2000 18:26:21 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: passing info with POST
Message-Id: <brian-ya02408000R1110001826210001@news.panix.com>
In article <Pine.GHP.4.21.0010112339560.28061-100000@hpplus03.cern.ch>, "Alan J. Flavell" <flavell@mail.cern.ch> posted:
> On Wed, 11 Oct 2000, brian d foy wrote:
> > to make this happen with CGI.pm, last time
> > i looked, you had to uncomment a line of code.
> Indeed it is, but that then causes the module to append the query
> string to the POST data. In other words, a non-standard way of
> getting precisely the same result as with the bog-standard method
> (hidden field) that I was describing.
i certainly wasn't recommending it. i just know that it is there.
if i ever do this sort of thing i *do not* mix the two data
sources.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: Thu, 12 Oct 2000 00:16:13 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: passing info with POST
Message-Id: <Pine.GHP.4.21.0010120007550.28061-100000@hpplus03.cern.ch>
On Wed, 11 Oct 2000, Chris Fedde wrote:
> It seems that the sections that bryan d foy quoted refer to the
> behavior of the user agent, not to the behavior of the server.
> Details of what the query string part of a URI means to the server
> recieving a POST request are AFAIK undefined.
I think either you're mistaken or I've misunderstood what you're
getting at. The best spec we have for CGI is
http://www.golux.com/coar/cgi/draft-coar-cgi-v11-03-clean.html
and it's section 6.1.8 that deals with this
http://www.golux.com/coar/cgi/draft-coar-cgi-v11-03-clean.html#6.1.8
As far as I can see, if the URL includes a query string then
the server is mandated to pass it across the CGI interface to the
script. This is irrespective of whether the method was GET or POST.
The point that is at issue, I think, is to what extent a client
agent submitting a FORM with POST would honour a query string
that had been included in the ACTION URL.
However, as you say, I fear we are straying way off-topic
for c.l.p.m.
If it wasn't for the pernickety way in which the c.i.w.a.cgi
automoderator bot sabotages attempts to cross-post-and-f'up, I
would already have done that. Best I can do is to suggest
f'ups, and invite anyone who finds this thread there to check
back in comp.lang.perl.misc to see how the thread started.
cheers
------------------------------
Date: Wed, 11 Oct 2000 22:51:11 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: passing info with POST
Message-Id: <39e4eedf.501a$206@news.op.net>
In article <brian-ya02408000R1110001818460001@news.panix.com>,
brian d foy <brian@smithrenaud.com> wrote:
>> It's clear to me. Section 17.13.3 of the W3C HTML 4.01 spec says:
>
>the parts that you quote don't say anything about a query string
>in the ACTION URI for a POST.
So what? It says that the browser is required to send the request to
the action URI. There is no need to mention a query string or a
question mark or anything else specifically, because the behavior is
so simple: The browser must post to the action URI, period.
One behavior that I was complaining about is that some browsers would
send the request to a truncated version of the action URI; they would
truncate it at the question mark. This is the behavior I said was out
of spec. Are you seriously arguing that the spec allows this?
>it says nothing about restricting
>the values of the URI.
Neither did I. I did not say that it is illegal to have a question
mark in the action URI. I said that it was *inadvisable* to include
one because browsers tend to screw it up. I said that some browsers
mangle URIs that contain question marks, and I said that this is
forbidden. You then said that it was not forbidden, that the behavior
was undefined, and I still think you are mistaken.
> a query string is a valid part of a URI,
>and a URI is a valid value for the ACTION attribute.
Yes, and the browser is not allowed to truncate that part of the URI.
However, some browsers do that.
------------------------------
Date: Wed, 11 Oct 2000 22:57:23 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: passing info with POST
Message-Id: <39e4f052.5051$3a@news.op.net>
Keywords: Legendre, hack, homeland, molasses
In article <gq5F5.20$T3.170882560@news.frii.net>,
Chris Fedde <cfedde@u.i.sl3d.com> wrote:
>It seems that the sections that bryan d foy quoted
I quoted; Foy did not.
>refer to the behavior of the user agent,
Right. And the point I was trying to discuss is that it's a bad idea
to have a CGI program that expects both query string *and* POST
content, because many browsers do the wrong thing, for example by
failing to send the query string at all.
>That leaves us with the robustness princeple. Which is apparently
>what CGI.pm does.
If the browser does not send the query string, there is no way the
software on the server side can possibly be robust enough to handle
the situation.
if the browser is behaving according to spec, then the programmer can
retrieve the query-string information on the server side using the
->query_string method, and I showed an example of this. The code that
Brian pointed to in CGI.pm is only for conveneience, so that the
programmer gets the query string *as if* it had been passed as part of
the POST content.
------------------------------
Date: Wed, 11 Oct 2000 15:58:35 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: passing info with POST
Message-Id: <39E4F09B.C2E2C9BC@vpservices.com>
"Christopher M. Jones" wrote:
>
> "Paul Leduc" <pleduc@ca.ibm.com> wrote:
> >
> > I am trying to use the same CGI for several buttons in a form,
This is what the OP asked for: SEVERAL BUTTONS ... in ... A FORM.
In other words a single form containing more than one button which pass
different values depending on which is clicked.
> <input type="hidden" name="name" value="value1">
You're right that the hidden field is a very nice method for passing
extra information within a form, but it really has nothing to do with
using different buttons in a single form.[1] What the OP needs, as I
already posted, is two different submit buttons with different values.
[1] actually one could construct two forms and have them both go to the
same CGI, each with a different hidden variable. To the user, that
would appear to be two buttons on the same form but behind the scenes
would require two separate forms, not a single form.
--
Jeff
------------------------------
Date: Wed, 11 Oct 2000 23:08:28 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: passing info with POST
Message-Id: <39e4f2ec.50ad$29c@news.op.net>
Keywords: Chou, fluke, pennyroyal, surprise
In article <39E4F09B.C2E2C9BC@vpservices.com>,
Jeff Zucker <jeff@vpservices.com> wrote:
>> > I am trying to use the same CGI for several buttons in a form,
>
>This is what the OP asked for: SEVERAL BUTTONS ... in ... A FORM.
Yes, and then he showed an HTML example which was clearly *not*
'several buttons in a form'. It was clearly 'several forms'.
So which are you going to believe? The code, or his description of it?
I chose to believe the code. I guessed that he really had several
forms, with one button each, as you described in your footnote [1],
and that the OP's descrioption of the situation was erroneous, perhaps
because he did not really understand what he was doing. Maybe that is
wrong, but I am not clairvoyant.
You guessed the opposite, that the description was correct and the
code was not. That is fine, but it is not a reason to take issue with
someone who guessed differenly. Unless the OP clarifies his
contradictory remarks, there is no way to know.
------------------------------
Date: Wed, 11 Oct 2000 19:41:15 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: passing info with POST
Message-Id: <brian-ya02408000R1110001941150001@news.panix.com>
In article <39e4eedf.501a$206@news.op.net>, mjd@plover.com (Mark-Jason Dominus) posted:
> In article <brian-ya02408000R1110001818460001@news.panix.com>,
> brian d foy <brian@smithrenaud.com> wrote:
> >it says nothing about restricting
> >the values of the URI.
> Neither did I. I did not say that it is illegal to have a question
> mark in the action URI.
then i think we agree.
my point was that there is no guidance in this case. indeed, there
is no discussion in any of the specifications about dealing with
query strings and message bodies simultaneously, although CGI.pm
makes a guess at it.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: Thu, 12 Oct 2000 01:33:11 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: passing info with POST
Message-Id: <Pine.GHP.4.21.0010120128050.22015-100000@hpplus03.cern.ch>
On Wed, 11 Oct 2000, Jeff Zucker wrote:
> This is what the OP asked for: SEVERAL BUTTONS ... in ... A FORM.
Well, I responded to the specimen code, and, to be honest omitted to
notice the part of the posting asking the above FAQ.
If the hon usenaut wants answers to a FAQ, they should get it from the
peer-reviewed FAQ document, instead of stirring up the lieges on an
only peripherally-related group.
See http://www.htmlhelp.org
> In other words a single form containing more than one button which pass
> different values depending on which is clicked.
Yup, _that_ FAQ.
all the best
------------------------------
Date: Wed, 11 Oct 2000 19:45:49 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: passing info with POST
Message-Id: <brian-ya02408000R1110001945490001@news.panix.com>
In article <39e4f052.5051$3a@news.op.net>, mjd@plover.com (Mark-Jason Dominus) posted:
> In article <gq5F5.20$T3.170882560@news.frii.net>,
> Chris Fedde <cfedde@u.i.sl3d.com> wrote:
> >It seems that the sections that bryan d foy quoted
>
> I quoted; Foy did not.
i don't remember quoting anything from the specs.
> >refer to the behavior of the user agent,
i was initially thinking about the server and CGI, which is
probably why there is confusion.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: Wed, 11 Oct 2000 16:58:28 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: passing info with POST
Message-Id: <39E4FEA4.C4435652@vpservices.com>
Mark-Jason Dominus wrote:
>
> In article <39E4F09B.C2E2C9BC@vpservices.com>,
> Jeff Zucker <jeff@vpservices.com> wrote:
> >> > I am trying to use the same CGI for several buttons in a form,
> >
> >This is what the OP asked for: SEVERAL BUTTONS ... in ... A FORM.
>
> Yes, and then he showed an HTML example which was clearly *not*
> 'several buttons in a form'. It was clearly 'several forms'.
>
> So which are you going to believe? The code, or his description of it?
>
> I chose to believe the code.
>
> You guessed the opposite, that the description was correct and the
> code was not. That is fine, but it is not a reason to take issue with
> someone who guessed differenly. Unless the OP clarifies his
> contradictory remarks, there is no way to know.
Yes, you're right about that. Sorry for phrasing it as though I was
right and those of you who went with the hidden field approach were
wrong. Until PSI::ESP goes beyond the alpha release, there isn't a way
to know for sure in advance and both are legitimate responses to the OP.
--
Jeff
------------------------------
Date: Wed, 11 Oct 2000 17:03:29 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: passing info with POST
Message-Id: <39E4FFD1.36C67784@vpservices.com>
"Alan J. Flavell" wrote:
>
> If the hon usenaut wants answers to a FAQ, they should get it from the
> peer-reviewed FAQ document, instead of stirring up the lieges on an
> only peripherally-related group.
>
> See http://www.htmlhelp.org
>
Point taken. Sorry.
--
Jeff
------------------------------
Date: Thu, 12 Oct 2000 02:16:47 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: passing info with POST
Message-Id: <Pine.GHP.4.21.0010120214580.23460-100000@hpplus03.cern.ch>
On Wed, 11 Oct 2000, Jeff Zucker wrote:
> Point taken. Sorry.
Oh, it wasn't you I was getting-at. I've always had a high opinion of
your advice. Just in the heat of the chase and all that - one doesn't
always pick quite the right line.
all the best
------------------------------
Date: Wed, 11 Oct 2000 17:50:12 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: pattern matching help ( ~s/// )
Message-Id: <39E50AC4.CFB7FFA1@vpservices.com>
Larry Rosler wrote:
>
> > These two are exactly the
> > same (try it and see):
> >
> > s/a/b/; s'a'b';
>
> It is true that the two 'are exactly the same' in this specific case,
> but not in general, because of the specific choice of single-quotes as
> the alternate delimiters.
>
> From perlop:
>
> PATTERN may contain variables, which will be interpolated (and the
> pattern recompiled) every time the pattern search is evaluated, except
> for when the delimiter is a single quote.
Ooops, thanks for the correction, obviously I forgot about that.
--
Jeff
------------------------------
Date: Wed, 11 Oct 2000 15:51:21 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Please help with simple regexp.
Message-Id: <MPG.144e8ebfdca2ef3798ae2b@nntp.hpl.hp.com>
In article <8s202p$cf4$1@bob.news.rcn.net> on Wed, 11 Oct 2000 11:14:13
-0400, Sanjay <svp011467@yahoo.com> says...
...
> I just want
> http://myserver.com/client1/Oct00
> http://myserver.com/client2/Oct00
> http://myserver.com/client3/Oct00
> etc.
>
> We run these reports on November 1, but
> I want it to show the previous month(e.g. oct for
> the scheduled nov run)...
> %mon% pulls the current system month (nov)
I don't know what '%mon%' means; it isn't Perl!
> but how can i subtract 1 to get the previous month?
> is there a way to do %mm%-1 then convert back to letters
Or '%mm%' (which is probably '%mon%' anyway).
> (i.e. Oct) ALL IN ONE LINE.
Here's one very long line (plus the initialization):
my ($mon, $months) = 'nov';
$mon = substr $months = 'JanFebMarAprMayJunJulAugSepOctNovDec',
index($months, "\u\L$mon") - 3, 3;
Note the nifty wraparound for January. :-)
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 12 Oct 2000 09:12:26 +1000
From: Dave O'Brien <david.obrien@ssmb.com.au>
Subject: Re: regex challenge
Message-Id: <39E4F3DA.93E973B4@ssmb.com.au>
Uri Guttman wrote:
>
> >>>>> "G" == Godzilla! <godzilla@stomp.stomp.tokyo> writes:
>
> G> Uri Guttman blathered:
> >> > Godzilla! wrote an article at too high of a language
> G> level for his reading comprehension skill level:
>
> typical misquote (rather made up quote).
>
> >> you snipped the important part and didn't read the subject. typical lack
> >> of reading comprehension from moronzilla.
>
> >> Subject: regex challenge
>
> G> You are correct. I missed all this header information.
> G> Thank you for posting this. I shall be more careful
> G> about reading all header content. This is important.
>
> just read the subject header. so how could you have claimed the above
> article and then apologize for the lack of header parsing skills?
>
> oh, it is moronzilla! logic need not apply.
>
> uri
>
> --
> Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
> SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
> The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
> The Best Search Engine on the Net ---------- http://www.northernlight.com
My god! An apology from Godzilla! You are the man Uri. (or woman)
------------------------------
Date: Wed, 11 Oct 2000 17:56:28 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: regex challenge
Message-Id: <Pine.LNX.4.21.0010111753470.19469-100000@hawk.ce.mediaone.net>
On Thu, 12 Oct 2000, Dave O'Brien quoth:
DO> Uri Guttman wrote:
DO> >
DO> > >>>>> "G" == Godzilla! <godzilla@stomp.stomp.tokyo> writes:
[ snip ]
DO> > >> you snipped the important part and didn't read the subject. typical lack
DO> > >> of reading comprehension from moronzilla.
DO> >
DO> > >> Subject: regex challenge
DO> >
DO> > G> You are correct. I missed all this header information.
DO> > G> Thank you for posting this. I shall be more careful
DO> > G> about reading all header content. This is important.
DO> >
DO> > just read the subject header. so how could you have claimed the above
DO> > article and then apologize for the lack of header parsing skills?
DO> >
DO> > oh, it is moronzilla! logic need not apply.
[ snip ]
DO> My god! An apology from Godzilla! You are the man Uri. (or woman)
She was being sarcastic, then again you probably are too, and I am just
to stupid to realize it. :-)
anm
--
perl -lwMstrict -e ' # Jim Menard -> Wyzelli -> Andrew McGuire
for$;(reverse++$|..100){$:=$;==$|?q++:"s";$@="bottle";$_=(q\e\x2)."l"x2**1
;m?(..)$?,;$$=" on";print$;=>v32,"$@$:".v32,"of b$`r".$$." th$`\b wa$1,"=>
v10."$; $@$: of b$`r,\012tak$`\b$$"."e down, pass it around,",q&&;$;--;$:=
$;==$|?$!:q-s-=>;print"$; $@$:$$\bf b$`r",$$." the wa$1\n"}print q#*burp*#
'
------------------------------
Date: 11 Oct 2000 16:53:19 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: regex challenge
Message-Id: <m37l7f59kg.fsf@dhcp11-177.support.tivoli.com>
Matt Martini <martini@invision.net> writes:
> I am looking for a regex (an elegant one) that will convert a mac
> address from one form to another.
> The SNMP module returns mac addresses in the format:
>
> " AB 21 34 65 78 09 "
>
> Yes, including the quotes and leading/trainling spaces. I want to
> convert this into a more standard
> notation for mac addresses:
>
> AB21:3465:7809
I haven't seen this style yet:
s/( ..) /$1/g;$_=join":",(split)[1..3];
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Wed, 11 Oct 2000 22:13:21 GMT
From: cfedde@u.i.sl3d.com (Chris Fedde)
Subject: Re: Return Value from DBI Execute?
Message-Id: <5C5F5.23$T3.170882560@news.frii.net>
In article <39E4CC55.15E8A143@iupui.edu>, Joe Wade <jwade1@iupui.edu> wrote:
>I need to know if no rows were updated (because nothing matched the
>inner select) so I can write the non-matching data out to a log file.
>However, all I ever get as a return value from the execute of the update
>is ‘0E0’.
>
DBI manual page contains:
For a non-`SELECT' statement, `execute' returns the
number of rows affected, if known. If no rows were
affected, then `execute' returns "`0E0'", which Perl
will treat as 0 but will regard as true. Note that it
is not an error for no rows to be affected by a state-
ment. If the number of rows affected is not known,
then `execute' returns -1.
Hope this helps
chris
--
This space intentionally left blank
------------------------------
Date: Wed, 11 Oct 2000 22:33:37 GMT
From: bhaskaracharya@my-deja.com
Subject: simulate keyboard activity
Message-Id: <8s2ps2$3gt$1@nnrp1.deja.com>
hi,
how can i simulate a keyboard entry? is this possible with perl?
thanks
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 11 Oct 2000 22:20:36 GMT
From: stdenton@my-deja.com
Subject: Re: some questions
Message-Id: <8s2p3d$2up$1@nnrp1.deja.com>
In article <stn47lt0j4cd16@corp.supernews.com>,
cberry@cinenet.net (Craig Berry) wrote:
> stdenton@my-deja.com wrote:
> : I'm amazed that everyone missed getting rid of the loop!
> : grep tr/"//d, @line;
>
> That doesn't get rid of the loop, it just changes its syntax. grep
> still has to iterate over the list.
Ah, but grep iterates over the list "faster". See, for example,
"Advanced Perl Programming" which states:
<quote>
Perl's opcodes represent a much higher level of abstraction. A large
number of these opcodes directly correspond to the facilities available
at the scripting level, such as regular expression matching and
substitution, chop, push, index, rindex, grep,[3] and so on, which
explains why there are 343 opcodes as of this writing! It also explains
why Perl is so fast: instead of spending time in the interpreter, most
of the work is done in lovingly hand-optimized C code.
</quote>
I would point out that the loop inside the 'grep' opcode is "lovingly
hand-optimized C code" rather than the multiplicity of opcodes required
to inplement a 'foreach' loop.
> Also, it's widely considered
> bad form to use grep or map in void context, since a result list
> is created only to be thrown away[1]. The generally accepted
> compact form for operating on each member of a list is:
>
> tr/"//d foreach @line;
What's wrong with throwing away results? Everytime someone says "++$i"
instead of "$i++", they are throwing away a result. It is the job of
the compiler to optimize for that case.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 11 Oct 2000 23:21:19 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: some questions
Message-Id: <su9tff8n3lqce1@corp.supernews.com>
stdenton@my-deja.com wrote:
: > : I'm amazed that everyone missed getting rid of the loop!
: > : grep tr/"//d, @line;
: >
: > That doesn't get rid of the loop, it just changes its syntax. grep
: > still has to iterate over the list.
:
: Ah, but grep iterates over the list "faster". See, for example,
: "Advanced Perl Programming" which states:
[snip]
Of course! But one should understand that the loop is still hiding in
there somewhere.
: > Also, it's widely considered
: > bad form to use grep or map in void context, since a result list
: > is created only to be thrown away[1]. The generally accepted
: > compact form for operating on each member of a list is:
: >
: > tr/"//d foreach @line;
:
: What's wrong with throwing away results? Everytime someone says "++$i"
: instead of "$i++", they are throwing away a result. It is the job of
: the compiler to optimize for that case.
As I pointed out in text you didn't quote, my issue is not with what the
compiler does, but with what human maintainers see. Human time is a lot
more expensive than machine time these days, in all but the most unusual
circumstances. If your coding style makes it as clear as possible what's
going on, it will be easier to understand a year later when the maintainer
(possibly you) is skimming the source, getting a feel for how things work.
Choosing among map, grep, and foreach idioms to match the 'implied
semantics' as well as obtaining the desired result is one way to achieve
this.
And yes, there are many who disagree with me. YMMV.
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "Quidquid latine dictum sit, altum viditur."
|
------------------------------
Date: Wed, 11 Oct 2000 22:25:20 GMT
From: stdenton@my-deja.com
Subject: Re: Using a comparison routine in another package
Message-Id: <8s2pc9$33e$1@nnrp1.deja.com>
In article <u9k8bn7izm.fsf@wcl-l.bham.ac.uk>,
nobull@mail.com wrote:
> Been there, done that - posted a possible solution for peer review to
> comp.land.perl.moderated under the title "Passing sort subroutine into
> File::Find module - good idea?" back in May. Nobody commented.
> Here's the jist of my post.
Thanks for the reply! I'll be using it tomorrow.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 11 Oct 2000 17:59:24 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: Using each() on hash of hashes = Thanks
Message-Id: <Pine.LNX.4.21.0010111757460.19469-100000@hawk.ce.mediaone.net>
On Wed, 11 Oct 2000, dustintodd@my-deja.com quoth:
> Thanks for info.
[ snip ]
If you really want to thank the newsgroup, post your reply AFTER
or interspersed with the properly trimmed text. :-)
Take Care,
anm
--
perl -lwMstrict -e ' # Jim Menard -> Wyzelli -> Andrew McGuire
for$;(reverse++$|..100){$:=$;==$|?q++:"s";$@="bottle";$_=(q\e\x2)."l"x2**1
;m?(..)$?,;$$=" on";print$;=>v32,"$@$:".v32,"of b$`r".$$." th$`\b wa$1,"=>
v10."$; $@$: of b$`r,\012tak$`\b$$"."e down, pass it around,",q&&;$;--;$:=
$;==$|?$!:q-s-=>;print"$; $@$:$$\bf b$`r",$$." the wa$1\n"}print q#*burp*#
'
------------------------------
Date: Thu, 12 Oct 2000 00:13:04 GMT
From: dustintodd@my-deja.com
Subject: Re: Using each() on hash of hashes
Message-Id: <8s2vmd$88j$1@nnrp1.deja.com>
In article <8s09q3$1mb$1@nnrp1.deja.com>,
dustintodd@my-deja.com wrote:
> My brain has jumped out of my head and is floping around on the round.
> If I wish to iterate through a hash using while and each, but the hash
> is actually stored inside another hash. I am not sure how to get
> reference to has stored inside a hash that I can then give to each().
> Please help.
>
> - Dustin -
>
Ok I fumbled my thank you reply as a kind poster pointed out. Here it
goes again.
Thank you.
- Dustin -
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 12 Oct 2000 11:24:02 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: Using SSI in perl program
Message-Id: <MPG.144fbdbe6099e9ad989811@localhost>
Rao wrote ..
>I would appreciate an example code to include an SSI tag inside a perl
>program i.e. how to make something like the following work:
>#!usr/bin/perl -w
>print "Content-type: text/html\n\n";
>print <<THIS;
><HTML><BODY>
><!--#include file="themenu.html"-->
>THIS
>print "</BODY></HTML>;
#!/usr/bin/perl -w
use strict;
my $path_to_SSIs = '/some/path/';
open SSI_FILE, $path_to_SSIs. 'themenu.html' or die "Bad open: $!";
my $menu;
{ local $/; $menu = <SSI_FILE> }
close SSI_FILE;
print <<__EOI;
Content-type: text/html
<HTML>
<BODY>
$menu
</BODY>
</HTML>
__EOI
__END__
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Thu, 12 Oct 2000 11:26:53 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: Using Win32 in cgi-scripts
Message-Id: <MPG.144fbe674d4c79af989812@localhost>
Fred Koene wrote ..
>I work since a week with the Win32 library. Everything works nicely. However
>when i use this library in a cgi script it works nicely from the command
>line but not in my browser. The generated html is undoubtedly correct. I
>want to list the properties of a service running on a NT-server using use
>Win32::Services.
>
>please help me !
there is a FAQ that deals with programs that run from the command line
but not from CGI .. the following perldoc command will show it to you
perldoc -q "CGI.*command.line"
hint: the problem is probably caused because the command line program
and the CGI program are not run under the same Windows user account -
and hence permissioning is different
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Wed, 11 Oct 2000 22:56:04 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: will perl 5 work w/o server on my PC
Message-Id: <su9s04mqr5774f@corp.supernews.com>
Cameron Dorey (camerond@mail.uca.edu) wrote:
: Craig Berry wrote:
: > ericio (ericio@pd.jaring.my) wrote:
: > : im using WinME...i manage to install the activeperl 5.005
: > : can i ask whether i can develop the CGI using perl without any web server on
: > : my terminal???
: >
: > You have my permission. If anyone challenges you, have them come talk to
: > me.
:
: From Webster's Revised Unabridged Dictionary (1913) :
I *did* go on to answer the question, you may have noticed. It just
struck me as a humorously misdirected question.
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "Quidquid latine dictum sit, altum viditur."
|
------------------------------
Date: Wed, 11 Oct 2000 22:44:21 GMT
From: kurtgg@my-deja.com
Subject: Win32::API & struct (help!)
Message-Id: <8s2qg5$413$1@nnrp1.deja.com>
I need to send a struct to an API call but things do not go as
planned :-) I get a Dr.Watson (Win2000) saying "Perl.exe has generated
errors and will be closed...". Running with the debugger I get "Signal
SEGV:". The error log created mentions 'Perl_pop_scope'.
The C struct is:
typedef struct _GETCDHAND {
BYTE size;
BYTE ver;
BYTE ha;
BYTE tgt;
BYTE lun;
BYTE readType;
BOOL jitterCorr;
BYTE numJitter;
BYTE numOverlap;
} PACKED GETCDHAND, *PGETCDHAND, FAR *LPGETCDHAND;
And the C API function is:
HANDLE GetCDHandle(LPGETCDHAND lpcd);
The Perl code is:
$GetCDHandle = new Win32::API("akrip32.dll", "GetCDHandle", [P], P) or
die "Error defining GetCDHandle: $!\n";
$buf = pack("CCCCCCCC",9,1,0,0,0,0,1,1,3);
$hCD = $GetCDHandle->Call($buf);
Is the pack correct?
Other functions from the dll works but not this one.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 4590
**************************************