[12942] in Perl-Users-Digest
Perl-Users Digest, Issue: 352 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 3 17:07:16 1999
Date: Tue, 3 Aug 1999 14:05:16 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 3 Aug 1999 Volume: 9 Number: 352
Today's topics:
Re: command line input <mirwin@voicenet.com>
Re: Creating new files and directories <v0xman@yahoo.com>
Re: Free Programs <alex@kawo2.rwth-aachen.de>
Help making Perl on HP-UX 9.05 (Matthew Cline)
Re: Help Please <sariq@texas.net>
Re: help running Perl Scripts in win95 <aqumsieh@matrox.com>
Re: High demand for Perl programmers? <dwoods@ucalgary.ca>
Re: How can I know what modules are installed on server (Lou Hevly)
Re: How can I know what modules are installed on server <Spam@IsBadForTheInternet.com>
Re: how to check if scalar is blank? <paul.glidden@unisys.com>
How to create "function pointers"? kirk@kaybee.org
Re: How to create "function pointers"? <tchrist@mox.perl.com>
Re: How to create "function pointers"? (Bart Lateur)
How to get across Proxy? <srinivas.gorty@sabre.com>
mySql & Perl -> Something simple (Mike)
Re: Need Help Understanding a perl script <tech1@magicnet.net>
Re: Parsing Natural Language (Damian Conway)
Re: password protected site <admin@futuristic.net>
Re: perl 5 and IRIX 6.3 (Mike Bristow)
Perl and Oracle using DBI <Arvind.Krishnaswamy@altavista.com>
RE: Perl CGI vs VB ASP (DMSbclar)
Re: perl s///e weirdism||bug <alex@kawo2.rwth-aachen.de>
PostingForm input to another frame? hads6307@my-deja.com
Re: PostingForm input to another frame? <tchrist@mox.perl.com>
Printing Form output to another frame hads6307@my-deja.com
Re: Problem reading forms with perl <makarand_kulkarni@my-deja.com>
send perl-users FAQ ("Bill Jones")
send perl-users meta-faq ("Bill Jones")
send perl-users mini-faq ("Bill Jones")
server-side databases <pjw7@ukc.ac.uk>
That was exactly what I needed- THANKS! <Spam@IsBadForTheInternet.com>
Re: using __PACKAGE__ <paul.glidden@unisys.com>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 03 Aug 1999 17:05:14 EDT
From: "Mike Irwin [CTech]" <mirwin@voicenet.com>
Subject: Re: command line input
Message-Id: <VA.000001ca.05f36d8b@mahn.lumberton>
Thanks for the tip on the books. You just answered the question I was
about to post here !
--
Mike Irwin It's not because things are hard that we
[P9.267/8,D9,PP9,VP8,X2] don't dare them; it's because we don't
dare them that they are hard - Seneca.
------------------------------
Date: Tue, 3 Aug 1999 16:14:04 -0300
From: "Vox" <v0xman@yahoo.com>
Subject: Re: Creating new files and directories
Message-Id: <WaHp3.46938$jl.32943770@newscontent-01.sprint.ca>
Philip 'Yes, that's my address' Newton <nospam.newton@gmx.net> wrote in
message news:37A6855D.9E318708@gmx.net...
Tad McClellan wrote:
>
> James Williamson (james.williamson@bbc.co.uk) wrote:
>
> : You'll find that if the file doesn't exist Perl will create one for
> : you.
>
> Now _that_ part is very helpful. Thanks.
>He didn't say what happens whan the file *does* exist -- that it will be
>overwritten. I think that would be useful to know for the person who
>really wanted "+<" or ">>" rather than ">". But R'ing TFM would have
>told him that. (I concede that the subject line talks about "creating
>new files", but still. He should know that he may inadvertently clobber
>existing files if he makes a mistake in the choice of name for his "new
>file".)
>
>Cheers,
>Philip
I tried the code and it worked. I am planning on getting a manual on CGI
programming in perl soon I just haven't got around to going to the bookstore
to pick one up. For now I've been mostly learning from the tutorials on the
net, perl FAQ's and of course this newsgroup. Thanks a lot for all your
help guys.
------------------------------
Date: Tue, 03 Aug 1999 21:37:46 +0200
From: Alex Farber <alex@kawo2.rwth-aachen.de>
To: Programmaholic <programmaholic@hotmail.com>
Subject: Re: Free Programs
Message-Id: <37A7450A.CD808D36@kawo2.rwth-aachen.de>
Hi Manish,
Programmaholic wrote:
> I'm a student and I would like to improve my programming skills. So if
> anybody here needs a Perl Program, I'll be willing to help develop it with
> you, or do the entire thing on my own. Of course this depends on my
> available free time after college.
just an idea: you could catch up on some of the Open Source projects at
http://freshmeat.net or http://visar.csustan.edu/bazaar/bazaar_catoffers.html
Regards
Alex
--
Ich studiere Elektrotechnik (Technische Informatik) an der RWTH Aachen
und bin ein guter Perl-Programmierer (arbeite seit 4 Jahren als Intranet-
Entwickler). Kann auch C, Java, SQL, JavaScript und HTML, CGI und TCP/IP.
Ich suche eine gut bezahlte Diplomstelle in Koeln, Aachen oder Umgebung.
------------------------------
Date: Tue, 03 Aug 1999 20:23:52 GMT
From: mcline@rainbow.com (Matthew Cline)
Subject: Help making Perl on HP-UX 9.05
Message-Id: <37a74e64.2169820536@news.pacbell.net>
I'm trying to compile Perl 5.004_01 on an HP-UX 9.05 system.
'uname -a' gives:
HP-UX polonius A.09.05 A 9000/712 2004597975
configure goes fine until it tries to run makedepnd; it then goes into
an infinite recursion of calling itself, over and over, until it uses
up all of the slots in the process table, and fork() fails.
Unfortunatly, using any Perl other than 5.004_01 is not an option,
although upgrading the HP machine to a higher OS version would be.
However, I'd like to fix the thing with a minimum amount of fuss.
Thanks in advance.
------------------------------
Date: Tue, 03 Aug 1999 13:56:05 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Help Please
Message-Id: <37A73B45.B0BB01BD@texas.net>
I R A Darth Aggie wrote:
>
> On Tue, 03 Aug 1999 11:26:51 -0500, Tom Briles <sariq@texas.net>, in
> <37A7184B.96123E0D@texas.net> wrote:
>
> + _Learning Perl_ by (surprise) Randal L. Schwartz
>
> The newer edition includes another author of the initials 'TC'... :)
>
> James
Doh!
Thanks, I knew that...unfortunately I was looking at the cover of the
1st edition.
So no Mini-FAQs necessary, tom. ;)
- Tom
------------------------------
Date: Tue, 3 Aug 1999 14:33:04 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: help running Perl Scripts in win95
Message-Id: <x3y3dy0emu7.fsf@tigre.matrox.com>
Tom Christiansen <tchrist@mox.perl.com> writes:
> .answers their with questions precede and, summarize and triM
> .work take would it but, harder tried you if annoying more be
> probably could you, know uoY.
Poor Tom. He has been spending too much time with Yoda learning the
ways of the Force.
Be a Jedi knight, you will.
------------------------------
Date: Tue, 03 Aug 1999 13:59:07 -0700
From: Dan Woods <dwoods@ucalgary.ca>
Subject: Re: High demand for Perl programmers?
Message-Id: <7o7hrl$il0@ds2.acs.ucalgary.ca>
> I suspect that people who know how to post job notices
> with the Perl Mongers, or in the appropriate jobs.* newsgroups,
> are more coputer-savvy and less desperate than many people who
> frantically post here.
Where else are Perl contracts/jobs posted or listed to ?
Not everyone has a service provider (like universities) which
subscribe to job.* newsgroups, and so you would never see those
postings.
------------------------------
Date: Tue, 03 Aug 1999 19:56:34 GMT
From: lou@visca.com (Lou Hevly)
Subject: Re: How can I know what modules are installed on server?
Message-Id: <37a748fb.8632423@spamkiller.newsfeeds.com>
"99% Energy" <dnor@hiline.net> wrote:
>How can I tell what modules are installed on a server?
You just have to ask. You don't have access to your server's Perl lib
directories, so there's no way to know.
>How can I replicate
>the library enviroment in my machine so it is the same as on the server so I
>won't run into these type of complications?
How about asking instead: How do I add a directory to my include path
at runtime? (Your include path defines where perl searches for needed
modules). Then your scripts will run both on your machine and the
server's. And hey, it's in perlfaq8! So, expanding a bit on said FAQ:
1) Put the needed modules in a subdirectory somewhere (like
/your/path/cgi-bin/lib).
2) Type, near the top of your script,:
use lib '/your/path/cgi-bin/lib';
For more details, see:
perlmodlib: Pragmatic Modules
--
Lou Hevly (JAPHW)
lou@visca.com
http://www.visca.com
------------------------------
Date: 3 Aug 1999 15:53:06 -0500
From: "99% Energy" <Spam@IsBadForTheInternet.com>
Subject: Re: How can I know what modules are installed on server?
Message-Id: <fEIp3.3575$k8.158356@newscene.newscene.com>
I don't think is such a bad idea to quote the entire article when replying
in newsgroups. A lot of NNTP servers don't get all the messages so its nice
to see what the reply is about when you don't get the whole thread.
I also always put the reply before the quote because its a nuisance to have
to scroll to the bottom, specially in long messages, for both replying and
seeing the message. The quote is mostly for the benefit of those who haven't
seen the whole thread as I explained in the first paragraph.
99%
Abigail <abigail@delanet.com> wrote in message
news:slrn7qd1h8.rb1.abigail@alexandra.delanet.com...
> 99% Energy (Spam@IsBadForTheInternet.com) wrote on MMCLXIII September
> MCMXCIII in <URL:news:iwtp3.856$k8.40426@newscene.newscene.com>:
> == > RTFFAQ.
> ==
> == Which of all, there are so many.
>
> All of them.
>
> And stop putting your reply before the quote. And don't quote the entire
> article, including sig and advertisement. Only quote the part you are
> reacting to.
>
> Otherwise, you look like a brainless moron.
>
>
>
> Abigail
> --
> perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")
> -> define ("foldoc", "perl")) [0] -> print'
>
>
> -----------== Posted via Newsfeeds.Com, Uncensored Usenet News
==----------
> http://www.newsfeeds.com The Largest Usenet Servers in the World!
> ------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers
==-----
------------------------------
Date: Tue, 3 Aug 1999 14:20:04 -0500
From: "Paul Glidden" <paul.glidden@unisys.com>
Subject: Re: how to check if scalar is blank?
Message-Id: <7o7h7e$suq$1@eanews1.unisys.com>
I don't see what the problem is here, assign a value to the scalar at
initialization that it will most likely never have, then test for this
value.
Anno Siegel wrote in message <7o6ft6$9qq$1@lublin.zrz.tu-berlin.de>...
> <psdsp@my-deja.com> wrote in comp.lang.perl.misc:
>>
>>> seems trivial but wondering how to check if a scalar is blank, i.e.
>>> has no value....this is what I have so far...
>>> --8<---
>>> sub is_blank {
>>> local($var) = @_;
>>> if ($var eq "") {
>>> print "$var string is blank\n"; #debug
>>> }
>>> if ($var eq "0") {
>>> print "$var is zero\n"; #debug
>>> }
>>> if (!defined $var) {
>>> print "$! $filename: the variable $var is undefined\n";
>>> }
>>> }
>>>
>>> Does this covers all cases?
>>> -hoz
>>>
>>
>>Pls. refer to camel book page 21 for the rules determining
>>whether a scalar is true.
>>
>>The string "", "0", and undefined values are false.
>>So, you can just write
>
>So far so good.
>
>>if (!$var) {
>> print "$! $filename: the variable is undefined\n";
>>}
>
>Now you're blurring the image, testing for false but claiming
>"undefined" in the print statement.
>
>>Dont use $var in print statement. Anyway it is undefined.
>
>No. It *may* be undefined, but you're forgetting the other
>cases.
>
>>Hope that helps.
>
>Not too much, I'm afraid.
>
>Anno
------------------------------
Date: 3 Aug 1999 19:46:41 GMT
From: kirk@kaybee.org
Subject: How to create "function pointers"?
Message-Id: <7o7gv1$3su$1@news-int.gatech.edu>
I am trying to create a function pointer that I can store as a scalar
and call at a later time. I am trying this with no success:
# Define it
$MyFunction = sub {
print "hello\n";
}
# Call it
$MyFunction ("test");
Also, is there an easy way to store a reference to an exsiting named
(i.e. non-anonymous) function in a scalar?
--
Kirk Bauer -- CmpE, Georgia Tech -- kirk@kaybee.org -- Avid Linux User
GT Sport Parachuting Club! http://cyberbuzz.gatech.edu/skydive
Opinions expressed are my own, but they should be everybody's.
------------------------------
Date: 3 Aug 1999 14:08:34 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How to create "function pointers"?
Message-Id: <37a74c42@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
kirk@kaybee.org writes:
:# Define it
:$MyFunction = sub {
: print "hello\n";
:}
:
:# Call it
:$MyFunction ("test");
You mean to use a narrow there:
$MyFunction->("test");
:Also, is there an easy way to store a reference to an exsiting named
:(i.e. non-anonymous) function in a scalar?
Sure. Whackback its True Name:
$funcptr = \&real_function_name_goes_here;
--tom
--
If I don't document something, it's usually either for a good reason,
or a bad reason. In this case it's a good reason. :-)
--Larry Wall in <1992Jan17.005405.16806@netlabs.com>
------------------------------
Date: Tue, 03 Aug 1999 20:07:03 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: How to create "function pointers"?
Message-Id: <37a74ad5.397327@news.skynet.be>
kirk@kaybee.org wrote:
>I am trying to create a function pointer that I can store as a scalar
>and call at a later time. I am trying this with no success:
>
># Define it
>$MyFunction = sub {
> print "hello\n";
>}
OK...
># Call it
>$MyFunction ("test");
No. $MyFunction is a reference, so you need to dereference it. The two
standard ways of doing that, work.
&{$MyFunction}("test");
or
$MyFunction->("test");
>Also, is there an easy way to store a reference to an exsiting named
>(i.e. non-anonymous) function in a scalar?
Yes. You can get a function reference by prepending the sub's name with
"\&", and no parentheses.
sub test {
print "It works!\n";
}
$MyFunction = \&test;
print "Now call it...\n";
$MyFunction->();
print "And again...\n";
&{$MyFunction}();
Bart.
------------------------------
Date: Tue, 03 Aug 1999 12:04:05 -0500
From: Srinivas Gorty <srinivas.gorty@sabre.com>
Subject: How to get across Proxy?
Message-Id: <37A72105.585D0DDA@sabre.com>
Hi,
I am using libwww-perl module to connect to a site and retrieve a page.
I cannot get past our proxy server. Can someone tell me how to send
authentication information to the proxy? I am using the
libwww::UserAgent to set up the proxy information. But, it does not have
an entry for the user name and password.
TIA
Srini
------------------------------
Date: Tue, 03 Aug 1999 19:20:58 GMT
From: mgcon@neta.com (Mike)
Subject: mySql & Perl -> Something simple
Message-Id: <8E177D3BCmstarkeudsmoblcom@news.syspac.com>
With the help of some folks on this group a while back I was able to begin
putting some cgi scripts together. Now I am stuck again.
The script below works just fine (i.e runs without errors), however, it
doesn't return any values. This problem surely has some simple resolution
to it, I just can't see it.
Can someone throw me a bone or two?!
TIA
Mike
---------------------------------------------------
#!/usr/bin/perl -w
#---Define what is required---
use DBI;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
#---Define Variables which require no input---
$query = new CGI;
$myHost = "localhost";
$port = "3306";
$drivername = "mysql";
$myDb = "inventory";
$myUser = "username";
$myPasswd = "password";
my $myFont = "<font color=\"#880000\">";
my $logo = "<img src=/~mstarke/art/meg.jpg border=0>";
$codeQuery = $query->param("codeQuery");
$dsn = "dbi:$drivername:database=$myDb;host=$myHost;port=$port";
$dbh = DBI->connect($dsn, $myUser, $myPasswd);
$statement = "SELECT Part_Number, Description, Price \
from master \
where code = $codeQuery";
$sth = $dbh->prepare($statement);
$sth->execute;
print "Content-type: text/html\n\n";
sub printMe{
print<<HTML;
<html>
<body bgcolor="#ffffff">
<center>
$logo
</center>
<hr color="#880000">
<p>
The following $myFont $codeQuery</font> parts are listed below.
<hr>
HTML
my $names = $query->param();
print "<center><table border=1>\n";
print "<tr bgcolor=000066>";
foreach my $name (@$names)
{
print "<th align=center><font color=\"cccccc\">$name</font></th>";
}
print "</tr>\n";
my ($col, $gotdata);
while (my @data = $sth->fetchrow_array)
{
print "<tr>";
foreach $col (@data)
{
print "<td align=left>$col</td>";
}
print "</td>\n";
}
print "</table>\n";
print "</body>\n";
print "</html>";
}
$dbh->disconnect;
&printMe
#eof
------------------------------
Date: Tue, 3 Aug 1999 15:29:14 -0400
From: "Diane" <tech1@magicnet.net>
Subject: Re: Need Help Understanding a perl script
Message-Id: <rqegvaoar4fcq6@corp.supernews.com>
> I would very much like to see that script. Can you post a copy ?
>
> Assuming it's well written, it shouldn't be too long :-)
>
>
> Michel.
Excellent! Here is the script. I understand the Print commands, and all the
HTML outputs, what Id like some explanation on are the loops and variables
and all the other lines that are not obvious...including how it sets up and
loads the array of values..
Thanks so much
#!/perl/bin/perl.exe
#!/usr/bin/perl
# Order the lines above so that the first gives the location
# of Perl on your system. The rest become comments.
#simple Perl script to print CGI inputs
print "Content-type: text/html\n\n";
print "<HEAD>\n";
print "<TITLE>Show CGI Inputs</TITLE>\n";
print "</HEAD>";
print "<BODY>";
print "<h1>Show CGI Inputs:</h1><hr>\n";
print "<h2>Command Line Arguments:</h2>\n";
$j=1;
foreach $a (@ARGV) {
print "arg$j: $a<BR>\n";
$j=$j+1;
}
print "<HR>";
print "<h2>Environment Variables:</h2>\n";
print "SERVER_SOFTWARE = $ENV{'SERVER_SOFTWARE'}<BR>\n";
print "SERVER_NAME = $ENV{'SERVER_NAME'}<BR>\n";
print "GATEWAY_INTERFACE = $ENV{'GATEWAY_INTERFACE'} <BR>\n";
print "SERVER_PROTOCOL = $ENV{'SERVER_PROTOCOL'}<BR>\n";
print "SERVER_PORT = $ENV{'SERVER_PORT'}<BR>\n";
print "REQUEST_METHOD = $ENV{'REQUEST_METHOD'}<BR>\n";
print "HTTP_ACCEPT = $ENV{'HTTP_ACCEPT'}<BR>\n";
print "PATH_INFO = $ENV{'PATH_INFO'}<BR>\n";
print "PATH_TRANSLATED = $ENV{'PATH_TRANSLATED'}<BR>\n";
print "SCRIPT_NAME = $ENV{'SCRIPT_NAME'}<BR>\n";
print "QUERY_STRING = $ENV{'QUERY_STRING'}<BR>\n";
print "REMOTE_HOST = $ENV{'REMOTE_HOST'}<BR>\n";
print "REMOTE_ADDR = $ENV{'REMOTE_ADDR'}<BR>\n";
print "REMOTE_USER = $ENV{'REMOTE_USER'}<BR>\n";
print "CONTENT_TYPE = $ENV{'CONTENT_TYPE'}<BR>\n";
print "CONTENT_LENGTH = $ENV{'CONTENT_LENGTH'}<BR>\n";
print "HTTP_REFERER = $ENV{'HTTP_REFERER'}<BR>\n";
print "HTTP_USER_AGENT = $ENV{'HTTP_USER_AGENT'}<BR>\n";
print "HTTP_COOKIE = $ENV{'HTTP_COOKIE'}<BR>\n";
print "<hr>\n";
print "<h2>Standard Input:</h2>\n";
#get buffer from QUERY_STRING (GET) or STDIN (POST)
if ($ENV{'REQUEST_METHOD'} eq "GET") {
$buffer = $ENV{'QUERY_STRING'};
print "There is no input in STDIN";
print " when using GET method.<BR>\n";
} else
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
print "$buffer\n";
}
print "<hr>";
print "<h2>Name/Value pairs extracted</h2>\n";
#check for equal signs in buffer
$e = index($buffer,"=");
if ( $e == -1 ) {
print "no name/value pairs in input\n";
} else {
#make an array of pairs split at the & sign
@nvpairs = split(/&/, $buffer);
#for each pair, extract name and value
foreach $pair (@nvpairs)
#split into name and value
($name, $value) = split(/=/, $pair);
#print name/value pair
print "$name = $value<BR>\n";
}
}
print "<hr>";
print "<h2>Name/Value pairs decoded</h2>\n";
if ( $e != -1 ) {
foreach $pair (@nvpairs)
#convert plusses to spaces
$pair =~ s/\+/ /g;
#split into name and value
($name, $value) = split(/=/, $pair);
#decode any %XX from hex numbers to alphanumeric
$name =~ s/%(..)/pack("c",hex($1))/ge;
$value =~ s/%(..)/pack("c",hex($1))/ge;
#print name/value pair and decoded value
print "$name = $value<BR>\n";
}
}
print "</BODY><HTML>\n";
------------------------------
Date: 3 Aug 1999 20:30:24 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: Parsing Natural Language
Message-Id: <7o7jh0$vi$1@towncrier.cc.monash.edu.au>
bayinnaung@my-deja.com writes:
>Anybody ever use the perl regular expression engine to
>parse natural language texts (linguistically that is).
There's a demo of (very simple) NL parsing included with
the Parse::RecDescent module: demo_whoson.pl
Here's another, taken from my Perl Conference tutorial on parsing:
-----------cut-----------cut-----------cut-----------cut-----------cut----------
#! /usr/local/bin/perl -w
my $grammar = q{
translate: select
| sum
| identify
| { "Could you rephase that?\n" }
select : ask qualifier(?) field /of/ qualifier(?) table
{ "SELECT DISTINCT $item[3]\nFROM $item[6]\n" }
| ask qualifier(?) table /'?/ qualifier(?) field
{ "SELECT DISTINCT $item[6]\nFROM $item[3]\n" }
| ask qualifier(?) table
{ "SELECT *\nFROM $item[3]\n" }
sum : ask_count table prep qualifier field prep(?) value
{ "SELECT COUNT(*)\nFROM $item[2]\n" .
"WHERE $item[5] = $item[7]\n" }
| ask_count table
{ "SELECT COUNT(*)\nFROM $item[2]\n" }
identify : ask(?) /who supplies/ qualifier value
{ "SELECT supplier\nFROM merchandise\n" .
"WHERE name = $item[4]\n" }
| whats qualifier field prep qualifier /suppliers? of/ value
{ "SELECT suppliers.$item[3]\n" .
"FROM suppliers, products\n" .
"WHERE products.name = $item[-1]\n" .
"AND suppliers.name = products.supplier \n" }
field : /(name)s?/ { $1 }
| /(product)s?/ { $1 }
| /(id)(entit(y|ies))?/ { $1 }
| /(quantit(y|ies))/ { $1 }
| /(received)s?/ { $1 }
| /(supplier)s?/ { $1 }
| /(cost)s?/ { $1 }
| /(address)(es)?/ { $1 }
table : /suppliers?/ { 'suppliers' }
| 'merchandise'
| /orders?/ { 'orders' }
qualifier: /the|every|all( the)?|any|our/
ask : reply to_me
ask_count: ask(?) /how (many|much)/
reply : /tell|show|list/
value : /\w+/ { qq{'$item[1]'} }
to_me : /((to )?(me|us))?/
whats : /what's|what're|what (is|are)/
prep : /for|of|with|by/
};
use Parse::RecDescent;
my $parser = Parse::RecDescent->new($grammar)
or die "Bad grammar";
$| = 1;
while (<DATA>)
{
print "> ";
sleep 1;
print;
my $SQL = $parser->translate($_);
print $SQL, "\n";
}
__DATA__
how many orders for the product spam are there?
tell me how many suppliers by the name of Jones we have
what are the names of our suppliers of trinitrotoluene?
tell me our suppliers' names
list our merchandise
show us the suppliers of the mechanise
list all supplier names
how many orders are there?
how much merchandise do we carry?
who supplies our nitrocelluose?
tell me who supplies our ethylacetate?
what are the addresses of our suppliers of trinitrotoluene?
-----------cut-----------cut-----------cut-----------cut-----------cut----------
Damian
------------------------------
Date: Tue, 3 Aug 1999 15:15:10 -0400
From: "James A Culp III" <admin@futuristic.net>
Subject: Re: password protected site
Message-Id: <7o7fgq$5hr$1@ffx2nh3.news.uu.net>
Fulko van Westrenen <fulko@trane.wtm.tudelft.nl> wrote in message
news:slrn7qef09.d1.fulko@trane.wtm.tudelft.nl...
>
> Hello,
>
> I would like to make a password protected page with perl:
> after you enter a user/password you can update a database.
> I have some ideas about how this should be done but is
> the some documentation on this subject?
>
> Thanks,
> Fulko
>
> --
> Fulko van Westrenen
> email: F.C.v.Westrenen@tue.nl
Your best bet might be to consider password protected directories on your
webserver. If this is an option it would most likely be considerably easier
to implement, and probably more efficient.
I recently had the need to do similar database manipulation via the web and
found it considerably easier to password protect a separate directory in my
cgi-bin and set up a normal database manipulating cgi in that directory.
Then if a user tries to utilize the cgi he/she/it is prompted for a username
and password first.
If your website is hosted on an Apache webserver and you are the admin you
might do a search in the documentation or at http://www.apache.org/ for the
keyword "htaccess" and "AuthConfig".
I am not sure where you would look for Windows(95, 98, NT) based servers,
however the "help" file for these might mention something about it under
security.
Hope this helps and isn't too "off-topic" an answer,
James A Culp III
admin@futuristic.net
http://www.futuristic.net/ for inexpensive web, domain, and e-mail hosting.
------------------------------
Date: Tue, 03 Aug 1999 19:07:22 GMT
From: mike@fat.dotat.at (Mike Bristow)
Subject: Re: perl 5 and IRIX 6.3
Message-Id: <slrn7qeffa.l42.mike@lindt.fat.dotat.at>
On 03 Aug 1999 18:11:04 GMT, CVanor1018 <cvanor1018@aol.com> wrote:
> Does anyone know how to install the compiled version of Perl 5 onto
> the IRIX 6.3 system without a C Compiler? We have the binaray files
> but are stuff. Any help is much appreciated. Our Tech support guy
> is failing us.
This boils down to getting a C compiler for IRIX (or a precompiled
perl binary, but I think you'll probably want a C compiler for other
reasons too).
Get GCC. Use yahoo or similar to search for GCC and IRIX and
precompiled.
--
Mike Bristow, Geek-At-Large. GK/RT0038
one tequila - two tequila - three tequila - FLOOR !!!
------------------------------
Date: Tue, 03 Aug 1999 13:10:03 -0700
From: Arvind Krishnaswamy <Arvind.Krishnaswamy@altavista.com>
Subject: Perl and Oracle using DBI
Message-Id: <37A74C9B.4510611@altavista.com>
I am trying to set up my system to access an Oracle 8 database from
Perl. I have installed the DBI module (version 1.13) and the DBD-Oracle
module (version 1.03) retreived from
CPAN. My environment seems to be set up correctly in that I can access
the database by typing "sqlplus user/pwd" from the command line. But my
test program always fails on
the "connect" statement:
use DBI;
DBI->connect('DBI:Oracle:XYY, 'user', 'pwd');
where XYZ is the database name, user is the userid and pwd is the
password. The error is:
install_driver(Oracle) failed: Can't load '..../Oracle/Oracle.so' for
module DBD::Oracle: dlopen: cannot load
'..../Oracle/Oracle.so' at '...../Dynaloader.pm line 168.
The pertinent Oracle environment variables set are:
ORACLE_SID
ORACLE_HOME
ORACLE_USERID
Any help would be appreciated.
------------------------------
Date: 03 Aug 1999 19:54:04 GMT
From: dmsbclar@aol.comnospam (DMSbclar)
Subject: RE: Perl CGI vs VB ASP
Message-Id: <19990803155404.09214.00000632@ng-fi1.aol.com>
I am about to embark on a project where I need to read input from a flat file
on a unix box. I know VBScript for ASP, but that's not going to help. From my
experience, VB is easy to follow (read, easy to hack out). I'm also a Unix
guy, so I don't think Perl will be that difficult to learn. I can awk with the
best of them. Unfortunately those toys are not native to the Wintel Oligopoly.
------------------------------
Date: Tue, 03 Aug 1999 21:16:35 +0200
From: Alex Farber <alex@kawo2.rwth-aachen.de>
To: Andrew Cannon <acannon@sr.hp.com>
Subject: Re: perl s///e weirdism||bug
Message-Id: <37A74013.80251BFA@kawo2.rwth-aachen.de>
Andrew Cannon wrote:
> test.C contains the following:
> test=1;
> }
>
> execute on the command line the following:
> perl -pi -e 's/(test=)(\d+);.*$/print $1.($2+1).";"/e' test.C
>
> test.C now contains
> test=2;1
> }
I think, what you are doing is actually
print print "test=".(1+1).";"
Though perldoc perlrun on the -p switch looks still strange to me...
Regards
Alex
--
Ich studiere Elektrotechnik (Technische Informatik) an der RWTH Aachen
und bin ein guter Perl-Programmierer (arbeite seit 4 Jahren als Intranet-
Entwickler). Kann auch C, Java, SQL, JavaScript und HTML, CGI und TCP/IP.
Ich suche eine gut bezahlte Diplomstelle in Koeln, Aachen oder Umgebung.
------------------------------
Date: Tue, 03 Aug 1999 19:47:33 GMT
From: hads6307@my-deja.com
Subject: PostingForm input to another frame?
Message-Id: <7o7h0g$vp$1@nnrp1.deja.com>
Hi-
I was wondering if anyone could help me figure out how to post form
input from one frame and display it in a second frame using the
framework perl script below. Basically, it is a text box with a submit
button that submits the text entered to the cgi script which then
formats it and prints it out the the second frame which is initially
blank. Thanks in advance for any help.
Mike
#!/usr/bin/perl
# load CGI library
use CGI qw(:standard);
#Create header
#Capture form input and save into scalar variable
if ( $method eq 'POST' )
{
print "HI THERE";
read(STDIN, $_, $ENV{'CONTENT_LENGTH'});
}
# set condition so that if input is not equal to "" print "You are
thinking <input>"
#else print out ""
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 3 Aug 1999 14:12:22 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: PostingForm input to another frame?
Message-Id: <37a74d26@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
hads6307@my-deja.com writes:
:use CGI qw(:standard);
Good.
:if ( $method eq 'POST' )
: {
: print "HI THERE";
: read(STDIN, $_, $ENV{'CONTENT_LENGTH'});
Bad x 2. You need to Read The Fine Manpage for the CGI.pm
module you're using. It does that for you already, and
much better than that.
: }
Where did you reseach this question before posting? I
ask this so we know what your background is. Also, did
the CGI newsgroup prove unhelpful? What brings you our
way? I see no Perl issues there.
--tom
--
"Difficult answers lead to intelligent questions."
------------------------------
Date: Tue, 03 Aug 1999 19:41:05 GMT
From: hads6307@my-deja.com
Subject: Printing Form output to another frame
Message-Id: <7o7gke$k0$1@nnrp1.deja.com>
Hello-
I have a question and would appreciate some help
on the use of a CGI script written in perl to
take a simple input from a left frame form submit
and have that input print out to the right frame.
I have posted the framework for this down below.
If anyone can help me with the script I would
greatly appreciate it!
Mike
#!/usr/bin/perl
# load CGI library
use CGI qw(:standard);
#Create header
#Capture form input and save into scalar variable
if ( $method eq 'POST' )
{
print "HI THERE";
read(STDIN, $_, $ENV{'CONTENT_LENGTH'});
}
# set condition so that if input is not equal to
"" print "You are thinking <input>"
#else print out ""
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Tue, 03 Aug 1999 20:29:31 GMT
From: Makarand Kulkarni <makarand_kulkarni@my-deja.com>
Subject: Re: Problem reading forms with perl
Message-Id: <7o7jet$2r4$1@nnrp1.deja.com>
> By what? Last time I tried this I got everything that was entered in
the --
You are right. The tags are in fact intact. I confirmed this
by writing out the values to a text file. I had
jumped to wrong conclusions. Thanks for correcting me.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Tue, 03 Aug 1999 14:26:04 -0400
From: bill@fccj.org ("Bill Jones")
Subject: send perl-users FAQ
Message-Id: <199908031821.OAA00308@astro.fccj.cc.fl.us>
send perl-users FAQ
------------------------------
Date: Tue, 03 Aug 1999 14:25:22 -0400
From: bill@fccj.org ("Bill Jones")
Subject: send perl-users meta-faq
Message-Id: <199908031821.OAA00305@astro.fccj.cc.fl.us>
send perl-users meta-faq
------------------------------
Date: Tue, 03 Aug 1999 14:26:41 -0400
From: bill@fccj.org ("Bill Jones")
Subject: send perl-users mini-faq
Message-Id: <199908031822.OAA00339@astro.fccj.cc.fl.us>
send perl-users mini-faq
------------------------------
Date: Tue, 03 Aug 1999 21:46:45 +0100
From: Peter <pjw7@ukc.ac.uk>
Subject: server-side databases
Message-Id: <37A75535.3F47@ukc.ac.uk>
If I want to build a server-side database for interaction with web pages
what would be the best option?
Construct the database in Perl?
or
Construct the database in another language (I'm more familiar with Java
) and use Perl as a front end when making queries?
Any pointers to web sites that would help me with this subject would be
greatly appreciated.
Thanks
Peter
------------------------------
Date: 3 Aug 1999 14:48:05 -0500
From: "99% Energy" <Spam@IsBadForTheInternet.com>
Subject: That was exactly what I needed- THANKS!
Message-Id: <gHHp3.3380$k8.152047@newscene.newscene.com>
With your niftly little program I was able to see all the library modules
instaled in my server. This way I saved server space and runtime by not
loading extra modules. I only had to change the shebang line.
99%
Ray Cadmus <rcadmus@amctheatres.com> wrote in message
news:37A6EC16.6C997AE4@amctheatres.com...
> "99% Energy" wrote:
>
> > How can I tell what modules are installed on a server? How can I
replicate
> > the library enviroment in my machine so it is the same as on the server
so I
> > won't run into these type of complications?
>
> I found this somewhere (probably on this newsgroup). Sorry, I don't have
the
> author's name.
> Anyway, if the server has a couple basics this will dump the environment
via
> your browser.
>
> #!/perl/bin/perl -w
>
> use lib '.';
>
> use CGI;
> use File::Find;
> use strict;
>
> my $page = CGI->new;
>
> print $page->header, "\n";
> print $page->start_html(-dtd=>'-//W3C//DTD HTML 4.0 Transitional//EN',
> -title=>"Perl Environment: $ENV{SERVER_NAME}"),
"\n";
>
> print $page->h1("Perl Environment: $ENV{SERVER_NAME}"), "\n";
> print $page->p("Perl Version: $]"), "\n";
> print $page->p("CGI.pm Version: $CGI::VERSION"), "\n";
> print $page->p("Library Path (\@INC):"), "\n";
> print $page->ul($page->li([@INC])), "\n";
> print $page->p('Modules:'), "\n";
>
> my @mods;
> my $list;
> my $dir;
> foreach $_ (@INC)
> {
> @mods = ();
> $dir = $_;
> find(\&wanted, $_);
>
> $list .= $page->ul($page->li("$dir"),
> $page->ul($page->li([sort @mods])));
> }
>
> print $list, "\n";
>
> sub wanted
> {
> return unless /\.pm$/;
> push @mods, $File::Find::name;
> }
>
>
------------------------------
Date: Tue, 3 Aug 1999 15:20:59 -0500
From: "Paul Glidden" <paul.glidden@unisys.com>
Subject: Re: using __PACKAGE__
Message-Id: <7o7ivc$1ll$1@eanews1.unisys.com>
I think the actual problem here results from people who's minds aren't open
to new programming constructs.
Coming from a c++ background, many of perl's constructs seemed
counterintuitive while reading the documentation.
So, I bought a book
Programming Perl 2nd edition. Of which Tom was one of the authors.
In no way can these constructs be better explained, then if one is open
minded, the simplicity of such becomes apparent.
Closed mindedness is no excuse for discussing the constructs of a
programming language.
This thread should just be over with.
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
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 V9 Issue 352
*************************************