[9236] in Perl-Users-Digest
Perl-Users Digest, Issue: 2831 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 10 14:07:17 1998
Date: Wed, 10 Jun 98 11:02:03 -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, 10 Jun 1998 Volume: 8 Number: 2831
Today's topics:
Re: print <<EOT; problems <rootbeer@teleport.com>
Re: print <<EOT; problems <Russell_Schulz@locutus.ofB.ORG>
Re: print <<EOT; problems <tchrist@mox.perl.com>
Re: Return characters from a string (Tom Harrington)
Run an batch via perl on NT <fabrice_besson@non-hp-france-om1.om.hp.com>
Re: search problem in cgi script <perlguy@inlink.com>
Re: search problem in cgi script 6xtippet@CyberJunkie.com
Re: search problem in cgi script <rootbeer@teleport.com>
Sorry for seperate posts <htmlmail@htmlplace.com>
Re: Stopping Perl from interpreting fprintf's in a C fi <rootbeer@teleport.com>
stumped! inconsistent results of DB search (D. Pinaula)
Re: stumped! inconsistent results of DB search (Allan M. Due)
Tcl extension perl module on windows 95 <klai@hq.caci.com>
Re: using a variable as a variable name? <aqumsieh@matrox.com>
Re: Where is the robot? <jdporter@min.net>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 10 Jun 1998 16:00:36 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: print <<EOT; problems
Message-Id: <Pine.GSO.3.96.980610085955.29617Y-100000@user2.teleport.com>
On Tue, 9 Jun 1998, Russell Schulz wrote:
> how hard would it be, when this happens, for the interpreter to give
> the helpful hint (not fix it, just add it into the warning) that there
> WAS an indented line with "EOT" in it? (indented or not, maybe.)
I'm not sure. When you've finished the patch, let us know how hard it was
to write. :-) :-) :-)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 10 Jun 1998 12:25:08 +0100
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: Re: print <<EOT; problems
Message-Id: <19980610.122508.7b7.rnr.w164w@locutus.ofB.ORG>
tchrist@mox.perl.com (Tom Christiansen) writes:
>> how hard would it be, when this happens, for the interpreter to give
>> the helpful hint (not fix it, just add it into the warning) that there
>> WAS an indented line with "EOT" in it? (indented or not, maybe.)
>
> Patches are always welcome.
that doesn't actually answer my (non-rhetorical) question.
(and did you REALLY need to CC: me? did you think I was under the
misguided impression that patches were feared?)
--
Russell_Schulz@locutus.ofB.ORG Shad 86c
------------------------------
Date: 10 Jun 1998 17:19:04 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: print <<EOT; problems
Message-Id: <6lmf68$man$2@csnews.cs.colorado.edu>
In comp.lang.perl.misc,
Russell Schulz <Russell_Schulz@locutus.ofB.ORG> writes:
I just was soliciting your patch to "fix" this. Squeaky wheels
and all.
:(and did you REALLY need to CC: me? did you think I was under the
:misguided impression that patches were feared?)
Carbon copies happen. :-)
[Unless I go out of my way to kill them.]
--tom
--
Churchill's Commentary on Man: Man will occasionally stumble over the
truth, but most of the time he will pick himself up and continue on.
------------------------------
Date: 10 Jun 1998 15:42:22 GMT
From: tph@longhorn.uucp (Tom Harrington)
Subject: Re: Return characters from a string
Message-Id: <6lm9gu$3u94@eccws1.dearborn.ford.com>
Zenin (zenin@bawdycaste.org) wrote:
: Mike Baroukh <f024101@fr.ibm.com> wrote:
: : I'd like to return char 1 to 22 of q string. Is there a way to do it without
: : using functions like cut ?
: $string = 'A' x 100;
: $piece = substr $string, 0, 22; # 0 is first char/byte of string
I would have done it this way:
($piece = $string) =~ s/^(.{22}).*/$1/;
...but maybe I'm just weird...
--
Tom Harrington --------- tph@rmii.com -------- http://rainbow.rmii.com/~tph
"Get your facts straight before you try and shove them up
someone elses arse." -Bob Allisat
Cookie's Revenge: ftp://ftp.rmi.net/pub2/tph/cookie/cookies-revenge.sit.hqx
------------------------------
Date: Wed, 10 Jun 1998 18:34:48 +0200
From: fabrice besson <fabrice_besson@non-hp-france-om1.om.hp.com>
Subject: Run an batch via perl on NT
Message-Id: <357EB5A8.331@non-hp-france-om1.om.hp.com>
Hello,
I have a perl script which execute a command from the NT reskit
(robocopy). When I type this command on DOS session, it works fine but
not on my browser. the $! variable return an access denied
x.html ---> y.pl (perl)
y.pl
$cmd = "robocopy c:\temp\ d:\temp";
`$cmd`;
---> $!= access denied
The directory which contains x.html and y.pl
are protected with and account administrator.
The both file are everyone (full control).
Why this command does not run correctly on the browser
Probably a problem of right to execute this command ????
Thanks in advance
Fabrice
------------------------------
Date: Wed, 10 Jun 1998 15:56:41 GMT
From: Brent Michalski <perlguy@inlink.com>
Subject: Re: search problem in cgi script
Message-Id: <357EACB9.58A6ABE9@inlink.com>
Try:
http://www.perl.com/CPAN-local/doc/manual/html/pod/perlre.html
You will find the knowledge you seek there... :-)
HTH,
Brent
------------------------------
Date: Wed, 10 Jun 1998 16:34:50 GMT
From: 6xtippet@CyberJunkie.com
Subject: Re: search problem in cgi script
Message-Id: <357eb5ac.439714105@news.usaor.net>
On 10 Jun 1998 13:33:43 GMT, "bea" <beatrice.pastor@univ-brest.fr>
wrote:
>I'm new in programming CGI scripts in perl and I've a problem with one
>called
>"Internet Phonebook" from http://www.itm.com/cgicollection.
Do your self a favor goto http://www.cpan.org/doc/FAQs/ and read the
FAQs. Then get a good book on Perl such as "Learning Perl" and read
that.
Of course this advice assumes you are a programmer or would like to
be a programmer, if not, hire a programmer.
>
>If you only write one or two characters for the search, your script searchs
>all the words which contain those characters.
>
>I'd like to know what is the syntax for a search only on the beginning of a
>word.
You didn't provide the code so I will take a guess.
Assuming thae the variable $last_name contains the last name:
if( $last_name =~ /^le/ )
{
# The first two characters of $last_name are 'le'
...
}
>Many thanks for your help.
You are welcome if you do as I recommend and read the documentation.
Lee
------------------------------
Date: Wed, 10 Jun 1998 16:30:25 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: search problem in cgi script
Message-Id: <Pine.GSO.3.96.980610092631.29617h-100000@user2.teleport.com>
On 10 Jun 1998, bea wrote:
> I'm new in programming CGI scripts in perl and I've a problem with one
> called
> "Internet Phonebook" from http://www.itm.com/cgicollection.
> I'd like to know what is the syntax for a search only on the beginning
> of a word.
If you're wishing merely to _use_ some program written in Perl (as opposed
to writing or maintaining one) this newsgroup may not be the best
resource. Perhaps you should ask the program's author to provide support
for you. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 10 Jun 1998 13:14:19 -0400
From: "HtmlPlace.Com" <htmlmail@htmlplace.com>
Subject: Sorry for seperate posts
Message-Id: <357EBEEB.2D44@htmlplace.com>
Hello Again,
I have searched all my local book store for "Programming Perl" "The
Camel Book" and "The Llama Book" and nobody in this little side street
town has them or can order them is there a place I can buy them directly
or indirectly through a phone number rather than giving my credit card
number online ?
Sorry for second post,
Mark Jervis
------------------------------
Date: Wed, 10 Jun 1998 16:05:58 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Stopping Perl from interpreting fprintf's in a C file
Message-Id: <Pine.GSO.3.96.980610090348.29617a-100000@user2.teleport.com>
On 9 Jun 1998, Stefaan A Eeckels wrote:
> If you positively *have* to use printf, try
>
> printf(OUTFILE, "%s", $line);
Why would anybody "*have* to use printf"? In every way that I can see,
that action would be better done using print.
...not to mention the correct syntax... :-)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 10 Jun 1998 15:49:27 GMT
From: pinaula@email.unc.edu (D. Pinaula)
Subject: stumped! inconsistent results of DB search
Message-Id: <357fa533.5029206@news.unc.edu>
I'm hoping someone can help explain the odd results I get from a
search of a flat-text file from an HTML form using checkboxes and one
using a textbox.
The script takes the input from the HTML form, searches each line of
the file for a match, then returns any matched lines as results. The
script works as expected for user-supplied keyword searches from a
textbox, but will only return results for the one checkbox, regardless
of how many are checked. I've inserted some extraneous print
statements to check the values of variables at critical steps in the
process, and they return what I expected. Can anyone suggest why the
checkbox search fails?
---BEGIN SCRIPT---
#!/usr/local/bin/perl
$INFILE = 'dbfile.txt';
require "/cgi-bin/cgi-lib.pl";
&ReadParse;
&return_head;
&search;
&return_foot;
sub return_head {
print "Content-type: text/html\n\n";
print "<html>\n";
print "<head>\n";
print "<title>Results of Search</title>\n";
print "</head>\n";
print "<body>\n";
print "<center>\n";
print "<h3>Results of Your Search</h3>\n";
print "</center>\n";
print "Below are the results of your search:<p>\n";
print "<ul>\n";
}
sub search {
@terms = split(/\s+/, $in{'terms'});
unless (open(FILE, "$INFILE")) {
die ("Cannot open input file\n");
}
# This print statement shows that the array holding the search terms
# is the same for both the keyword search and the checkbox search,
# with leading and trailing asterisks to show there's no extra white
# space.
print "This shows that the array holding all the search terms is
clean and accurate:<br>*@terms*<br><hr>\n";
@LINES = <FILE>;
close(FILE);
foreach $term (@terms){
#Same thing here, to verify the scalar holds one term with no extra
# white space.
print "This shows we're searching for a clean and accurate
single search item:<br>*$term*<br><hr>\n";
# And here to verify that in each loop of the foreach the DB file
# is complete and intact.
print "This shows that the array contains the
database:<br>@LINES<br><hr>\n";
print "This shows the results of the search:<br>";
foreach $string (@LINES) {
if ($string =~ /$term/i) {
print "$string\n";
}
}
print "End *$term*";
print "<br><hr>\n";
}
}
sub return_foot {
print "</ul>\n";
print "<hr>\n";
print "Search Terms:\n";
$i = 0;
foreach $term (@terms) {
print "$term";
$i++;
if (!($i == @terms)) {
print ", ";
}
}
print "\n";
print "<hr>\n";
print "</body>\n</html>\n";
}
---END SCRIPT---
That's it! Both searches use the same script, but return different
results. In fact, if I cut and paste the search terms array printed
by the script from the checkbox results to the textbox search, the
search returns a complete result. Any help here would be appreciated.
Dave Pinaula
University of North Carolina at Chapel Hill
------------------------------
Date: 10 Jun 1998 17:38:50 GMT
From: due@murray.fordham.edu (Allan M. Due)
Subject: Re: stumped! inconsistent results of DB search
Message-Id: <6lmgba$2ih$0@206.165.146.195>
In article <357fa533.5029206@news.unc.edu>, D. Pinaula
(pinaula@email.unc.edu) posted...
|I'm hoping someone can help explain the odd results I get from a
|search of a flat-text file from an HTML form using checkboxes and one
|using a textbox.
|
[snip]
|sub search {
|
| @terms = split(/\s+/, $in{'terms'});
|
| unless (open(FILE, "$INFILE")) {
| die ("Cannot open input file\n");
One quick thought. I am guessing that the problem lies in the part of the
script where $in{'terms'} is created. I wonder if there are no spaces
between terms in the checkbox version and therefore your split does not
work. If this were the case for the checkbox version the terms are
probably all read into @terms[0]. One thing to check.
HTH
--
Allan M. Due
Due@Murray.Fordham.edu
The beginning of wisdom is the definitions of terms.
- Socrates
------------------------------
Date: Wed, 10 Jun 1998 17:15:20 GMT
From: "Khuong" <klai@hq.caci.com>
Subject: Tcl extension perl module on windows 95
Message-Id: <01bd9493$41ff5dc0$35120a0a@Khuong.hq.caci.com>
Any one knows where to download Tcl extension perl module for windows 95
Thanks in advance
khuong
------------------------------
Date: Wed, 10 Jun 1998 11:36:19 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: using a variable as a variable name?
Message-Id: <357EA7F3.26A2C15F@matrox.com>
lindali@my-dejanews.com wrote:
> however, i have a feeling that this isn't allowed in Perl
Wrong feelings .. you should consult a doctor! ;-)
> is there some other way this can be done?
Of course (always think TMTOWTDI)... but this is the easiest! why don't you try
it out?
> - linda
>
Check out the perlref manpages!
--
Ala Qumsieh | No .. not just another
ASIC Design Engineer | Perl Hacker!!!!!
Matrox Graphics Inc. |
Montreal, Quebec | (Not yet!)
------------------------------
Date: Wed, 10 Jun 1998 15:59:46 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Where is the robot?
Message-Id: <357EAEF1.3FC5@min.net>
F.Quednau wrote:
>
> If I'd say to you:
> open (THEBOTTLE, "< $with_a_screwdriver"); #!!!
> Would you really do it?
Heh, just because I say
Always, but always check the result of open, like so:
open (THEBOTTLE, "< $with_a_screwdriver")
|| die "error opening $with_a_screwdriver: $!";
Doesn't mean I'm a robot. I'm not!
John Porter
------------------------------
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 2831
**************************************