[10538] in Perl-Users-Digest
Perl-Users Digest, Issue: 4130 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 2 13:07:09 1998
Date: Mon, 2 Nov 98 10:00:19 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 2 Nov 1998 Volume: 8 Number: 4130
Today's topics:
Re: 0 - 1 toggling question (Bart Lateur)
Re: @a = <FILE> doesn't read in entire file <cstolpe@acm.org>
Re: Can CGI run without anyone "browsing it"? dave@mag-sol.com
Chicago.PM meeting Monday, November 16 (Jim Allenspach)
Help please - Can't tie to DB_File <bruno@prior.ftech.co.uk>
help reqd installing GD (or other) module psmythe@my-dejanews.com
how to write from 2 files to 1 baillie@my-dejanews.com
iMacize ver 1.0 <hajime@andromeda.rutgers.edu>
Re: Netscape equivalent of ASP <jbharvey@corp.home.net>
Re: Not to start a language war but.. <jdporter@min.net>
Re: Not to start a language war but.. <d-edwards@uchicago.edu>
Re: Not to start a language war but.. (Barry A. Warsaw)
Re: Passing $Variables from script to script (John Hardy)
PERL script for auto-mailing a binary file <preble@ipass.net>
Re: perl&cgi question <jbharvey@corp.home.net>
Problem with Mysql <info@edoc.co.za>
Re: Syntactic flexibility (was: Re: psychology of langu <jdporter@min.net>
unknown problem with writing user input to a file! <sernc@mailserv.rz.fh-muenchen.de>
use and require <info@edoc.co.za>
Re: What is the "correct" location of perl under Solari droby@copyright.com
Re: Why is perl better than shell scripting language? <jdporter@min.net>
Writing to MS-Access database problems <gibbensr@pilot.msu.edu>
Re: Writing to MS-Access database problems <Michael_Harp@hp.com>
Re: Writing to MS-Access database problems <perlguy@technologist.com>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 02 Nov 1998 16:01:35 GMT
From: bart.mediamind@ping.be (Bart Lateur)
Subject: Re: 0 - 1 toggling question
Message-Id: <363d8d14.10674234@news.ping.be>
junsc@sysic.hei.co.kr wrote:
>I recently found out that negating a variable that has "1" does change its
>value to null, not "0". How can I easily change its value to "0". the
>operators "!", "not" and "~" all seem to change the value to null.
Here's another way.
$var = $var?0:1;
It has the advantages that it turns ANY true value to "0", as opposed to
$var = 1 - $var;
which, if you start with 2, will endlessly toggle between 2 and -1, BOTH
true, and
$var = $var ^ 1;
which, when starting from 2, will toggle between 2 and 3, idem dito.
BTW:
$var = $var || 0 ;
will leave any true value alone, and will change any false value to "0".
I like that.
Bart.
------------------------------
Date: Sun, 01 Nov 1998 11:14:41 -0500
From: Chris Stolpe <cstolpe@acm.org>
Subject: Re: @a = <FILE> doesn't read in entire file
Message-Id: <363C88F1.14BB4089@acm.org>
It's an NT box and binmode() fixed the problem.
Thanks
Chris Stolpe
Andrew M. Langmead wrote:
> Chris Stolpe <cstolpe@acm.org> writes:
>
> >I have a file with a mix of binary and ascii data. I can see all the
> >lines in notepad but @a = <FILE>; doesn't read the entire file. I also
> >tried read() and sysread() in a loop but I only get the first line.
>
> The reference to "notepad" implies an MS-Windows based system. If that
> is the case, you probably need to use the binmode() fu8nction on the
> filehandle before you read from it. The C runtime libraries of the
> Windows compilers that perl can be built with all return end of file
> when they encounter a control-z character. Notepad apparently does
> not.
>
> --
> Andrew Langmead
------------------------------
Date: Mon, 02 Nov 1998 17:35:40 GMT
From: dave@mag-sol.com
Subject: Re: Can CGI run without anyone "browsing it"?
Message-Id: <71kqhc$47p$1@nnrp1.dejanews.com>
In article <71ii45$cj9$1@merkurius.lu.se>,
"Magnus Nilsson" <kla95mgn@student1.lu.se> wrote:
> Is it possible for a CGI program to, for example, read email from one
> account and send it to another - without constantly being activated by
> someone browsing by?
If it did that, it wouldn't be a CGI.
Dave...
--
dave@mag-sol.com
London Perl M[ou]ngers: <http://london.pm.org/>
[Note Changed URL]
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 2 Nov 1998 11:32:30 -0600
From: jima@MCS.COM (Jim Allenspach)
Subject: Chicago.PM meeting Monday, November 16
Message-Id: <71kqbf$5mc@Venus.mcs.net>
The next meeting of Chicago.PM will be on Monday, November 16th at
7:30 PM, in the meeting room of American Information Systems (161 N. Clark
Street, Suite 1350). Further information on the meeting can be found at the
Chicago.PM Website (http://chicago.pm.org/) or from Jim Allenspach at
jima@mcs.net.
jma
------------------------------
Date: Mon, 2 Nov 1998 17:36:16 -0000
From: "Bruno Prior" <bruno@prior.ftech.co.uk>
Subject: Help please - Can't tie to DB_File
Message-Id: <71krj0$vs5$1@ayers.ftech.net>
I posted the following message a few days ago and have had no reply. Could
someone tell me if that is because I am posting to the wrong group, there is
not enough information, the question is too simple to bother answering,
doesn't make sense, or because no one knows how to answer it.
Cheers,
Bruno Prior bruno@prior.ftech.co.uk
Bruno Prior wrote in message ...
>I have a set of scripts which tie to Berkeley DB files. I recently moved
>them across to a couple of machines. On the first, they work fine, but on
>the second they fail. These two machines have very different hardware (the
>first is a RAIDed dual PPro server, the second is a laptop) but their
>software configuration is very similar. I did a fresh installation of
RedHat
>5.1 on both, then upgraded with all the relevant errata, particularly
>upgrading and rebuilding the kernel to 2.0.35. I have installed
perl5.005.02
>and db-2.4.14 on both, as well as apache, mod_perl and a few perl modules.
>As far as I can see, I have installed the same set of packages on both.
>
>The problem seems to be the format of the DB files. On the laptop, I can
>create new DB files, but I cannot read previously created ones, whereas on
>the server, I can do both. Furthermore, the server cannot read DB files
>created on the laptop. When tie fails on the laptop there is no error
>message (other than "File exists" if I include the O_CREAT tag). When tie
>fails on the server, I get an error message of "Invalid argument".
>
>It seems to me that I must be using different versions of DB (say 1.85 on
>one and 2.x on the other). But as I have installed the same packages, I
>don't see how this could be. /usr/include/db.h and db_185.h are both the
>same version on both machines, and /usr/lib/libdb.a seems identical on
both,
>as far as I can tell.
>
>What am I doing wrong?
>
>Cheers,
>
>
>Bruno Prior bruno@prior.ftech.co.uk
>
------------------------------
Date: Mon, 02 Nov 1998 16:37:07 GMT
From: psmythe@my-dejanews.com
Subject: help reqd installing GD (or other) module
Message-Id: <71kn3j$vm2$1@nnrp1.dejanews.com>
Hi there
Can someone please point me to the FAQ or give advice on how to install the GD
module. Where do I get the module to install it?
There doesn't seem to be much activity in the comp.lang.perl.modules group.
Thanks
Peter
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Mon, 02 Nov 1998 16:15:50 GMT
From: baillie@my-dejanews.com
Subject: how to write from 2 files to 1
Message-Id: <71klrn$u1m$1@nnrp1.dejanews.com>
if I have a file(OLDFILE) with say..8 entries in it and I copy the 4th entry
to a different file(TMPFILE) how can I then
-write the first 3 entries from(OLDFILE) to a new file(NEWFILE)
-write the 4th entry from(TMPFILE) to (NEWFILE)
-write the 5th-8th entries from(OLDFILE) to (NEWFILE)
and then I would rename($newfile, $oldfile).
I'm pretty stumped, here's what I'm trying now, but it's not working..
while(<OLD>) {
print NEW $_ if $_ !~ $choice_array[--$choice];
}
while(<TMP>) {
print NEW $_;
}
while(<OLD>) {
next if $_ +~ $choice_array[--$choice];
print NEW $_;
}
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Mon, 02 Nov 1998 15:40:24 +0000
From: Hajime Hirase <hajime@andromeda.rutgers.edu>
Subject: iMacize ver 1.0
Message-Id: <363DD268.541F8E24@andromeda.rutgers.edu>
#!/usr/bin/perl
# iMacize version 1.00
# iMacize text
# takes standard input and convert the text in an iMac way.
# e.g. I think therefore I am -> iThink therefore iAm
# bug ... quick perl programming, and there maybe some
# occasion that the conversion does not take place.
# (such as double blank line, ... etc)
# (c) Hajime Hirase 1998 (hajime@andromeda.rutgers.edu)
# http://osiris.rutgers.edu/~hajime
# public domain. free to distribute. I will not be
# responsible for any damage/misdone to the computer.
$addi = 0;
while (<>) {
$_ = $addi?"I ".$_:$_;
while (s/(.*)I ([a-z])(.*)/$1i\u$2$3/) {
}
if (/(.*)I([ \t])*$/) {
$addi = 1;
print "$1\n";
} else {
$addi = 0;
print $_;
}
}
------------------------------
Date: Mon, 02 Nov 1998 16:12:28 GMT
From: Justin Harvey <jbharvey@corp.home.net>
Subject: Re: Netscape equivalent of ASP
Message-Id: <363DD9F7.A1EFA22C@corp.home.net>
Forgive my ignorance, ASP?
no-spam wrote:
>
> Is there an equivalent of ASP using PERL (or anything) on Netscape's
> servers?
--
Justin B. Harvey @Home Network
@Work Software Engineer 425 Broadway
jbharvey@corp.home.net Redwood City, CA 94063
Voice: (650) 569-5692 http://www.home.net
------------------------------
Date: Mon, 02 Nov 1998 11:05:25 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Not to start a language war but..
Message-Id: <363DD845.66165EAB@min.net>
William Tanksley wrote:
>
> Unfortunately, Perl code is complex as well.
>
> ML or Prolog are complex languages with simple code. That's a feature. Perl
> is a complex language with complex code, and that's because of missing
> features.
I'm sorry to be so blunt, but -- that's a lie. A raw, bare lie.
Whether you are intentionally prevaricating, or are simply uninformed, I
don't know.
But apart from the fact that such a statement is a gross generalization, to
the point of worthlessness, *much* perl code is not complex. The language
was designed to be a high-level language, wrapping much usefully complex
functionality in the built-in operators (and "engines", like regex).
Sure it's possible to write complex code; but it's not the norm.
I'm just trying to point out that just because some code is inscrutable
doens't mean that code is *complex*.
Now please don't take this as a knock on Python or any other language.
I'm drawing no comparisons here.
> Python is n-bit clean, where n is the size of your data structures. Not
> everything is an array of char, no matter what ANSI (the C standard) says.
Sure, if by "data structures" you mean the native word size on your machine.
"8-bit clean" refers to the (near-universal) adoption of the octet as the
basic unit of addressable data at the machine level. Being "8-bit clean"
means that no values in the range of possible values of an octet (0-255)
are reserved for special purposes (e.g. sentinels) by the language.
I'm sure Python is 8-bit clean. But let's call it that, because that's what
it is.
> > public StringBuffer append (boolean bool) { _extractStringBuffer().append (bool); type = STRING; return string; }
> [plus a mess of almost identical overloadings of the same function,
> differing only in type]
>
> Second, the main reason you put all those functions flat next to each other
> is that they're all the same text, only different data types. Er -- that's
> not needed in Python, even though it is in Perl. All data types are first
> class, including hashes, arrays, and scalars.
It's not needed in Perl either, although for slightly different reason.
The RTTI of the arguments is available for inspection by the called function.
Any user-defined function can be inherently polymorphic, if desired.
Of course, it comes down to some kind of switch on the argument types,
which could look a little ungainly.
John Porter
------------------------------
Date: Mon, 2 Nov 1998 16:08:07 GMT
From: Darrin Edwards <d-edwards@uchicago.edu>
Subject: Re: Not to start a language war but..
Message-Id: <tg7lxeaxi0.fsf@noise.bsd.uchicago.edu>
pj@sgi.com (Paul Jackson) writes:
> I (pj) had written:
> > These 3 symbols look like they bind tightly - high precedence.
> > So $a[0] looks like it binds "($a)([0])"
> >
> > Strange -- very strange.
>
> Darrin Edwards <d-edwards@uchicago.edu> replied:
> > Only if one feels that _all_ operators should behave like, say,
> > mathematical operators (unary minus, for example).
>
> I wasn't expecting '$' to bind so much like a unary minus, as
> like the typical Unix shell '$' -- at least in this context,
> of a language that takes so much from that heritage.
But it also takes a lot from the "C heritage," a bit from "linguistic
theory heritage," and creates a fair amount of purely perl heritage
of its own. Such a varied ancestry (to put it politely :)) is bound
to violate an expectation or two of nearly every learner. That doesn't
necessarily make a _particular feature_ bad, though: something
unexpected to one group of learners will be expected (demanded?) by
another. In my case, I guess some piece of my brain just liked the
"demonstrative pronoun" analogy more quickly than any other piece
could be bothered by possible precedence issues.
Cheers,
Darrin
------------------------------
Date: 02 Nov 1998 11:37:38 -0500
From: bwarsaw@cnri.reston.va.us (Barry A. Warsaw)
Subject: Re: Not to start a language war but..
Message-Id: <61pvb6aw4t.fsf@anthem.cnri.reston.va.us>
>>>>> "RA" == Russ Allbery <rra@stanford.edu> writes:
>> Arguably, there's less to screw up here; you don't check return
>> codes at all. But under the hood, the system does it anyway,
>> and automatically throws exceptions on errors.
RA> There's a problem with this argument. How much information
RA> are you losing by relying on the exception?
Actually Python's exceptions contain a lot of information, and when
using class-based exceptions, can contain just about any information,
as attributes of the thrown instance. By default you get the type of
exception thrown (useful for selective catching), some `detail' about
the exception (maybe a string description of what happened, maybe an
exception instance), and a traceback, which shows you exactly where in
the program's call stack the error occurred.
This is not only useful for interactive use or debugging, but all this
information is accessible to the program as well.
The real advantage of exceptions is that a program can handle the
exception at whatever level it is best able to. Because you usually
don't need to check return values for exceptional conditions, the
function making the call can automatically let the error propagate up
the call stack. Which might be the right thing, because the function
may not be able to handle the exception properly. So it assumes some
other function in an outer frame can handle it. This is a very power
feature and is used all the time in Python.
In the specific case of open(), what gets raised is an IOError
instance (in current versions of Python). This instance contains the
system's error number (e.g. errno), the string equivalent message, and
in Python 1.5.2 it will contain the file name that was attempted to be
opened.
I don't know what more you mean by "conceptual piece of work the
program was attempting to do", but I think the closest you can get in
any language is "where was I in the call stack when this occurred?"
and Python gives you that information for every exception.
The ability to build an exception hierarchy is another useful Python
feature, although fairly new so that not all libraries use it.
For example, IOError is a class derived from StandardError, which in
turn is derived from Exception (all this is defined in the
exceptions.py module). My program of course could derive from IOError
it's own application-specific errors, and raise those. Any code
written to catch IOError will do so, because catching IOError catches
any exception derived from IOError. But if I wanted to catch only my
application specific exception, I'd do that by catching the
most-derived class I'm interested in.
ObPython:
Here's a tiny piece of code for Pythoneers that combine the dynamic
nature of module namespaces, plus the ability to add attributes to
exception instances. It modifies the built-in open() function so that
the file name is available from the exception instance. This models
what Python 1.5.2 will do automatically. I find this extremely useful
for debugging, and use this in Mailman.
realopen = open
def open(filename, mode='r', bufsize=-1, realopen=realopen):
try:
return realopen(filename, mode, bufsize)
except IOError, e:
strerror = e.strerror + ': ' + filename
e.strerror = strerror
e.filename = filename # new attribute
e.args = (e.args[0], strerror)
raise # Python 1.5.1, re-raise
import __builtin__
__builtin__.__dict__['open'] = open # Now all open()s use new def
-Barry
------------------------------
Date: Mon, 02 Nov 1998 17:25:35 GMT
From: jhardy@cins.com (John Hardy)
Subject: Re: Passing $Variables from script to script
Message-Id: <jWl%1.17$jk1.18551@198.235.216.4>
Yeah I realize that but this isn't the solution to my problem anyways.
When I print it to file as print INFO "$key:$value\n"; it prints it to
the file fine, but when I bring it in from the other script as @linesin
and try to seperate it again into $key $value, I realized this
won't work because it simply reads it in as a text string. So if
I print it out in the second script trying to split %linesin it
prints $key and $value as the same thing , the whole line.
###########################PRINTS TO
FILE#######################################
$file = 'VVarin';
open (INFO, ">$file") or die "Can't open $file: $!\n"; ## this routine opens a
file and prints the field and values to the file
while (($key,$value) = each %FORM) { ## for retrieval in the
next script
$key =~ tr/A-Z/a-z/ ; ## Added to convert field names to uppercase
$key=~ s/ /_/g; ## Added _ to in place of space
$key =~ s/last_name/lname/; ##replace fname with first_name
$key =~ s/first_name/fname/;##replace lname with last_name
print INFO "$key:$value\n";
}
close (INFO) or die "can't close $file: $!\n";
#################This is what prints to the file from the first script:
#################
ext:1234
comment:This is a test for the form
telephone:123-456-7891
country:Canada
lname:Lname
province:Prov
address:Saddress
email:jhardy@cins.com
po_box:POBOX
fname:Fname
city:City
citizen_status:N/A
citizen_ship:Canadian
postal_code:K1W 1B5
fax:123-456-7891
####I would like to somehow split these back into $key,
####### $value when I read them back in from the file from the second script.
################READ THE FILE BACK INTO THE SECOND SCRIPT###############
$file = 'VVarin'; # Name the file
open(INFO, $file); # Open the file
@lines = <INFO>; # Read it into an array
close(INFO); # Close the file
%linesin=@lines; # read the array into a hash (foreach below
doesnt seem to work unless I do this)
foreach $key (sort keys(%linesin)) {
($value)=split /:/,$linesin{$key};
$key=join('.',$TableName,$key); ##add the table name to the field name
print "$key\t$value\n";
}
##############Prints this:
ext:1234 comment:This is a test for the form
telephone:123-456-7891 country:Canada lname:Lname province:Prov
address:Saddress email:jhardy@cins.com po_box:POBOX fname:Fname city:City
citizen_status:N/A citizen_ship:Canadian postal_code:K1W 1B5
fax:123-456-7891 Candidate.address:saddress_ Candidate.citizen_ship:canadian
Candidate.city:city Candidate.ext:1234 Candidate.fax:123-456-7891
Candidate.lname:lname Candidate.po_box:pobox Candidate.telephone:123-456-7891
Is there another way to pass variables to the second script from the first??? I
don't mind doing it
by writing to a file because I can use that file in another sub, I just don't
know if it is possible?
Thanks for any Help
John
In article <83pvb6gnol.fsf@vcpc.univie.ac.at>,
Tony.Curtis+usenet@vcpc.univie.ac.at says...
>
>Re: Passing $Variables from script to script, John
><jhardy@cins.com> said:
>
>John> this worked:
>
>John> $file = 'VVarin'; open (INFO, ">$file") or die "Can't
>John> open $file: $!\n"; while (($key,$value) = each %FORM)
>John> { print INFO "$key=$value\n"; } close (INFO) or die
>John> "can't close $file: $!\n";
>
>I assume this is for WWW related activities?
>
>If so, you'll have to do something about file-locking,
>otherwise there'll be race-hazards when multiple accesses
>try to do things concurrently.
>
> perldoc perlfaq
>
>hth,
>tony
>--
>Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
>Liechtensteinstrasse 22, A-1090 Wien, | <URI:http://www.vcpc.univie.ac.at/>
>"You see? You see? Your stupid minds! | private email:
> Stupid! Stupid!" ~ Eros, Plan9 fOS.|
<URI:mailto:tony_curtis32@hotmail.com>
------------------------------
Date: Mon, 02 Nov 1998 16:51:37 GMT
From: "E. Preble" <preble@ipass.net>
Subject: PERL script for auto-mailing a binary file
Message-Id: <tql%1.240$Dm.6965014@news.ipass.net>
I've set up an auto-responder for sending out a file after a request by a
user. Text files work fine, but binaries (*.exe files) come through as
garbled ascii rather than as binary attachments.
I'd rather not uuencode.
I'm currently sending everything using sendmail. I've tried many scripts,
but none seem to work. Can Perl do this?
Thanks
E. Preble
------------------------------
Date: Mon, 02 Nov 1998 16:16:22 GMT
From: Justin Harvey <jbharvey@corp.home.net>
Subject: Re: perl&cgi question
Message-Id: <363DDAE2.A18140AE@corp.home.net>
You need to change the mime association for .pl extension inside your
browsers so that it will use it as a CGI, and not try to download it.
j
Kjetil Svendsberget wrote:
>
> Ive written several perl scripts which build html pages, some with forms
> some without. I have a starting script called login.pl , and i have 2
> machines both setup with IE. v. 4.0 (v.4.72). One of those machines
> insist on dowloading install.pl. (With communicator v 4.05 also) On the
> other one machine it works. (If you wanna look at it take a peek at
> http://www.balder.no/scripts/tmweb/login.pl)
>
> I think it is because that machine has perl installed. I then tried to
> remove the file assosication from windows explorer. Voila it now works
> in communicator, but IE insists still on dowloading the page.
>
> Any idea why it does that?
>
> Kjetil
--
Justin B. Harvey @Home Network
@Work Software Engineer 425 Broadway
jbharvey@corp.home.net Redwood City, CA 94063
Voice: (650) 569-5692 http://www.home.net
------------------------------
Date: Thu, 29 Oct 1998 19:31:10 +0200
From: Nico <info@edoc.co.za>
Subject: Problem with Mysql
Message-Id: <3638A65E.1E13@edoc.co.za>
Hi,
I installed Mysql and Perl and all the modules needed (hopefully!)
I wrote a script (see below). This works fine if I run it from the
commandline (./selector)
If however I run it from http://..../cgi-bin/selector.pl, it doesn't
work.
I get the following error message in httpd.error_log
[Thu Oct 29 19:31:03 1998] [error] Can't locate auto/DBI/connect.al in
@INC (@INC contains: /usr/lib/perl5/i586-linux/5.00404 /usr/lib/perl5
/usr/lib/perl5/site_perl/i586-linux /usr/lib/perl5/site_perl . /usr/
/usr/lib/perl) at /usr/local/httpd/cgi-bin/selector.pl line 15
The file "connect.al" does not exist on my machine (I did a find . -name
"connect.al")
Some more information that might shed some light on the problem:
HTTP/1.1 200 OK Date: Thu, 29 Oct 1998 17:31:03 GMT Server: Apache/1.3.0
(Unix)
S.u.S.E./5.3 mod_perl/1.12 Connection: close Content-Type: text/html
What am I missing?
Thanks
Nico
Script selector.pl
#!/usr/bin/perl
#
use strict;
use CGI;
require DBI;
use DBI; # Line 6
# Print HTML header
print "Content-type: text/html";
print "<body><html>\n";
#Connecting to mysql database
my $dbname = 'DBI:mysql:medpages';
my $dbn = DBI->connect( $dbname,'root', '') || die "can not connect
$DBI::errstr"; #line 15
#Get data from database
my( $code, $region, $category, $phone);
# Prepare the statement for execution
my $sth =$dbn->prepare( "SELECT initials, lastname, pracname,
physad1, physad2, physad3, telephone FROM dokters WHERE
(service='Gynaecologist & Obstetrician') AND (physad3 ='Durban')" );
if ( !defined $sth ) {
die "Cannot prepare statement: $DBI::errstr\n";}
# Execute the statement at the database level
$sth->execute;
# Fetch the rows back from the SELECT statement
while ( my @row = $sth->fetchrow() ) {
print "Row returned: @row<br>";}
#Finished with SQL
# Release the statement handle resources
$sth->finish;
# Disconnect from the database
$dbn->disconnect;
# Close HTML
print "</body></html>\n";
------------------------------
Date: Mon, 02 Nov 1998 11:30:20 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Syntactic flexibility (was: Re: psychology of language choice (was Re: language war ...))
Message-Id: <363DDE1C.C5A8D6E2@min.net>
Maciej Stachowiak wrote:
>
> You certainly can add new syntactic constructs in Scheme or other
> dialects of Lisp. ...
> Neither of these surface syntax aspects can be
> changed, but within those limitations you can add arbitrary syntactic
> constructs.
>
> Here is a trivial example of adding a new conditional syntax. Suppose
> ... I wanted to write ...
> I'd just write a macro like this:
So you can define new functions, and you can write an interpreter for
another language, in Lisp. Big deal. Most modern languages (:-)
support that kind of capability.
But if you think Defining Scheme in One Defun is adding a new syntactic
construct to Lisp, then you're the one smoking crack.
John Porter
------------------------------
Date: Mon, 2 Nov 1998 18:13:14 +0100
From: "Matevz Sernc" <sernc@mailserv.rz.fh-muenchen.de>
Subject: unknown problem with writing user input to a file!
Message-Id: <71kp7v$rld$1@sparcserver.lrz-muenchen.de>
----------- error message after starting "perl -w saveurl.cgi" -----------
In string, @pairs now must be written as \@pairs at saveurl.cgi line 4, near
"})
;
@pairs"
Bareword found where operator expected at saveurl.cgi line 10, near "$value
=~ s
/%([a-fA-F0-9][a-fA-F0-9])/pack("C"
(Missing operator before C?)
syntax error at saveurl.cgi line 10, near "$value =~
s/%([a-fA-F0-9][a-fA-F0-9])
/pack("C"
String found where operator expected at saveurl.cgi line 15, near
"open(TXT,""
(Might be a runaway multi-line "" string starting on line 10)
(Missing semicolon on previous line?)
Execution of saveurl.cgi aborted due to compilation errors.
--------- end of error message ----------
Here is the script:
#!/usr/local/bin/perl
$filename = "/home/euhost/websearch/urls.txt";
$ok = "/home/euhost/websearch/ok.html;
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/~!/ ~!/g;
$FORM{$name} = $value;
}
open(TXT,">>$filename") || die("Can i write a file ? \n\n$!");
print TXT $FORM{'name'} . " ";
close(TXT);
What is wrong here ??
Please help
Thanks a lot
Matevz Sernc
------------------------------
Date: Thu, 29 Oct 1998 19:05:37 +0200
From: Nico <info@edoc.co.za>
Subject: use and require
Message-Id: <3638A061.6222@edoc.co.za>
Hi,
when does one use "use" and when "require"?
Thanks
Nico
------------------------------
Date: Mon, 02 Nov 1998 16:51:09 GMT
From: droby@copyright.com
Subject: Re: What is the "correct" location of perl under Solaris?
Message-Id: <71kntt$ku$1@nnrp1.dejanews.com>
In article <oee3e82ck9g.fsf@alpha.hut.fi>,
Jarkko Hietaniemi <jhi@alpha.hut.fi> wrote:
>
> > The nice thing about standards is that there are so many to choose from
> > :).
>
> You are in a maze of twisty little standards, all alike.
>
You are in a little twisty maze of standards, all different.
That "nice thing about standards" thing is an old quote. Anyone remember who
said it first?
--
Don Roby
droby@copyright.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Mon, 02 Nov 1998 11:55:24 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Why is perl better than shell scripting language?
Message-Id: <363DE3FC.63FA28A@min.net>
Kevin Reid wrote:
>
> John Porter <jdporter@min.net> wrote:
>
> > let me tell you about another language that starts with P.
>
> What language?
Pascal? Prolog? PL/1? PostScript? Pilot?
John Porter
------------------------------
Date: Mon, 02 Nov 1998 11:12:29 -0500
From: Rob G <gibbensr@pilot.msu.edu>
Subject: Writing to MS-Access database problems
Message-Id: <363DD9ED.D9647E0F@pilot.msu.edu>
Hi. I was wondering in anyone has any ideas about this...I'm trying to
write to an MS-Access97 database, and having problems. I'm using Win95,
OmniHttpd, Perl 5.005, and the Win32::ODBC mod. I can easily read any
table in the database, and output the data to the client, but I can't
INSERT anything. My code is below, and as I said, I can read the
database, just not INSERT. It doesn't even print "It worked" unless I
get rid of the INSERT statement. I ran ActiveState's PerlDebugger, and
it came back with the message
'Bareword found where operator expected at line 18 near ") VALUES"
Missing oeprator before VALUES? Syntax error at line 18, near ")
VALUES"'
Any ideas? Any help is greatly appreciated.
Rob-
gibbensr@pilot.msu.edu
use Win32::ODBC;
print "Content-type: text/html\n\n";
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>Search Results</TITLE>\n";
print "</HEAD>\n";
print "<BODY bgcolor=\"white\">\n";
$DSN="rcssolutions";
if (!($db=new Win32::ODBC($DSN))) {
print "Error connecting to $DSN\n";
print "Error: " . Win32::ODBC::Error() . "\n";
} else { # End If !$db
INSERT INTO PhoneCalls (UserName) VALUES ('Tony');
print "It worked\n";
$db->Close();
}
exit;
print "</BODY>\n";
print "</HTML>\n";
------------------------------
Date: Mon, 2 Nov 1998 09:30:58 -0800
From: "Michael Harp" <Michael_Harp@hp.com>
Subject: Re: Writing to MS-Access database problems
Message-Id: <910027866.858349@cs1.sdd.hp.com>
Try this,
$SqlStatement= "INSERT INTO PhoneCalls (UserName) VALUES ('Tony')";
$db->Sql($SqlStatement);
Mike Harp
Rob G wrote in message <363DD9ED.D9647E0F@pilot.msu.edu>...
>Hi. I was wondering in anyone has any ideas about this...I'm trying to
>write to an MS-Access97 database, and having problems. I'm using Win95,
>OmniHttpd, Perl 5.005, and the Win32::ODBC mod. I can easily read any
>table in the database, and output the data to the client, but I can't
>INSERT anything. My code is below, and as I said, I can read the
>database, just not INSERT. It doesn't even print "It worked" unless I
>get rid of the INSERT statement. I ran ActiveState's PerlDebugger, and
>it came back with the message
>'Bareword found where operator expected at line 18 near ") VALUES"
>Missing oeprator before VALUES? Syntax error at line 18, near ")
>VALUES"'
>
------------------------------
Date: Mon, 2 Nov 1998 17:06:49 GMT
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: Writing to MS-Access database problems
Message-Id: <363DE6A9.99A34B5B@technologist.com>
Rob G wrote:
>
> Hi. I was wondering in anyone has any ideas about this...I'm trying to
> write to an MS-Access97 database, and having problems. I'm using Win95,
> OmniHttpd, Perl 5.005, and the Win32::ODBC mod. I can easily read any
> table in the database, and output the data to the client, but I can't
> INSERT anything. My code is below, and as I said, I can read the
> database, just not INSERT. It doesn't even print "It worked" unless I
> get rid of the INSERT statement. I ran ActiveState's PerlDebugger, and
> it came back with the message
> 'Bareword found where operator expected at line 18 near ") VALUES"
> Missing oeprator before VALUES? Syntax error at line 18, near ")
> VALUES"'
>
> Any ideas? Any help is greatly appreciated.
> Rob-
> gibbensr@pilot.msu.edu
...SNIP...
>
> if (!($db=new Win32::ODBC($DSN))) {
> print "Error connecting to $DSN\n";
> print "Error: " . Win32::ODBC::Error() . "\n";
> } else { # End If !$db
>
> INSERT INTO PhoneCalls (UserName) VALUES ('Tony');
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OOPS!
You are getting errors because Perl doesn't understand SQL commands!
Try the following code, it works on my system. You may have to modify
it a bit depending on your system...
$SQL = "INSERT INTO PhoneCalls (UserName) VALUES ('Tony')";
if($db->Sql($SQL)){
print "SQL failed.<BR>\n";
print "Error: " . $db->Error() . "<BR>\n";
$db->Close();
exit;
}
HTH,
Brent
--
Java? I've heard of it, it is what I drink when I am hacking Perl. -me
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$ Brent Michalski $
$ -- Perl Evangelist -- $
$ E-Mail: perlguy@technologist.com $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 4130
**************************************