[17296] in Perl-Users-Digest
Perl-Users Digest, Issue: 4718 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 25 03:05:26 2000
Date: Wed, 25 Oct 2000 00:05:09 -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: <972457508-v9-i4718@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 25 Oct 2000 Volume: 9 Number: 4718
Today's topics:
Re: A Simpler perlish way <lr@hpl.hp.com>
Re: duplicated output while using open2 <elephant@squirrelgroup.com>
Re: Email.pm and file attachments (Gwyn Judd)
First CGI script <jshaieb@wcg.net>
Re: First CGI script <elephant@squirrelgroup.com>
Re: First CGI script <jeff@vpservices.com>
Re: Help!!! (Gwyn Judd)
Re: Help!!! <Jonathan.L.Ericson@jpl.nasa.gov>
Re: How to pass a String to the STDIN of an other prg? <ianb@ot.com.au>
Re: IO::Select problem (Logan Shaw)
Re: Length of a string stored in a scalar <lr@hpl.hp.com>
Re: local binmode? (Martien Verbruggen)
Re: LWP???? (Gwyn Judd)
Re: Make me a hot or not script <peter.sundstrom@eds.com>
Re: On being Schwartz.. (was Re: newbie cgi examples) <nospam.newton@gmx.li>
Re: Perl & mySql <yizhe@freevote.com>
Re: Perl outputs to dos instead of ie5 browser (Duke Normandin)
Perl Program Problem (Noghri)
Re: Perl Program Problem <elephant@squirrelgroup.com>
Re: sorting multidimensional arrays (Bernard El-Hagin)
Re: Submit buttons <glodalec@yahoo.com>
Re: Submit buttons <elephant@squirrelgroup.com>
Re: why core dump ? -> solution ! <ronr@my-deja.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 24 Oct 2000 23:39:00 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: A Simpler perlish way
Message-Id: <MPG.14601fd7c7d01e1998ae6c@nntp.hpl.hp.com>
In article <WypJ5.5141$MR3.274646@bgtnsc04-news.ops.worldnet.att.net>,
MBalenger@worldnet.att.net says...
> > > "$yday is the day of the year, in the range `1..365' (or `1..366' in
> > > leap years.)"
> > > Unfortunately, it is also incorrect.
> >
> > Before posting a similar response, I downloaded the latest 5.6.0 version
> > (build 618) from ActiveState, and found that the error has already been
> > corrected.
>
> I'm assuming that the documentation was changed to reflect the code, not
> vice versa. Right?
You could answer that by testing it. Try, for example, gmtime(0).
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 25 Oct 2000 15:22:21 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: duplicated output while using open2
Message-Id: <MPG.1461191a20e68b1989849@localhost>
Nils =?iso-8859-1?Q?Sch=E4le?= wrote ..
>i am writing on a cgi script to send plain text mails via sendmail.
>originally i opened a simple pipe to sendmail and worte the data in.
>thats works fine up to sendmail runs into an error an writes a message
>on it stdout, which destroys my http-header. to fix that proplem i now
>use open2 to write in and reads the error messages out of sendmail. but
>now i have a different problem. when i call open2 everything what i
>wrote on stdout is wirtten a second time on stdut and i have no idea
>why. the scipt is the follwoing:
to start with .. you should just open a pipe to
sendmail -options > /dev/null
which will redirect the output from sendmail away from STDOUT without
interfering with your headers
but regarding your specific issue .. I'm sorry - but I don't really know
- it doesn't happen in 5.6.0 on NT4
I imagine that there's a fork being done with the pipe() call that's
causing the code to be run twice .. try sticking $$ into your output
somewhere and you should see different PIDs
how to solve it ? .. no idea .. maybe just use the > /dev/null option
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Wed, 25 Oct 2000 04:55:35 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Email.pm and file attachments
Message-Id: <slrn8vcpu5.me9.tjla@thislove.dyndns.org>
I was shocked! How could ruben@llinderman.dental.nyu.edu <ruben@llinderman.dental.nyu.edu>
say such a terrible thing:
>I've used Mimelite to solve this problem.
There's no context but, you mean 'MIME::Lite' right?
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Only those who leisurely approach that which the masses are busy about
can be busy about that which the masses take leisurely.
-- Lao Tsu
------------------------------
Date: Wed, 25 Oct 2000 04:34:41 GMT
From: Johnny Shaieb <jshaieb@wcg.net>
Subject: First CGI script
Message-Id: <Pine.SOL.3.96.1001024232414.15535A-100000@mail>
Below are 2 files name.html and hello.pl. Also, I have listed the output
from command line.
My question is that name.pl works fine from command line, but when I
engage this script from a browser is print will print the actually code
instead of the html.
root@ops:/NetMaint/network-applications/netapps/cgi-docs $ cat name.html
<HTML>
<HEAD>
<TITLE>Tell Me Your Name</TITLE>
</HEAD>
<BODY>
<FORM ACTION="/network-applications/netapps/cgi-docs/hello.pl">
<P>Enter your Name: <INPUT NAME="name">
<P><INPUT TYPE="SUBMIT" VALUE="Submit">
</FORM>
</BODY>
</HTML>
root@ops:/NetMaint/network-applications/netapps/cgi-docs $ cat hello.pl
#!/usr/bin/perl -w
use strict;
use CGI qw(:standard);
print header;
print start_html('Hello!');
print "<H1>Hello, ", param('name'), "!</H1>\n";
print end_html;
root@ops:/NetMaint/network-applications/netapps/cgi-docs $ hello.pl name=Johnny
Content-Type: text/html
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML><HEAD><TITLE>Hello!</TITLE>
</HEAD><BODY><H1>Hello, Johnny!</H1>
***However it does not work from a browser**********
#The actually code is returned. I have 755 permissions. What is the CGI
piece that I am missing??
root@ops:/NetMaint/network-applications/netapps/cgi-docs $ ls -lrt
total 16
-rwxr-xr-x 1 nobody nobody 230 Oct 23 22:55 name.html
-rwxr-xr-x 1 nobody nobody 161 Oct 23 22:57 hello.pl
#THE WEBBROWSER OUTPUT
#!/usr/bin/perl -w
use strict;
use CGI qw(:standard);
print header;
print start_html('Hello!');
print "<H1>Hello, ", param('name'), "!</H1>\n";
print end_html;
Thank you for your time,
Johnny Shaieb
------------------------------
Date: Wed, 25 Oct 2000 15:45:10 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: First CGI script
Message-Id: <MPG.14611e684c87cb0698984a@localhost>
Johnny Shaieb wrote ..
>Below are 2 files name.html and hello.pl. Also, I have listed the output
>from command line.
>
>My question is that name.pl works fine from command line, but when I
>engage this script from a browser is print will print the actually code
>instead of the html.
you will find pointers in the standard Perl documentation that was
installed on your machine when you installed Perl
perlfaq9: My CGI script runs from the command line but not the browser.
type the following to view the FAQ
perldoc perlfaq9
or the following for more information on the perldoc utility
perldoc perldoc
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Tue, 24 Oct 2000 21:44:41 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: First CGI script
Message-Id: <39F66539.24C8482A@vpservices.com>
Johnny Shaieb wrote:
>
> ***However it does not work from a browser**********
> #The actually code is returned.
This has nothing to do with how your script is written. As you verified
from the command line, it works fine. Your problem is with your web
server and how it serves CGI scripts. Is the webserver set up to serve
scripts from the directory you have the script in? Is it set up to
serve scripts with the file extension you are using (.pl). Some servers
require scripts to be in a specific directory and/or require the script
to have a specific extension (e.g. .cgi) but the only way to know is to
check in the configuration files for your web server or ask the server's
admin (if that isn't you). Please check the documentation for your
webserver or ask in a newsgroup about that webserver.
If by some chance this is your own computer and you do not have a web
server installed, free, easily installable web servers are available for
almost all operating systems, see for example http://www.apache.org/ or
do a search for web servers on the net.
--
Jeff
------------------------------
Date: Wed, 25 Oct 2000 04:46:16 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Help!!!
Message-Id: <slrn8vcpcl.me9.tjla@thislove.dyndns.org>
I was shocked! How could hsriniv@my-deja.com <hsriniv@my-deja.com>
say such a terrible thing:
>Hi Everybody,
>
>I have a problem with this perl file and I thank you guys in advance
>for your help.
>
>Any kind of help is appreciated.
Rewrite your open() calls so that you use the $! variable in your die()
statement. Then see what the error message says
open FILE, 'my_file' or die "Cannot open file: $!";
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
The bomb will never go off. I speak as an expert in explosives.
-- Admiral William Leahy, U.S. Atomic Bomb Project
------------------------------
Date: Tue, 24 Oct 2000 15:56:26 -0700
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: Help!!!
Message-Id: <39F6139A.F302FD7A@jpl.nasa.gov>
hsriniv@my-deja.com wrote:
> Any kind of help is appreciated.
You are more likely to get answers if you reduce your problem down to a
handful of lines that people can read at a glance. If you were to
reduce your script to 10 or so lines and repost, it would help a lot.
You might even find the problem yourself just by breaking it into
smaller pieces. Also it helps to include a minimal dataset that causes
the problem as well as the actual and expected output.
Incidentally, the first line of your script should be:
#!/usr/bin/perl -w
You might also consider:
use strict;
which can be very helpful in finding typos (but will require many
changes to what you have posted).
Jon
--
Knowledge is that which remains when what is
learned is forgotten. - Mr. King
------------------------------
Date: Wed, 25 Oct 2000 14:30:31 +1100
From: Ian Boreham <ianb@ot.com.au>
Subject: Re: How to pass a String to the STDIN of an other prg?
Message-Id: <39F653D6.9C288C0B@ot.com.au>
dragnovich@my-deja.com wrote:
> Hello folks! I have this problem an don't know how to solve it =)
>
> Ok I have two programs and i like run one program since my perl
> program, and send some text to this program and wait for a responce and
> asign this responce to a variable. The problem is that the called
> program waits for the text writed from the STDIN and I dont know how to
> send this text tru that... can you help me ??
If you are trying to get another program's STDIN to read from your
program, you can run it using a piped open (see perldoc -f open). If you
are trying to read its STDOUT, you can also use a piped open (with the
pipe going the other way), or the backticks.
However, if you are trying to do both at the same time, it gets nasty.
See perldoc -q 'How can I open a pipe both to and from a command?' . If
you don't use the package described here, you'll end up basically
implementing the same thing anyway.
Regards,
Ian
------------------------------
Date: 25 Oct 2000 00:44:26 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: IO::Select problem
Message-Id: <8t5rvq$8he$1@provolone.cs.utexas.edu>
In article <39F5C452.63306F32@watson.wustl.edu>,
Craig Pohl <cpohl@watson.wustl.edu> wrote:
>What Conditions will trigger the IO::Select to return file handles to
>the error element in the return values?
There isn't an error element. It's an exception element.
In practice, you're not going to use the exception stuff very much in
Perl, since it deals with things like out-of-band data on TCP sockets.
(I don't know the full list. I have the original edition of Stevens's
"Unix Network Programming", and it only lists out-of-band data and
something obscure having to do with ptys.)
For error checking, you should just check the error codes of all your
(non-blocking, of course) reads and writes on whatever it is you're
select()ing against.
Hope that helps.
- Logan
------------------------------
Date: Tue, 24 Oct 2000 23:27:25 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Length of a string stored in a scalar
Message-Id: <MPG.145fc32a3eb82e4c98ae6b@nntp.hpl.hp.com>
In article <39F61D6A.59CB4D3D@_ANTISPAM_.lucent.com> on Tue, 24 Oct 2000
18:38:18 -0500, Jeff H <jeffahill@_ANTISPAM_.lucent.com> says...
> This may seem like a stupid question, but how do I determine the length of a
> string stored in a scalar? I've read the perldoc on Perl data types, but it
> didn't seem to tell how to do this. It would be incredibly handy information to
> have in some of my applications.
The self-answering question of the week!
perldoc -f length
You might take a trip through perlfunc, where you will find all sorts of
useful goodies.
> Also, does Perl store a scalar string as in other languages, such as a Sting in
> C++ or Java? Or does it have it's own internal representation? This is more
> for my own edification, and not necessarily important that it get answered.
You don't need to know, so don't ask, and no one will tell you. What
you might want to know is that the length is stored with the data, so
finding the length is inexpensive. There are no terminating "\0" bytes
as in C.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 25 Oct 2000 05:30:16 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: local binmode?
Message-Id: <slrn8vcrv5.a0g.mgjv@verbruggen.comdyn.com.au>
On 25 Oct 2000 02:23:59 GMT,
Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
> [A complimentary Cc of this posting was NOT sent to Martien Verbruggen
> <mgjv@tradingpost.com.au>],
> who wrote in article <slrn8vc24m.a0g.mgjv@verbruggen.comdyn.com.au>:
>
> > But, as Craig Berry pointed out to me a little while ago in private
> > correspondence, it is not formally correct to call binmode after any
> > I/O is done on the filehandle. it may work for you, but it shouldn't.
>
> And, as I said it many times already, this is a bug in Perl.
> Programmer should be free to combine print, read, sysread, and
> syswrite in an arbitrary order. Perl has enough information to
> intertwine these calls by all the necessary seek()s (if needed).
Yes, I feel that Perl should be able to deal with this as well. And
since I trust your judgment when you say that it is technically
possible, it should probably be made to work that way. Are there any
objections to fixing this? Or is it just that no one ever got around
to it, or no one has yet seen enough value in it?
However, until that time, we're stuck with a binmode that can only be
called before I/O. :(
Martien
--
Martien Verbruggen |
Interactive Media Division | Make it idiot proof and someone will
Commercial Dynamics Pty. Ltd. | make a better idiot.
NSW, Australia |
------------------------------
Date: Wed, 25 Oct 2000 05:11:26 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: LWP????
Message-Id: <slrn8vcqrs.me9.tjla@thislove.dyndns.org>
I was shocked! How could gary.lefko@usafa.af.mil <gary.lefko@usafa.af.mil>
say such a terrible thing:
>Is LWP a Perl Module, if so are their references for it (web or book)?
Yes.
http://search.cpan.org/search?mode=module&query=LWP
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Don't go around saying the world owes you a living. The world owes you
nothing. It was here first.
-Mark Twain
------------------------------
Date: Wed, 25 Oct 2000 17:18:23 +1300
From: "Peter Sundstrom" <peter.sundstrom@eds.com>
Subject: Re: Make me a hot or not script
Message-Id: <8t5n4v$pij$1@hermes.nz.eds.com>
Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote in message
news:slrn8vcktn.me9.tjla@thislove.dyndns.org...
> I was shocked! How could Uri Guttman <uri@sysarch.com>
> say such a terrible thing:
> >>>>>> "MvD" == Matthijs van Duijvenbode <matthijs@vanduijvenbode.com>
writes:
> >
> > MvD> I need to find a cgiprogrammer to do a proposal to build a script
> > MvD> similar to that one can see at www.amihotornot.com. (Perl, UNIX)
> > MvD> I´m looking for someone who can give me a fixed price.
> >
> >$50,000. take it or leave it.
>
> Cheapskate. I would do it for $100000. Of course that's in New Zealand
> dollars so it may be worth less over there.
At the current rate the NZ peso is sliding, NZ$100,000 will be just enough
to buy a big mac and coke in the US.
------------------------------
Date: Wed, 25 Oct 2000 06:39:43 +0200
From: "Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.li>
Subject: Re: On being Schwartz.. (was Re: newbie cgi examples)
Message-Id: <kqocvso3uevfau6padv0gabu13ti3v9ujg@4ax.com>
[posted and cc'ed]
On 24 Oct 2000 13:14:11 -0700, merlyn@stonehenge.com (Randal L. Schwartz) wrote:
> >>>>> "Philip" == Philip 'Yes, that's my address' Newton <nospam.newton@gmx.li> writes:
>
> Philip> How about Muriel Hemingway, though? You related to her? :)
>
> No, I'm just "twins" with Mariel Hemingway, no relation to Muriel, I
> presume. {grin}
Whoops, spelling error. I misremembered her name. I meant Mariel. (I had read
about you on your page, but it was a while ago.)
Well, being twins does kind of make you related, doesn't it? ;)
Cheers,
Philip
------------------------------
Date: Wed, 25 Oct 2000 13:10:08 +0800
From: "Shen Yizhe" <yizhe@freevote.com>
Subject: Re: Perl & mySql
Message-Id: <8t5pv0$l2d$2@clematis.singnet.com.sg>
Honestly.. i learnt DBI online... by reading examples and going to mySQL.com
and read their manual ... pretty simple :)
Jon S. <jonceramic@nospammiesno.earthlink.net> wrote in message
news:39f46fd3.13680072@news.earthlink.net...
> On Thu, 19 Oct 2000 23:56:10 +0100, James Taylor
> <james@NOSPAM.demon.co.uk> wrote:
>
> >In article <8snpve$nn9$1@nnrp1.deja.com>, Miker
> ><URL:mailto:mrobison@c802.crane.navy.mil> wrote:
> >>
> >> i do NOT recommend the o'reilly "mysql and msql" book
> >> for learning. maybe a reference.
> >
> >I'm surprised that you think that. I found it quite understandable
> >although I must admit to reading it in parallel with the O'Reilly book
> >"Programming the Perl DBI" which covered the DBI to a much greater
> >depth than "MySQL & mSQL" did. I guess the best advice would be to
> >recommend the DBI book for learning and the MySQL book for reference.
>
> I concur. Programming the Perl DBI and the www.mysql.com docs have
> done this newbie just fine so far. Also, the Oreilly site has the
> msql/mysql book's chapter on CGI.pm as the sample chapter. It's a
> good download in a pinch.
>
> The real question is if you know and understand databases, SQL, and
> Normalization or not. If not, I'd suggest a book like "SQL for
> Dummies".
>
> Jon
------------------------------
Date: Mon, 23 Oct 2000 20:03:02 -0600
From: 01031149@3web.net (Duke Normandin)
Subject: Re: Perl outputs to dos instead of ie5 browser
Message-Id: <W3O950twrjFX092yn@3web.net>
In article <VzXI5.8638$Uy5.372743@news000.worldonline.dk>,
"Michael Frost" <micfrost@worldonline.dk> wrote:
>What should I do to test my perl cgi before uploading to the webserver?
>It prints this simple response to a dos window (win98), instead of the
>explorer! <filename: hello.pl> :
>
>print "Content-type: text/html\n\n" ;
>
>print <<EOF ;
><html>
><head><title>CGI Results</title></head>
><body>
><h1>Hello, world.</h1>
></body>
></html>
>EOF
>
>exit ;
>
>
>shouldn't the Perl STDOUT output to my ie5 browser window?
>
>-Michael
Go to http://www.24link.com. There you can DL a slick, easy-to-install
web-server. Read the docs about setting it up for CGI stuff. If you get
into trouble, email me!
-duke
------------------------------
Date: Wed, 25 Oct 2000 04:16:57 GMT
From: noghri@nospam.com (Noghri)
Subject: Perl Program Problem
Message-Id: <39f65dc5.29159559@enews.newsguy.com>
First off I have this perl script that I've been trying to get to run.
Here's a copy of the script.
**********************************************************************************
#!/usr/local/bin/perl
print "This script changes the journal web page such that it works for
anyone.\n";
print "What is your name? ";
$name=<stdin>;
print "\nWhat is your login name? ";
$lname=<stdin>;
print "\nWhat would you like the password to be? ";
$pword=<stdin>;
print "\nRepeat? ";
$ppword=<stdin>;
while($ppword ne $pword)
{
print "\n!!!Passwords are not the same!!!";
print "\nWhat would you like the password to be? ";
$pword=<stdin>;
print "\nRepeat? ";
$ppword=<stdin>;
}
chdir(~);
if (-e public_html) {chdir(public_html);}
else {mkdir(public_html);system "chmod 755
public_html";chdir(public_html);}
if (-e cgi-bin) {chdir (cgi-bin);}
else {mkdir (cgi-bin);system "chmod 755 cgi-bin";}
mkdir(cgi-bin/entries);
mkdir(journal);
system "cp index.html journal";
system "cp nav.html journal";
system "cp defalt.html journal";
system "chmod 744 journal/*)";
system "cp ja.cgi cgi-bin";
system "cp new.cgi cgi-bin";
system "chmod 755 cgi-bin/*";
system(chmod 744 journal);
system "chmod 757 cgi-bin/entries";
open(JOURNAL,">cgi-bin/.journal");
print JOURNAL "$pword\n0\n;"
close(JOURNAL);
fixindex();
fixnav();
fixja();
copyfiles();
print "path ~/public_html/cgi-bin/entries/ now exits on your
account.\n ENGR.ORST.EDU uses this directory to run personal scripts
from.\n ~/public_html/journal has been created to house the journal.
\nThe address of the journal is http://www.engr.orst.edu/~" . $lname .
"/journal/.\n"
exit;
sub fixindex()
{
$#file=0;
open(INDEX,"<index.html");
foreach $line <INDEX>
{
$line=$l;
$l=~s/xyzzyname/$name/;
@file=(@file,$l);
}
open(INDEX, ">index.html");
foreach $line (@file)
{
print INDEX $line;
}
close NAV;
}
sub fixnav()
{
$#file=0;
open(NAV,"<nav.html");
foreach $line <INDEX>
{
$line=$l;
$l=~s/xyzzylname/$lname/;
@file=(@file,$l);
}
open(NAV, ">nav.html");
foreach $line (@file)
{
print NAV $line;
}
close NAV;
}
sub fixja()
{
$#file=0;
open(JA,"<ja.cgi");
foreach $line <JA>
{
$line=$l;
$l=~s/xyzzylname/$lname/;
@file=(@file,$l);
}
open(JA, ">ja.html");
foreach $line (@file)
{
print JA $line;
}
close JA;
}
sub copyfiles()
{
system "copy index
}
**************************************************************************************
Now I do as the instructions say and I:
"Download it, place into an empty directory, and run the fixup.pl to
customize it to you. To untar it, use "tar -xf journal.tar" while in
that directory" This is what happens when I do that
***************************************************************************************
eel /nfs/stak/u4/h/hummert/public_html/cs312 59% tar -xf journal.tar
eel /nfs/stak/u4/h/hummert/public_html/cs312 60% ls
default.html index.html journal.tar new.cgi*
fixup.pl* ja.cgi* nav.html
eel /nfs/stak/u4/h/hummert/public_html/cs312 61% fixup.pl
syntax error at fixup.pl line 22, near "~)"
Not enough arguments for mkdir at fixup.pl line 24, near
"public_html)"
Not enough arguments for mkdir at fixup.pl line 27, near "bin)"
Not enough arguments for mkdir at fixup.pl line 28, near "entries)"
Not enough arguments for mkdir at fixup.pl line 29, near "journal)"
Bareword found where operator expected at fixup.pl line 37, near "744
journal"
(Missing operator before journal?)
syntax error at fixup.pl line 37, near "744 journal"
syntax error at fixup.pl line 42, near "close"
syntax error at fixup.pl line 51, near "exit"
syntax error at fixup.pl line 59, near "$line <"
syntax error at fixup.pl line 71, near "}"
fixup.pl has too many errors.
eel /nfs/stak/u4/h/hummert/public_html/cs312 62%
****************************************************************************************
I can't seem to figure out exactly what's wrong. Could someone help me
out here?
-Noghri
------------------------------
Date: Wed, 25 Oct 2000 16:25:48 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: Perl Program Problem
Message-Id: <MPG.146127fb45a330b398984c@localhost>
Noghri wrote ..
>I can't seem to figure out exactly what's wrong. Could someone help me
>out here?
you have errors in your programs at the lines that perl indicated in its
error output
subtext: this is not a support forum for every crappy Perl program that
is floating around the internet - talk to whom you got the program from
and have them debug their product for you
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: 25 Oct 2000 06:28:31 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: sorting multidimensional arrays
Message-Id: <slrn8vcvfc.28m.bernard.el-hagin@gdndev25.lido-tech>
On Tue, 24 Oct 2000 19:11:49 GMT, Quantum Mechanic
<quantum_mechanic@my-deja.com> wrote:
>Since I haven't seen a reply yet, here's an attempt...
>
>In article <8t4jne$i2m$1@nnrp1.deja.com>,
> exster@hotmail.com wrote:
>
>> @ARRAY = ("text2", "text1", "text3");
>>
><snip>
>>
>> @outer[@ARRAY[$x]]= $x*$x;
><snip>
>>
>> I want to sort the outer array while keeping the corresponding values
>of
>> "text2 to x^2" and "text3 to x^3" intact.
>>
>> How do I do that using the sort {$a <=> $b) function?
>>
>
>First, you are mixing up your type indicators ($, @, %). A scalar
>variable reference begins with '$', an array with '@', and a hash
>with '%'. However, if you are referencing a scalar *element* in an
>array or hash, use '$' with the array name.
>
>For example, to assign to a single array element:
>
> $array[27] = "something";
>
>The (square) brackets indicate that 'array' is an array variable.
>Similarly, (curly) braces indicate a hash variable, as in:
>
> $hash{32} = "something else";
>
>Second, you probably want a hash for the second array. Using your
>example:
>
>while ($x <= $5)
>{
> $outer{$ARRAY{$x}} = $x*$x;
> $x++;
>}
>
>There are numerous ways to do this with less code, such as:
>
> @inner = qw( zero, one, two, three, four, five );
'Possible attempt to separate words with commas at ./perl.pl line 3'
> %outer = map { $inner[$_], $_*$_ } (0..$#inner)
No ';' at the end which results in...
> map { print "\$outer{$_} = <$outer{$_}>\n" } keys %outer;
...'Syntax error at ./perl.pl line 5 near ")
map"
Execution of ./perl.pl aborted due to compilation errors.'
>gives:
>
>$outer{zero} = <0>
>$outer{five} = <25>
>$outer{two} = <4>
>$outer{one} = <1>
>$outer{four} = <16>
No it doesn't.
Cheers,
Bernard
--
perl -le'
($B,$e,$r,$n,$a,$r,$d)=q=$B$e$r$n$a$r$d==~m;
\$(.);xg;print$B.$e.$r.$n.$a.$r.$d;'
------------------------------
Date: Wed, 25 Oct 2000 06:51:09 +0200
From: marvin <glodalec@yahoo.com>
Subject: Re: Submit buttons
Message-Id: <MPG.14608524f8f033d4989685@news.siol.net>
In article <MPG.1460070827784a4e989843@localhost>,
elephant@squirrelgroup.com says...
> marvin wrote ..
> >In article <%c5J5.278$h32.225140@typhoon.southeast.rr.com>,
> >jlinch@mediaone.net says...
> >> Is it possible to have multiple Submit buttons on a form? What I want to do
> >> is set up a form to add, edit, or delete a database record. My thought is to
> >> have a Submit button for each of these actions. Obviously, I would want to
> >> be able to tell, from the Perl script, which button was pressed so that I
> >> could handle it appropriately. Any help on this would be appreciated.
> -
> >One way to do it is
> >
> ><INPUT TYPE=image SRC=/usr/mypic/pica.gif NAME=add>
> ><INPUT TYPE=image SRC=/usr/mypic/pice.gif NAME=edit>
> ><INPUT TYPE=image SRC=/usr/mypic/picd.gif NAME=delete>
> >
> >Paramaterers are passed to the cgi as
> >add.x=15&add.y=17 if add is clicked and so on
> >
> >so
> >
> >AddRecord() if param('add.x') ;
> >EditRecord() if param('edit.x') ;
> >DeleteRecord() if param('delete.x') ;
> >
> >would probably work
>
> an answer that demonstrates perfectly the reason why you should ask
> HTML/CGI questions in HTML/CGI related newsgroups
>
> marvin - there are far simpler approaches than what you've used here
>
>
I would certainly want to hear one. You can mail me also.
Regards
Marvin
------------------------------
Date: Wed, 25 Oct 2000 16:20:19 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: Submit buttons
Message-Id: <MPG.146126b1c61932ba98984b@localhost>
[ posted to comp.lang.perl.misc and CCed to glodalec@yahoo.com ]
marvin wrote ..
>In article <MPG.1460070827784a4e989843@localhost>,
>elephant@squirrelgroup.com says...
>> marvin wrote ..
>> >In article <%c5J5.278$h32.225140@typhoon.southeast.rr.com>,
>> >jlinch@mediaone.net says...
>> >> Is it possible to have multiple Submit buttons on a form? What I want to d
>> >> is set up a form to add, edit, or delete a database record. My thought is
>> >> have a Submit button for each of these actions. Obviously, I would want to
>> >> be able to tell, from the Perl script, which button was pressed so that I
>> >> could handle it appropriately. Any help on this would be appreciated.
>> -
>> >One way to do it is
>> >
>> ><INPUT TYPE=image SRC=/usr/mypic/pica.gif NAME=add>
>> ><INPUT TYPE=image SRC=/usr/mypic/pice.gif NAME=edit>
>> ><INPUT TYPE=image SRC=/usr/mypic/picd.gif NAME=delete>
>> >
>> >Paramaterers are passed to the cgi as
>> >add.x=15&add.y=17 if add is clicked and so on
>> >
>> >so
>> >
>> >AddRecord() if param('add.x') ;
>> >EditRecord() if param('edit.x') ;
>> >DeleteRecord() if param('delete.x') ;
>> >
>> >would probably work
>>
>> an answer that demonstrates perfectly the reason why you should ask
>> HTML/CGI questions in HTML/CGI related newsgroups
>>
>> marvin - there are far simpler approaches than what you've used here
>>
>>
>I would certainly want to hear one. You can mail me also.
as Makarand routinely explained to the originator when they re-posted
the question to the appropriate newsgroup "The submit button is like
other form elements - give it a name in the input tag, the Perl script
processing form input can differentiate between these multiple buttons
using these name tags."
eg.
<input type="submit" name="add" value=" Add Button ">
then in the CGI program (using your subroutine names)
AddRecord() if defined $cgi_object->param('add');
there's no need to use an 'image' input type because a 'submit' input
type will send a name/value pair if the name attribute is provided
[ followups set ]
btw - on the only Perl issue so far in this thread - your tests should
test for 'defined'ness (as I have done) because if for whatever reason
the value of those parameters happens to be zero (much more likely with
your image example than with my submit one) then your script would fail
to recognise that the 'button' had been pressed
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Wed, 25 Oct 2000 06:22:11 GMT
From: Ronald J.H. Rood <ronr@my-deja.com>
Subject: Re: why core dump ? -> solution !
Message-Id: <8t5u6g$kcf$1@nnrp1.deja.com>
In article <39F4F5C3.8EA51262@rochester.rr.com>,
Bob Walton <bwalton@rochester.rr.com> wrote:
> "Ronald J.H. Rood" wrote:
> >
> > Hi,
> > I am relatively new to perl. This is a little excercise script:
> > perl 5.6.0 aix
> > dbi 1.14
> > dbd oracle 1.06
> > ------------------------------------
> > #!/usr/bin/perl -w
> > use DBI;
> >
> > my $dbuser = $ENV{ORACLE_USERID} || 'scott/tiger';
> > my $getRows = 'select count(*) from TABLE_NAME';
> > my $dbh = DBI->connect('dbi:Oracle:', $dbuser, '', {
> > AutoCommit => 1,
> > PrintError => 0,
> > }) or die "Couldn't connect to database: " . DBI->errstr;
> > my $sth = $dbh->prepare('SELECT table_name, owner FROM all_tables
WHERE
> > table_name like upper (?) ')
> > or die "Couldn't prepare statement: " . $dbh->errstr;
> >
> > print "Enter table name> ";
> > while ( defined ($table_pattern = <>) && ( length ($table_pattern) >
0 )
> You would be better off with <STDIN> rather than <> above. If you
> accidentally give a parameter to your program when you start it, <>
will
> attempt to read from a file by that name. Also, the defined function
> will succeed when scalar $table_pattern has *any* value, including the
> null string, except for undef (which is not the null string). Also,
the
> length function will report the length of the string value returned by
> $table_pattern, which will include the line terminator character(s).
> Since neither of your while tests will ever fail, you could just as
> easily say:
>
> while(<STDIN>){
> ...
>
> Then place your termination tests inside the while loop, executing the
> last function to terminate the loop. Then you could do something
like:
>
> while(<STDIN>){
> chomp; #remove line terminators if any
> $table_pattern=$_;
> #next line works because line terminator(s) were removed
> last unless length($table_pattern)>0;
> > ) { # Read input from the user
> > my @data;
> > my $count_rows;
> >
> > chomp $table_pattern;
> > $sth->execute($table_pattern) # Execute the query
> > or die "Couldn't execute statement: " . $sth->errstr;
> >
> > # Read the matching records and print them out
> > while (@data = $sth->fetchrow_array()) {
> > my $table_name = $data[0];
> > my $owner = $data[1];
> >
> > ($count_rows = $getRows) =~ s/TABLE_NAME/$owner.$table_name/ ;
> > # $count_rows now contains something like select count(*) from
> > owner.table
> > my $sth = $dbh->prepare( $count_rows)
> > or die "Couldn't prepare statement: " . $dbh->errstr .
> > $count_rows;
> >
> > $sth->execute() # Execute the query
> > or die "Couldn't execute statement: " . $sth->errstr;
> > @data = $sth->fetchrow_array();
> > my $rows = $data[0];
> > print "\t$count_rows has $rows rows\n";
> > }
> >
> > if ($sth->rows == 0) {
> > print "No tables matched `$table_name'.\n\n";
> > }
> >
> > print "\n";
> > print "Enter table_name> ";
> > }
> >
> > $sth->finish;
> > $dbh->disconnect; # disconnect and wait a short while
sleep 2; # prevents the coredump taking place
For some reason the sleep 2 fixes the problem. This could have something
to do with the oracle background process I think.
--
Ronald
http://unix-dba.myweb.nl
The best way to accellerate a computer 'running' windows is by
gravitation
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 4718
**************************************