[12601] in Perl-Users-Digest
Perl-Users Digest, Issue: 12 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 2 20:57:34 1999
Date: Fri, 2 Jul 1999 17:52:10 -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 Fri, 2 Jul 1999 Volume: 9 Number: 12
Today's topics:
marvin the paranoid android gets a new job <gbartels@xli.com>
memory in active state win32 perl (John F. Duda)
Re: MLDBM on WIN32 <swiftkid@bigfoot.com>
MLDBM problem using MacPerl <h0444zkf@rz.hu-berlin.de>
Re: MLDBM problem using MacPerl <h0444zkf@rz.hu-berlin.de>
Re: MLDBM problem using MacPerl <dodger@dodger.org>
Re: MLDBM problem using MacPerl <h0444zkf@rz.hu-berlin.de>
Re: MLDBM problem using MacPerl (Paul J. Schinder)
Re: mon: Time-HiRes-01.20 not in @INC (David Efflandt)
mput command </dev/null@davidthornton.com>
Re: mput command <eamick@shell.clark.net>
Re: mput command <BluesSax@Unforgettable.com>
Re: mput command <gellyfish@gellyfish.com>
Re: MySQL vs Oracle tonysl@my-deja.com
name confusion bing-du@tamu.edu
Re: name confusion <tchrist@mox.perl.com>
Re: Need to install perls DBI for NT <swiftkid@bigfoot.com>
Re: Net Use in Perl under NT <carvdawg@patriot.net>
Net:SSLeay and Crypt:SSL on Linux 6.0 <ttudrej@mindspring.com>
Re: NEWBIE CODES AGAIN!! BETTER THIS TIME (Tad McClellan)
Re: NEWBIE CODES AGAIN!! BETTER THIS TIME <cameron_graham@clear.net.nz>
Re: NEWBIE CODES AGAIN!! BETTER THIS TIME <nospam.newton@gmx.net>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 02 Jul 1999 09:14:39 -0400
From: Greg Bartels <gbartels@xli.com>
Subject: marvin the paranoid android gets a new job
Message-Id: <377CBB3F.4AAB861A@xli.com>
marvin the paranoid android gets a new job
as hall monitor for the comp.lang.perl.misc
newsgroup. here's a sampling of posts.
followed by Martin's reply.
newbie:
> How do I print two variables on the same line?
> $first and $last?
recently flamed newbie, but knows answer:
> yeah I couldn't figure that out either. its:
> print "$first $last\n";
> good luck
moderate experience perl programmer:
> print "$first $last \n";
> print $first .' '. $last ."\n";
> print $first; print ' '; print $last; print "\n";
> btw, you should really read the FAQs.
guru perl programmer:
> RTFM, for the love of god, its right there
> in the FAQs. You should spend some time
> glancing through at least an introductory
> text on how to program in perl before you
> come in here and waste everyone's time by
> posting such ludicrous questions that have
> already been answered by the standard
> documentation. I mean, we have better things
> to do then spend our day sifting through
> message after message of inane questions.
> We do have jobs, and a life outside of perl
> and outside of this newsgroup, so no one
> here wants to have wade through a bunch
> of crap questions when there's real work
> to be done, real perl questions to be
> answered, real stumpers that deserve to be
> addressed in this forum. no one wants to
> spend most of their time sorting the
> wheat from the chaf, when we could be
> doing more important things besides sitting
> here, reading through a bunch of stupid
> questions from lazy morons of the likes
> of you. if your a programmer by profession,
> do your employer and quit now, rather than
> bringing your entire company down in flames
> when they try to run one of yours scripts.
> Did I mention that I have more important
> things to do than answer stupid questions?
> Anyway, if you must know, and for the sake
> of ending this thread so that more useful
> questions will get more of the bandwidth,
> one of the more obvious solutions is this:
> $_=join(' ',($first,$last));print;
> Now quit posting such stupid questions and
> wasting the bandwidth of this newsgroup
> and wasting everyone's time who have to
> read through so many dumb questions that
> could be answered by simply reading the FAQ's.
> we have more important things to do.
Marvin's response:
> here I am, with the brain the
> size of a planet, and what do I get?
> "perlbot, how do I print two variables on
> the same line?" "perlbot, stop those
> Class B Frogstar fighters." "perlbot,
> bring those two castaways up here."
> And all my diodes on one side are still
> aching. but do you care? I very much doubt
> it. very well, if you must ask, ask away.
> its not like I have anything important to
> do. The answer is right there, imprinted
> in your brainwave patterns. I'm surprised
> you even had to ask. no I'm not. I'm
> not surprised at all. your questions are
> quite typical actually. If you must know
> the answer is 42. there, are you satisfied?
> are you happy now? now if you dont mind,
> I'll be off, solving some rather difficult
> differential equations, because I wont have
> anything else better to do until someone
> posts another dumb question. thank you.
> goodbye.
hm, ya know, I gotta say there's an awful
lot of similarities going on there.
Greg
------------------------------
Date: 2 Jul 1999 16:11:47 GMT
From: jduda@blue.seas.upenn.edu (John F. Duda)
Subject: memory in active state win32 perl
Message-Id: <7lioc3$h41$1@netnews.upenn.edu>
While testing a simple tcp/ip server applicaion written in Active
State Perl on Winnt(uses IO::Socket), I noticed that the memory usage
sometimes jumps up slightly when there is a connection from the corresponding
client program. Sometimes it stays constant, sometimes it goes down.
Is this a problem with my code? Is this a problem with NT/Active
State? Can anyone recommend a better way to look at how much memory
a win32 perl script is using besides NT's task manager?
John Duda
Univ. of Pennsylvania Law School ITS
------------------------------
Date: Fri, 2 Jul 1999 15:20:04 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: MLDBM on WIN32
Message-Id: <7lj729$7ek2@news.cyber.net.pk>
Doug Crabtree <not@gonna.tell> wrote in message
news:7lh51n$f1r$1@nntp5.atl.mindspring.net...
> I installed the Win32 modules for MLDBM on my system (ActivePerl). For
some
> reason, it won't work. The script just seems to stop at the point I use
any
> of the functionality of it. Has anybody seen/fixed this problem? Is
there
> another module that I need?
It works fine for me!
Try installing DB_File through PPM and see if it solves the problem.
--
Faisal Nasim (the Whiz Kid)
Web: http://wss.hypermart.net/
AOL: Whiz Swift ICQ: 4265451
FAX: (815) 846-2877
------------------------------
Date: Fri, 02 Jul 1999 14:18:44 +0100
From: Erich Rast <h0444zkf@rz.hu-berlin.de>
Subject: MLDBM problem using MacPerl
Message-Id: <377CBC2F.4DF87D70@rz.hu-berlin.de>
Sorry if this is turns out to be a MacPerl specific problem, but I
haven't found a MacPerl newsgroup and the mailing list is much too high
volume for me. Using MacPerl patch level 5.004 version 5.20r4 the
following code code crashes my Mac (error 2) when I try to set the value
for a tied hash a second time:
use MLDBM qw(DB_File);
$dbm = tie(%TEST, 'MLDBM', 'test.dbm')
or die "Cannot open it: $!\n";
%TEST{'foo‘} = 'bar';
untie %TEST;
This works one time and inspecting the file shows that Dump has dumped
the hash into the database. However, the second time, changing the value
of %TEST{'foo'} = 'blurb'; will make it crash. Same for delete
(%TEST{'foo‘})
Setting new value/keys in the tied has works, but I cannot change
anything or delete keys.
I need to use MLDBM to store complex infomration (hashes in lists)
between runs. Any hints, suggestions etc. are very much appreciated as I
cannot find any information on this in the FAQs or MLDBM docs.
Best,
Erich
------------------------------
Date: Fri, 02 Jul 1999 14:26:49 +0100
From: Erich Rast <h0444zkf@rz.hu-berlin.de>
Subject: Re: MLDBM problem using MacPerl
Message-Id: <377CBE14.ABA254F2@rz.hu-berlin.de>
Sorry for the wrong quotes, these are just typos in the mail. Correct ''
quotes also lead to crashes.
Erich
------------------------------
Date: Thu, 1 Jul 1999 06:33:27 -0700
From: "Dodger" <dodger@dodger.org>
Subject: Re: MLDBM problem using MacPerl
Message-Id: <7lid8t$5rq$1@ancalagon.dragon-net.net>
Erich Rast wrote in message <377CBC2F.4DF87D70@rz.hu-berlin.de>...
>use MLDBM qw(DB_File);
>$dbm = tie(%TEST, 'MLDBM', 'test.dbm')
> or die "Cannot open it: $!\n";
>
>%TEST{'foo‘} = 'bar';
>
>untie %TEST;
>
>This works one time and inspecting the file shows that Dump has dumped
>the hash into the database. However, the second time, changing the value
>of %TEST{'foo'} = 'blurb'; will make it crash. Same for delete
>(%TEST{'foo‘})
>
Unless there's something about MLDBM that I don't understand, you're using
the wrong type... you want $TEST{foo} not %TEST{'foo'}, since you're
talking about a scalar, here, that just happens to be an item in a hash...
Could that be the problem?
Dodger
------------------------------
Date: Fri, 02 Jul 1999 16:04:03 +0100
From: Erich Rast <h0444zkf@rz.hu-berlin.de>
Subject: Re: MLDBM problem using MacPerl
Message-Id: <377CD4DF.7D6BD298@rz.hu-berlin.de>
I'd like to appologize for posting code with typos here, I had the
original on another machine and as I'm new to perl, the code I typed in
my post contained iditotic, quite inexcusable typos. Next time, I'll
check it better before posting. promised. Now here is the code that
doesn't work with MacPerl patchlevel 5.004 version 5.20r4:
use MLDBM qw(DB_File);
tie (%TEST, 'MLDBM', 'test.dbm')
or die "Cannot open: $!\n";
$TEST{'foo'} = 'bar';
untie %TEST;
Any changes to an existing key in %TEST will crash.
Erich
------------------------------
Date: Fri, 02 Jul 1999 23:10:24 GMT
From: schinder@leprss.gsfc.nasa.gov (Paul J. Schinder)
Subject: Re: MLDBM problem using MacPerl
Message-Id: <AFbf3.17276$4e1.189245@iad-read.news.verio.net>
In <377CBC2F.4DF87D70@rz.hu-berlin.de> Erich Rast <h0444zkf@rz.hu-berlin.de> writes:
>Sorry if this is turns out to be a MacPerl specific problem, but I
>haven't found a MacPerl newsgroup and the mailing list is much too high
>volume for me. Using MacPerl patch level 5.004 version 5.20r4 the
>following code code crashes my Mac (error 2) when I try to set the value
>for a tied hash a second time:
How much memory are you giving MacPerl? In my experience, the only
time MacPerl crashes is when it runs itself out of memory. The
default is not sufficient for serious module use; you should set it to
at least 8 Mb if you have the memory. I run MacPerl with a 30 Mb
partition.
>use MLDBM qw(DB_File);
>$dbm = tie(%TEST, 'MLDBM', 'test.dbm')
> or die "Cannot open it: $!\n";
>%TEST{'foo} = 'bar';
>untie %TEST;
>This works one time and inspecting the file shows that Dump has dumped
>the hash into the database. However, the second time, changing the value
>of %TEST{'foo'} = 'blurb'; will make it crash. Same for delete
>(%TEST{'foo})
>Setting new value/keys in the tied has works, but I cannot change
>anything or delete keys.
>I need to use MLDBM to store complex infomration (hashes in lists)
>between runs. Any hints, suggestions etc. are very much appreciated as I
>cannot find any information on this in the FAQs or MLDBM docs.
>Best,
>Erich
--
Paul J. Schinder
NASA Goddard Space Flight Center
schinder@leprss.gsfc.nasa.gov
------------------------------
Date: 2 Jul 1999 06:35:08 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: mon: Time-HiRes-01.20 not in @INC
Message-Id: <slrn7non8d.1id.efflandt@efflandt.xnet.com>
On Thu, 01 Jul 1999 16:55:48 -0400, David Weaver <daw@dect.com> wrote:
>Working on getting the script mon,v 1.110 working and it requires a
>package Time-HiRes-01.20. The package was installed and everything said
>it installed OK.
>
>It's a RH5.2 box running Perl version 5.004_05 built for i386-linux.
>
>* Run this command to test the install.:
>
>./mon -f -c mon.cf -s mon.d -a alert.d
>
>
>* And here's the result:
>
>Can't locate Time/HiRes.pm in @INC (@INC contains:
>/usr/lib/perl5/i386-linux/5.004
>05 /usr/lib/perl5 /usr/lib/perl5/site_perl/i386-linux
>/usr/lib/perl5/site_perl .)
>at ./mon line 36.
>BEGIN failed--compilation aborted at ./mon line 36.
>
>Line 36 is "use Time::HiRes qw(gettimeofday tv_interval usleep);"
>
>
>Saw this error and though I'd try and force HiRes into @INC with a use
>lib "xxx" but that didnt't work either.
What is the actual path to Time/HiRes.pm? Are you aware the 'use lib'
should point to the dir where 'Time' will be found (containing HiRes.pm)
NOT the path to HiRes.pm? Modules I install in RH 5.2 generally end up in
/usr/lib/perl5/site_perl. Maybe you forgot to 'make install'.
--
David Efflandt efflandt@xnet.com http://www.xnet.com/~efflandt/
http://www.de-srv.com/ http://cgi-help.virtualave.net/
------------------------------
Date: Fri, 2 Jul 1999 07:39:47 +0100
From: David Thornton </dev/null@davidthornton.com>
Subject: mput command
Message-Id: <XDMAYHAz6Ff3EwOz@davidthornton.com>
This is very basic FTP but I am having trouble.
I am using the mput command to successfully put multiple files from my
server to another server.
I am evoking the command whilst I am in the folder containing the files
to be FTPed elsewhere.
I am typing:
mput thefile**.zip [where ** is a number starting from 00 to 99).
This is ensuring that all files with the same name but different numeric
ending are FTPed.
It's currently being run from a telnet prompt.
1. How do I prevent the 'confirmation prompt' appearing between each
file being sent by mput? Currently I am having to press 'Y' between
every file. I don't want to do this. What is the correct extension I
need to add to the mput command to prevent the confirmation requests?
2. How can set up the FTPing as a script so I can invoke it and
disconnect from the server, leaving the script to FTP all the files to
the other server? I don't want to have to stay connected via telnet as I
am having to do now.
I have a full web server with Perl 5 and custom cgi-bin.
Thanks.
--
David Thornton
------------------------------
Date: Fri, 02 Jul 1999 13:07:44 GMT
From: Eric Amick <eamick@shell.clark.net>
Subject: Re: mput command
Message-Id: <AQ2f3.17125$4e1.182751@iad-read.news.verio.net>
In comp.unix.shell David Thornton </dev/null@davidthornton.com> wrote:
> This is very basic FTP but I am having trouble.
> I am using the mput command to successfully put multiple files from my
> server to another server.
> 1. How do I prevent the 'confirmation prompt' appearing between each
> file being sent by mput? Currently I am having to press 'Y' between
> every file. I don't want to do this. What is the correct extension I
> need to add to the mput command to prevent the confirmation requests?
Use the prompt command to disable the prompting before issuing the mput
command.
--
Eric Amick
Columbia, MD
eamick@clark.net
------------------------------
Date: Fri, 02 Jul 1999 12:19:32 -0400
From: Kenneth C Stahl <BluesSax@Unforgettable.com>
Subject: Re: mput command
Message-Id: <377CE694.F711C602@Unforgettable.com>
David Thornton wrote:
> This is very basic FTP but I am having trouble.
>
> I am using the mput command to successfully put multiple files from my
> server to another server.
>
> I am evoking the command whilst I am in the folder containing the files
> to be FTPed elsewhere.
>
> I am typing:
>
> mput thefile**.zip [where ** is a number starting from 00 to 99).
>
> This is ensuring that all files with the same name but different numeric
> ending are FTPed.
>
> It's currently being run from a telnet prompt.
>
> 1. How do I prevent the 'confirmation prompt' appearing between each
> file being sent by mput? Currently I am having to press 'Y' between
> every file. I don't want to do this. What is the correct extension I
> need to add to the mput command to prevent the confirmation requests?
>
prompting is on by default. Enter 'prompt' in your script to turn it off
prior to the mput.
>
> 2. How can set up the FTPing as a script so I can invoke it and
> disconnect from the server, leaving the script to FTP all the files to
> the other server? I don't want to have to stay connected via telnet as I
> am having to do now.
>
put a file like this in your home directory
machine xyzzy login mylogin password mypassword
macdef init
ascii
prompt
mget *
bye
macdef exit
Where:
xyzzy - the name of the machine you want to connect to
mylogin - the account on that machine
mypassword - the password for that account
Make sure that you have at least one blank line after the final macdef
Make sure that the permissions are set to 600
When you are ready to use it, enter:
nohup ftp xyzzy & >/tmp/ftp.log 2>&1 &
Beyond that, read the man pages for ftp and netrc
Ken
------------------------------
Date: 2 Jul 1999 16:04:31 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: mput command
Message-Id: <7linuf$1bs$1@gellyfish.btinternet.com>
[Followups trimmed]
In comp.lang.perl.misc David Thornton </dev/null@davidthornton.com> wrote:
>
> 2. How can set up the FTPing as a script so I can invoke it and
> disconnect from the server, leaving the script to FTP all the files to
> the other server? I don't want to have to stay connected via telnet as I
> am having to do now.
You might want to look at the module Net::FTP which is part of the libnet
package available from CPAN <http://www.perl.com/CPAN> . You can
create a program that will carry out the FTP'ing in any way you wish and
which can be run in the background.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Fri, 02 Jul 1999 19:05:42 GMT
From: tonysl@my-deja.com
Subject: Re: MySQL vs Oracle
Message-Id: <7lj2hu$jvo$1@nnrp1.deja.com>
I think mySQL and Oracle has very similar in terms
of syntax despite some minor differences such the
numeric field description. You can go to
www.mysql.com to get full documentation.
The company I'm with provides Linux-Perl5-mySQL
hosting, but I'm not sure about the cost. You can
e-mail to eric@peername.net for a price
comparison.
Tony Lau
In article <casd3.190$6J4.357@news.ipass.net>,
"Wendell Crenshaw" <crensw@yahoo.com> wrote:
> Hi all:
>
> I'm new to Perl, and I need to develop dynamic
pages with Perl on Unix that
> utilize an Oracle database. I'm having a
problem finding a reasonable cost
> hosting service that offers Oracle, so I'm
considering using MySQL - and I'm
> wondering how much syntax difference there is
between Oracle and MySQL when
> you consider writing web pages that do simple
data chores, such as
> add/change/delete records in the data base. Can
anyone share insight? I'm
> hoping the only difference is in the connection
string to the data base!!!
>
> As a bonus question, can anyone point me to a
"Unix / Sun Solaris 2.6 /
> Netscape 3.6 / Perl 5" commercially available
web hosting service?
>
> Cheers!
>
> Wendell Crenshaw
>
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 02 Jul 1999 22:08:03 GMT
From: bing-du@tamu.edu
Subject: name confusion
Message-Id: <7ljd7r$o18$1@nnrp1.deja.com>
Hi,
I am wondering if there is any readily available Perl script for
formatting person's name. Seems parents are getting more creative in
giving names to their child.
In the people file I am going to process, people's lastname, firstname
and middlename are put into different orders:
lastname firstname middlename Jr (or III, or II)
lastname Jr (or III, or II) firstname middlename
Some people have double lastnames, firstnames or middlenames(two or more
words in their lastnames, firstnames or middlenames).
I need to extract the lastname and the firstname from a full name.
Can somebody shed some light on this?
Thanks in advance for any help.
Bing
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 2 Jul 1999 18:05:13 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: name confusion
Message-Id: <377d53b9@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc, bing-du@tamu.edu writes:
:Some people have double lastnames, firstnames or middlenames(two or more
:words in their lastnames, firstnames or middlenames).
:
:I need to extract the lastname and the firstname from a full name.
I'm sorry, Bing, but I can't do that.
Consider the mellifluous name:
Doña María Jesús Concepción García Lorca de Jiménez
Her honorific is Doña.
Her surnames are García Lorca.
Her fathers's (first) surname is García.
Her mother's (first) surname is Lorca.
Her Christian names are María Jesús.
Her Communion name is Concepción.
Her husband's (first) surname is Jiménez.
And she probably goes by Concha. :-)
Plus just because there are four names doesn't mean the same everywhere:
John Ronald Reuel Tolkien's mother's surname (probably?) wasn't Reuel.
He just had more than one "middle" name. And he went by Ronald.
Manuel de Falla certainly had no husband. :-)
Gurusamy Sarathy's surname is the one in the former position, not the
one in the latter position. And what do you think Deng Xiao Ping's
surname was? Or Mao Tse Tung's?
Gaius Iulius Caesar's prenômen was Gaius, his nômen was Iulius, and his
cognômen was Caesar. Think of the cognômina as bonus personal names
(originally; this changed in time). The prenômina were personal names
not spoken of outside the immediate family.
And then of course, there's Iceland: patronymics in action!
What you ask simply cannot be done, because it's just not determinable.
The only thing you can do is give someone enough space to write it all in.
You gave give separate labelled sections if you want to what various
components are. Nothing else works.
--tom
--
"All things are possible, but not all expedient." (in life, Unix, and perl)
------------------------------
Date: Fri, 2 Jul 1999 15:33:30 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: Need to install perls DBI for NT
Message-Id: <7lj7rh$7p62@news.cyber.net.pk>
<gene158@my-deja.com> wrote in message news:7lgfh9$mis$1@nnrp1.deja.com...
> I am trying to install a DBI for perl. I tried to do what the readme
> file said perl Makefile.PL but only makefile.pl works, then make did
<snip>
If you are using ActivePerl, then use PPM to download DBI.
c:\winnt>ppm
ppm>install DBI
do you want to install DBI (y/n)? y
should be installed now!
--
Faisal Nasim (the Whiz Kid)
Web: http://wss.hypermart.net/
AOL: Whiz Swift ICQ: 4265451
FAX: (815) 846-2877
------------------------------
Date: Fri, 02 Jul 1999 06:44:30 +0100
From: Marquis de Carvdawg <carvdawg@patriot.net>
Subject: Re: Net Use in Perl under NT
Message-Id: <377C51BD.CB204982@patriot.net>
Have you considered using the Lanman module?
> > I'm writing a small Perl script to collect data from a number of
> servers
> > in an NT network.
> <snip>
> > Usually I would map the drive using a System call on the NT NetBios
> > command:
> >
> > net use k: \\server\share
> >
>
> Is there anything stopping you from accessing the file directly using
> //$server/share/filename ?
------------------------------
Date: Fri, 02 Jul 1999 20:28:23 -0400
From: "Thomas G. Tudrej" <ttudrej@mindspring.com>
Subject: Net:SSLeay and Crypt:SSL on Linux 6.0
Message-Id: <377D5927.6379302@mindspring.com>
I recently installed Linux 6.0 on 233 PII. It comes standard with Perl
5.005_03 built for i386-linux.
I want to write an HTTPS client in Perl (an app that accesses an
https://www.xxx... pages). If I understand correctly,
GAAS/Crypt-SSLeay-0.07 OR SAMPO/Net_SSLeay.pm-1.03 need to be installed
on top of openssl-0.9.3a or earlier version.
Has anyone been successful doing this? My friend and I tried several
different combinations of openssl and SSLeay modules always running to
some problems.
Any help will be gratly appreciated, Tankx in advance,
Thomas T.
------------------------------
Date: Thu, 1 Jul 1999 17:14:06 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: NEWBIE CODES AGAIN!! BETTER THIS TIME
Message-Id: <umlgl7.c44.ln@magna.metronet.com>
Cameron Graham (cameron_graham@clear.net.nz) wrote:
: Subject: NEWBIE CODES AGAIN!! BETTER THIS TIME
Please stop shouting at us.
: heres the new code, disect it, tell me whats wrong, tell me ways of
: improving PLEASE! =) thanx...
: #!perl -w
: #use strict;
Don't comment out that line. That kinda defeats the purpose. :-)
: # PAGE DATA IS RECIEVED HERE
: @input=("name","qname","age","pclans","whyjoin","whyletu","icqpros","icqnet"
: ,"longon");
you should use single quotes unless you need variable interpolation
and/or backslash escapes.
or even better use qw()
my @input = qw(name qname age pclans whyjoin whyletu
icqpros icqnet longon);
: # INPUTS FROM THE PAGE ARE
: # TAKEN FROM HERE ON AND
: # ASSIGNED VARIABLES.
: main: {
: if ( $input[0] eq '' )
: { $error="Please give me your real name"; }
: { &oppshtml }
: if ( $input[1] eq '' )
: { $error="Please give me your Quake name"; }
: { &oppshtml }
: if ( $input[2] eq '' )
: { $error="Please give me your age"; }
: { &oppshtml }
: if ( $input[4] eq '' )
: { $error="Why do you wanna join NovA?"; }
: { &oppshtml }
: if ( $input[5] eq '' )
: { $error="Why should we let you in NovA?"; }
: { &oppshtml }
: if ( $input[8] eq '' )
: { $error="How long have you been on Prosper?"; }
: { &oppshtml }
: }
: &savefile;
: &thanxhtml
: ### SUBROUTINES ###
: # SAVES EVERYTHING TO A FILE
: sub savefile {
: $filename="apps/apps.txt";
: open(FILE, ">>$filename") || die;
: print FILE "********************************\n";
: print FILE "NAME: $input[0]\n"; #60
: print FILE "QUAKE NAME: $input[1]\n";
: print FILE "AGE: $input[2]\n";
: print FILE "PREVIOUS CLANS: $input[3]\n";
: print FILE "JOINING COS: $input[4]\n";
: print FILE "WE SHOULD LET COS: $input[5]\n";
: print FILE "ICQ-PROSPER: $input[6]\n";
: print FILE "ICQ-NET: $input[7]\n";
: print FILE "BEEN ON PROSPER FOR: $input[8]\n";
: print FILE "********************************\n";
: print FILE "\n";
: close(FILE);
: }
A "here-doc" would be very much easier for maintenance:
print FILE<<ENDSAVE;
********************************
NAME: $input[0]
QUAKE NAME: $input[1]
..
BEEN ON PROSPER FOR: $input[8]
********************************
ENDSAVE
Much easier on the eyes.
: # THE ERROR MESSAGE (IF APPLICABLE)
: # IS GENERATED INTO A WEB PAGE HERE
Golly but you yell a lot...
: sub oopshtml {
: print "Content-type: text/html\n\n";
: print <<HTML;
: <HTML>
: <HEAD>
: <TITLE>WHOOPS! - SOMETHING WENT WRONG!<TITLE>
: </HEAD>
: <BODY>
: <CENTER>
: <h1>HAY!! $error</h1>
: </CENTER>
: </BODY>
: </HTML>
: HTML
: exit;
: }
print <<HTML;
Content-type: text/html
<HTML>
<HEAD>
..
</HTML>
HTML
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 2 Jul 1999 19:52:11 +1200
From: "Cameron Graham" <cameron_graham@clear.net.nz>
Subject: Re: NEWBIE CODES AGAIN!! BETTER THIS TIME
Message-Id: <Pa_e3.41$_r1.1607@news.clear.net.nz>
cheers man, a lot better than some ppl here =) sorry but the shouting, it
helps me see it amongst all the icky, messy code =Þ~~
so reckon it would work?
------------------------------
Date: Fri, 02 Jul 1999 10:58:15 +0200
From: "Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.net>
Subject: Re: NEWBIE CODES AGAIN!! BETTER THIS TIME
Message-Id: <377C7F27.198AB75E@gmx.net>
Cameron Graham wrote:
>
> if ( $input[0] eq '' )
> { $error="Please give me your real name"; }
> { &oppshtml }
>
> if ( $input[1] eq '' )
> { $error="Please give me your Quake name"; }
> { &oppshtml }
[etc. etc.]
Interesting syntax, this. if(condition) BLOCK BLOCK. I wonder why you
want to call &oppshtml so often (a subroutine that isn't even defined in
your code) -- even if all the $input[n] variables are filled!
(Somebody coming from Lisp, maybe? I think they have syntax along the
lines of (if (condition) (if-true-block) (if-false-block)), don't they?)
Cheers,
Philip
------------------------------
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 12
************************************