[11140] in Perl-Users-Digest
Perl-Users Digest, Issue: 4740 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 25 04:07:30 1999
Date: Mon, 25 Jan 99 01:00:18 -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, 25 Jan 1999 Volume: 8 Number: 4740
Today's topics:
Re: ** Seems Like a Natural for Perl ** <shelda@ibm.net>
Re: Can somebody point out the error of my ways please? (Bob Dubery)
Re: CGI.pm ? How can i install CGI.pm to my Unix server <new_email@see.web.page>
Re: CGI.pm ? How can i install CGI.pm to my Unix server <dave@northnet.com.au>
Re: Date actions using flatfile database <dave@northnet.com.au>
Re: Date actions using flatfile database (Larry Rosler)
Familiar w/ Soupermail - RE: SMTP return values <liam_@_unforgettable.com>
Re: HELP!! Perl Viewer?? <Mathias-Henry.Weber@de.heidelberg.com>
Re: help!?: how to a convert a sting ( "10" ) into a va <Dennis.Wehlmann@brr.de>
Hi-resolution timing issues <jmt16@po.cwru.edu>
Re: How to detect an empty hash ? (Andre L.)
Re: Newbie question: writing file (Larry Rosler)
Re: Non character match? (Larry Rosler)
Re: ok please don't shoot me for this question <elst.fels@nospam.ping.be>
Re: Perl Criticism (Sam Holden)
Re: Perl Criticism (Sam Holden)
Re: Perl Criticism (Sam Holden)
Pleeeeeassee help!!! <fletdog@bellatlantic.net>
sorting dates (Eric Smith)
Re: Want to output $29.85 not $29.8585 ya know? <jewell@OnlineRAGE.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 25 Jan 1999 05:36:23 +0000
From: Wesley <shelda@ibm.net>
Subject: Re: ** Seems Like a Natural for Perl **
Message-Id: <36AC02D7.D56BB2D8@ibm.net>
Matt Wiseman wrote:
>
> Also, Outlok express version 4.0 has an "inbox assistant" that will
> automatically do this. . .no need to code
>
I think fetchmail handles this sort of thing without code as well,
possibly in combination with procmail.
> David W. Bourgoyne wrote in message ...
> >
> >Here's the situation. Everyone at my household has a unique email
> >address at a mail forwarding service. All emails get forwarded to my
> >single ISP account. I would like to develop a POP3 Client that sucks
> >all the email off the ISP, looks at the To: fields and appends it to the
> >correct persons mbox. Also, I would like the POP3 Client to
> >automatically respond (send email back to the Sender) to image request.
> >
> >Seems Like a Natural for Perl!!!
> >
> >I was going to use the following modules:
> >
> >POP3Client - for popping the mail.
> >MailFolder - for writing the mbox files.
> >MIME-tools - for constructing the reply to an image request and
> > inserting the image into the outgoing email.
> >
> >MailFolder looks old, is there a better module for writing the mbox
> >file? Is this a good approach? Do I need any other modules? Any and all
> >comments are most welcome.
> >
> >Regards,
> >
> >David
> >
--
Wes Sheldahl
shelda@ibm.net
------------------------------
Date: Mon, 25 Jan 1999 05:41:07 GMT
From: elvis@theking.org (Bob Dubery)
Subject: Re: Can somebody point out the error of my ways please?
Message-Id: <36ac01ad.2086991@hermes.is.co.za>
On Sun, 24 Jan 1999 23:06:35 GMT, mgjv@comdyn.com.au (Martien
Verbruggen) wrote:
>In article <36ab4ff7.1765611@news.icon.co.za>,
> elvis@theking.org (Bob Dubery) writes:
>> Consider this code...
>
>You are obviously not using strict. bad.
>Are you using -w?
OK. I'm new to Perl (but not to programming per se), I'm not sure
about "strict" yet - I don't know about any other countries, but in
South Africa there is no perl tuition except to figure it our
yourself. I am using the -w switch.
>You should always check the result of these sorts of things. How do
>you know it succeeded? Is there anything in the database at all?
There is.
Maybe I haven't explained myself clearly. What puzzles me is why this
$hashname = "/usr/syschanges/tell";
works one way and this
$hashname = "/usr/syschanges/$thisword";
works another.
using the second method if $thisword has a value of 'tell' and I print
$hashname it shows as /usr/syschanges/tell. There is content in this
database, if I use the various file tests (e.g. -e $hashaname) they
reveal that the file is there, that I have the necessary permissions
etc.
But...
using the first method where I assign the entire path to $hashname the
code I quoted will show me the contents of the hash. Using the second
method, where I concatenate a literal and a variable to get the path
name, I don't get to see the contents of the hash.
>
>Maybe you should consider using one of the modules that have
>superceded this functionality.
>
># perldoc AnyDBM_File
Thanks. As stated I'm new to Perl. I haven't figured out modules or
how to use them yet, and for what I'm wanting to do opendbm should
work fine.
>
>> foreach $hashentry(keys %WORDHASH) {
>
>Instead of keys, you may want to use each:
Yeah. I just figured that one out last night.
>Really? is the code you gave us the _exact_ code you are using?
>cut-and-paste?
yes.
Thanks
------------------------------
Date: 24 Jan 1999 21:16:43 PST
From: "Phlip" <new_email@see.web.page>
Subject: Re: CGI.pm ? How can i install CGI.pm to my Unix server ..t hank
Message-Id: <78gunr$jmt@chronicle.concentric.net>
Penta kathir wrote:
>Hi there
>I would like to install cgi.pm to my unix server ..could you please
tell me
>how can i do it .. thanks in advance ..
It comes with Perl these days. This command should not complain:
perl -e "use CGI;"
If you don't have it, obtain a CGI.bla.bla.tar.gz from www.cpan.org,
tar xfvz it, change into the created directory, and go
perl Makefile.PL
make
make test
make install
Along the way you might want to read all the README and INSTALL
files that these procedures spawn; they'l touch on details that I've
probably skipped.
If you use Win32, get www.activestate.com's Perl, then use PPM to
load binary-compatible pre-compiled modules.
If you get stuck, ask another question of the newsgroup, but this
time include your breed of server and the versions of all your
tools.
-- Phlip at politizen dot com (address munged)
======= http://users.deltanet.com/~tegan/home.html =======
------------------------------
Date: Mon, 25 Jan 1999 16:43:26 +1100
From: David Nillesen <dave@northnet.com.au>
Subject: Re: CGI.pm ? How can i install CGI.pm to my Unix server ..t hank
Message-Id: <36AC047E.A89011FD@northnet.com.au>
Even easier is to install CPAN.
grab the CPAN tar file from www.perl.com somewhere the extract it, run
configure, make and make install and you will have CPAN installed.
then type :
perl -MCPAN -e shell
and be amazed at the command line interface to perl installations.
just typing:
install CGI
will install the latest version of said module.
--
David Nillesen
dave@northnet.com.au
Northnet Internet Services (02)67749300
------------------------------
Date: Mon, 25 Jan 1999 16:11:41 +1100
From: David Nillesen <dave@northnet.com.au>
Subject: Re: Date actions using flatfile database
Message-Id: <36ABFD0D.BBBA014@northnet.com.au>
Just a thought, shouldnt you be using DDMMYYYY for y2k compliancy?
you never know. if you build some amazing script it may be around in the
year 3000 and a quick hack wont fix it :)
--
David Nillesen
dave@northnet.com.au
Northnet Internet Services (02)67749300
------------------------------
Date: Sun, 24 Jan 1999 23:21:51 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Date actions using flatfile database
Message-Id: <MPG.1115bb66cae60c6f9899c0@nntp.hpl.hp.com>
In article <36ABFD0D.BBBA014@northnet.com.au> on Mon, 25 Jan 1999
16:11:41 +1100, David Nillesen <dave@northnet.com.au> says...
> Just a thought, shouldnt you be using DDMMYYYY for y2k compliancy?
> you never know. if you build some amazing script it may be around in the
> year 3000 and a quick hack wont fix it :)
Perhaps you mean 2100, which is marginally more likely than 3000. :-)
But in general a DDMMYY external representation should be unambiguous
for most problem domains.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 25 Jan 1999 01:02:25 -0500
From: "Liam McCusker" <liam_@_unforgettable.com>
Subject: Familiar w/ Soupermail - RE: SMTP return values
Message-Id: <78h1gd$pg4$1@winter.news.rcn.net>
I'm really hoping someone's familiar with SMTP return values as well as the
Soupermail script written by Vittal Aithal. For those not familiar, this is
a script that handles form-mail using SMTP which also allows for PGP
encription and file-attachments.
In this script is a little dubugging feature that allows you to log
everything that the script does from the click on the submit button to the
"thank you" page generation, which is where I'm getting my information
from - more or less.
Here's my problem: I configured the script, set up directories specific to
the way I received the script (minus domain-specific information), and set
permissions to all files/directories. Then, using the index page in the
examples directory, I entered my e-mail address and hit the button. I
received the next page fine (short description of the config file, etc), but
received nothing in my mail-box. I then tried using sendmail, but once
again I received nothing (yet the script seems to have worked - that is, I
received no errors). Upon looking at the debugging log, the only thing I
noticed out of place was the mail server return value which was -2 (-1 for
the sendmail prog). I tried with different SMTP servers (my ISP, the
domain's ISP as well as a couple others I know), but the same thing -
absolutely nothing.
Can anyone tell me what that return value might mean, or at least what they
suspect might be the problem? Please e-mail me when responding as my time
is limited on-line these days. Thanks in advance.
Liam McCusker
lmccusker@dreamsmedia.com
liam@unforgettable.com
------------------------------
Date: Mon, 25 Jan 1999 09:06:27 +0100
From: "Mathias-H. Weber" <Mathias-Henry.Weber@de.heidelberg.com>
To: Julian Daniel <hachon@hotmail.com>
Subject: Re: HELP!! Perl Viewer??
Message-Id: <36AC2603.1BE47AD3@de.heidelberg.com>
Julian Daniel wrote:
>
> Julian Daniel wrote:
>
>
> vielleicht erkldre ich genauer, was ich brauche: ich programmiere ein wenig
> mit perl (cgi-scripts) auf einem unix server im b|ro. ich bin aber ndchste
> woche auf dienstreise und mu_ ein perl-script vor ort weiterentwickeln, und
> dort habe ich kein server mit perl installiert (und kein telnet zugang zu
> meinem dienst-server), so da_ ich "blind" programmieren m|_te, was
> bekannterweise nicht sehr effektiv ist... daher brduchte ich ein tool, um am
> PC wenigstens |berpr|fen zu kvnnen, das die scripts einigerma_en
> funktionieren, wie ich sie haben mvchte...danke (antworten bitte an meine
> email, ich werde ndchste woche kein zugriff haben auf die newsgroups)
>
> may be a background explanation. i have been programming a few in perl (cgi
> scripts) at office where we have a unix server with perl installed. i will
> be next week visiting a customer and developing there a few perl scripts.
> the customer has not a server with perl installed (nor will i have telnet
> access to my office server) so i want a tool for windows95 PC with which i
> can at least test if the scripts i'm developing with the customer do what
> they are supposed to do or if they are at all syntactically correct.
> thanx (please answers per email since i won't have next week access to the
> newsgroups neither)
>
If the missing server is your problem you should deploy the famous
CGI.pm module. You will find it on CPAN. Reading its included
documentation will leave nothing unsaid to overcome your problem.
If not having Perl on your Win95 PC is your problem -- then you have a
real problem!
You could start writing a program capable to interpret perl scripts --
but wait, I have heard of a guy who has tried a similar job before: I
do not remember his name exactly. Something like Leisure Larry -- I only
remember that he spends most of his time skiing ;-)
HTH, Mathias
--
(signature under construction)
Mathias-Henry.Weber@de.heidelberg.com
------------------------------
Date: Mon, 25 Jan 1999 09:02:59 +0100
From: Dennis Wehlmann <Dennis.Wehlmann@brr.de>
Subject: Re: help!?: how to a convert a sting ( "10" ) into a value ( 10 )
Message-Id: <36AC2533.3BD633E@brr.de>
Julian Kuiters wrote:
>
> Can some one tell me how the hell you convert a string to a value?
>
> eg:
> the string: $age = "10"
> and string: $since = "2"
> then if you do: $now = $age + $since
> $now = "102"
>
> what I want it to do is to make $now = 12 (as a number, not a string)
>
> Thanx!
> Julian Kuiters
print $age+$since; # returns 12
print $age.$since; # returns 102
That's the difference.
Regards
Dennis
------------------------------
Date: Mon, 25 Jan 1999 01:02:40 -0500
From: "Joel Tamkin" <jmt16@po.cwru.edu>
Subject: Hi-resolution timing issues
Message-Id: <78h1gq$qv7$1@alexander.INS.CWRU.Edu>
I'm working on a program using the win32-serialport module to read from an
IR (i.e. remote controls) detector. The "carrier detect" is the line that
is "tripped" by incoming IR signals. I'm pretty new to Perl, but I have
been able to get a connection between my program and the port (the Carrier
Detect flag, in particular). The problem is that I can't find any good
timing for these fast signals. I'm not familiar with IR standards, but
since the program is purely for myself, I'm planning on simply multiplying
the time differences between received signals in a burst, and this should
give me distinguishable/repeatable codes for the remotes I'm using. A
couple questions:
A.) Has anyone done this (or very similar) before?
B.) Is there a good built-in method for timing (on the order of
milliseconds) in Perl?
C.) If not, are there any modules/methods for doing this?
I realize that having the device stream the signal in on a Data line would
make more sense (or be more readable, I suppose?) but that's not how it is,
and I'm this far already :)
Joel Tamkin - jmt16@po.cwru.edu
------------------------------
Date: Mon, 25 Jan 1999 01:09:01 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: How to detect an empty hash ?
Message-Id: <alecler-2501990109010001@dialup-508.hip.cam.org>
In article <36ABD540.F24898CF@cardinal.co.nz>, Kelvin Price
<kprice@cardinal.co.nz> wrote:
> Does anyone know of a cute/cool way to check if a hash is empty ?
>
> I know I can compare scalar %hash to /^0\/*/ or scalar (keys %hash) to
> zero, but I was wondering if there was anything cuter/cooler ?
You can simply check whether %hash is true.
if (%hash) {
print "Not empty.\n";
}
else {
print "Empty.\n";
}
Cute enough for you?
Andre
------------------------------
Date: Sun, 24 Jan 1999 21:39:42 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Newbie question: writing file
Message-Id: <MPG.1115a375f3fb41869899bc@nntp.hpl.hp.com>
In article <36AA7550.995EC320@snailgem.org> on Sat, 23 Jan 1999 20:20:16
-0500, Eugene Sotirescu <eugene@snailgem.org> says...
...
> Aha, things are clearer now: is this a CGI script trying to write to a
> file? What matters is not the permissions of the script (which were
> correct to start with, otherwise you wouldn't have gotten as far as that
> error message), but those of the file you're trying to modify.
> You can fix this by making tokens/262805729 (I gather this is the file
> you're trying to modify) world writable, but this of course opens
> another can of worms: anybody with shell access to your server can then
> change this file.
See my response to you in a current thread with a similar subject. It
is not the file's permissions that matter -- it is the directory's
permissions.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sun, 24 Jan 1999 21:51:30 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Non character match?
Message-Id: <MPG.1115a637b7fd8dcf9899bd@nntp.hpl.hp.com>
In article <ebohlmanF603Fs.n2o@netcom.com> on Sat, 23 Jan 1999 06:59:52
GMT, Eric Bohlman <ebohlman@netcom.com> says...
> Namsuk Kim <kimn01@luey.redars.ca.boeing.com> wrote:
> : Is there a simple way to express non-characters and number and few
> : special characters, * and - for matching?
>
> : In other words, !/[A-Za-z0-9*-]/.
Underscore ('_') is illegal.
> print "Illegal character: $1\n" if $field =~ /([^-*\w])/;
Underscore ('_') is not illegal.
Better just use the same set of characters that were specified:
print "Illegal character: $1\n" if $field =~ /([^-*A-Za-z0-9])/;
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 25 Jan 1999 06:53:45 +0100
From: "Familie Elst" <elst.fels@nospam.ping.be>
Subject: Re: ok please don't shoot me for this question
Message-Id: <78h0qd$eh1$1@news3.Belgium.EU.net>
Ok all thanks for your help ;)
Any good perl resources on the web ?
Please post the URL to me ...
thank you,
Peter
P.S. You know Maartien Verbruggen, your name sounds very dutch for someone
in Australia ...
Please don't send me crapy scripts like that
Martien Verbruggen heeft geschreven in bericht ...
>In article <78cme9$rva$1@news3.belgium.eu.net>,
> "Familie Elst" <elst.fels@nospam.ping.be> writes:
>> Ok, is there anybody who can write me a guestbook script without banners
in
>> perl
>> or tell me where I can find it ?
>
>To find someone who can write it: post in one of the job groups, hire
>one of the people responding.
>
>To find it: use the web. Start at www.cgi-resources.com or something
>like that. Use Altavista. Use Yahoo.
>
>> I was trying to write one but my brain has burned out and I really have a
>> deathline.
>
>Hmm.
>
># cat program.pl
>#!/usr/local/bin/perl -w
>use strict;
>
>die "This is it!";
># perl program.pl
>Death found at program.pl line 4.
>
>Martien
>--
>Martien Verbruggen |
>Interactive Media Division | If at first you don't succeed, try
>Commercial Dynamics Pty. Ltd. | again. Then quit; there's no use
being
>NSW, Australia | a damn fool about it.
------------------------------
Date: 25 Jan 1999 05:04:12 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Perl Criticism
Message-Id: <slrn7anuqc.r09.sholden@pgrad.cs.usyd.edu.au>
On Mon, 25 Jan 1999 04:19:57 GMT, topmind@technologist.com wrote:
>In article <slrn7aij5v.9ar.sholden@pgrad.cs.usyd.edu.au>,
> sholden@cs.usyd.edu.au wrote:
>> On Sat, 23 Jan 1999 02:11:27 GMT, topmind@technologist.com wrote:
>> >> It's possible to write unmaintainable code in any language.
>> >
>> >If I hear this flippen' MYTH stated one more time, I am going to
>> >have Norton classify Perl as a virus.
>>
>> OK back that up, what language is it impossible to write unmaintainable code
>> in. Point me to a freely available interpreter/compiler and the language
>> docs and I'm willing to have a crack at the impossible and write some
>> unmaintainable code.
>>
>
>
>You are missing my point. I already had this discussion.
>However....
How am I missing the point?
You say that the statement "It's possible to write unmaintainable code in
any language" is a myth. I take that to mean that you believe it is not
true. There a few definition of myth that I know. I assume you aren't
talking about 'a traditional story accepted as history'. I assume you
aren't talking about 'a story of great but unknown age'. That leaves
(in my dictionary, your's might be bigger (mines cheap...)) 'A person
or thing existing only in imagination, or whose actual existance is
not verifiable'.
That could mean it is not true, or that it has not been verified as true.
I am offering to try to provide more evidence that the statement is true by
showing it to be true in whatever programming language you believe to most
show it is false.
So again I ask point me to a language in which it is impossible for me to
write unmaintainable code. Back up what you say for once.
>
>
>> >
>> >ALL
>> >LANGUAGES
>> >ARE
>> >NOT
>> >EQUALLY
>> >ABUSABLE
>> >!!!!!!!
>>
>> That is not what the post claimed, that is irrelevant.
>>
>> All that should matter is 'does the language make it hard to write
>maintainable
>> code'. If so then don't use the damn language for 'real' code.
>>
>> >I am not going to explain it again.
>>
>> Could you please post a reference to your first explanation... since I
>> for one missed it (this thread is huge and I haven't attempted to read
>> everything in it - thankfully).
>
>
>It has gotten too huge for me also.
>I don't really know of a solution
>Other than fancy software.
Just give me the reference, you must have a copy of the text somewhere, or
at least know a few words you could enter into a dejanews search. My search
in this thread for you posts returns way to many for me to look through them
all - but I don't know any additional words to put in the search. I assume
you do...
>
>
>> But if someone doesn't make an effort to avoid obfuscation (that's the wrong
>> phrase really, should be something along the lines write readable code - the
>> positive not negative version) then they should not be employed as a
>> programmer.
>>
>
>"Should not", yes. "Do not", no.
That is not a problem for the language to solve. That is a problem
for society to solve. If a civil engineer designs a bridge that falls down
and kills a few hundred people, we don't demand that all civil engineers
stop using whatever that engineer used to design said bridge. Instead we
demand that that engineer not design any more bridges until he has shown
that it was not his fault. If he shown his software tool resulted in the
bridge collapse we demand engineers not to use that software product and
recheck everything designed with said product. If it was the way the engineer
used the product we blaim the engineer.
If someone can't write code then they should not be a programmer. Pretty
obvioud really. If they are employed as a programmer then the company
employing them deserves to go out of business. And the other programmers
have the right to find new jobs in a better run company.
>Again, I am middle of the read with regard to readability
>and maintainability. Perlers are to the far right on this.
You believe a language should be made so that it is impossible to do
unreadable things... surely that doesn't put you in the middle. My
observation on what you believe is probably wrong, but that is how
I've interpreted your rants...
>
>
>
[snip bit about making it easy to do good, instead of impossible to do bad]
>
>One is a "top-end" problem and one is a "bottom-end" problem.
>I see them as relatively independant issues.
The problem is that you restrict the good programmers the flexibility to
write good code. But you obviously don't care about this.
--
Sam
You can blame it all on the internet. I do...
--Larry Wall
------------------------------
Date: 25 Jan 1999 06:06:49 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Perl Criticism
Message-Id: <slrn7ao2fp.ssr.sholden@pgrad.cs.usyd.edu.au>
On Mon, 25 Jan 1999 03:44:28 GMT, topmind@technologist.com wrote:
>
[ comments about if 'open(...) || die ...' ]
>
>
>If not open(handle,filename) do die "Cant open $filename$"
>
>Which is not significantly different. "Do" means one
>statement on the same line as a control statement.
>(It was a suggestion, not a instantance.)
That still draws more attention to the error instead of to the opening
of the file.
The 'open(...) || die ...' form of perl makes for very readable code where the
wanted message to the reader is 'open this file (failing is not expected but
if something strange happens then do this...)'.
Whereas your form reads as check the value of this open call and do this if
it is not true. The readers attention is attrcted to the unlikely case.
--
Sam
You are bordering on ridiculous if you think you need to support your
premises. Such an argument is an infinite regression.
--George Reese in <wv0O1.1521$Ge.4809664@ptah.visi.com>
------------------------------
Date: 25 Jan 1999 06:27:01 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Perl Criticism
Message-Id: <slrn7ao3ll.ssr.sholden@pgrad.cs.usyd.edu.au>
On Mon, 25 Jan 1999 03:53:50 GMT, topmind@technologist.com wrote:
>In article <fl_aggie-2401991223510001@aggie.coaps.fsu.edu>,
> fl_aggie@thepentagon.com (I R A Aggie) wrote:
>> In article <78bb49$p3$1@nnrp1.dejanews.com>, topmind@technologist.com wrote:
>>
>> + In article <78a4cl$h97$2@newshost.oracle.co.uk>,
>> + dherriot@uk.oracle.com (Des Herriott) wrote:
>>
>> + > It's possible to write unmaintainable code in any language.
>> +
>> + If I hear this flippen' MYTH
>>
>> Proof, please.
>
>
>Mathematical?
No proof as in evidence to back up your claim. In this case though you can
prove you statement, since the statament you disagree makes a sweeping
claim that it is possible to write unmaintainable code in _all_ programming
languages. You disagree with this, and can prove your case by a simple
contradiction.
Just give us one example of a language in which it is impossible to write
unmaintainable code and you will have proved your case.
I doubt you can though, since you have been asked to do this a few times
now and have refused.
All I can conclude is that instead of saying you disagree with something, you
declared it to be untrue. Now that is fine if you have some proof that it is
false, or even have some evidence to support your case. I have evidence to
support the case that the stamement was true. I can find unmaintainable code
in every language that I can program in. So can all other programmers since it
is not hard to write.
Proof in this case is the same as evidence since you only need one
counter-example. Surely you have one, otherwsie you wouldn't have made such
a statement - since that would be lieing wouldn't it???
Now who were you calling dishonest?
>>
>> + stated one more time, I am going to
>> + have Norton classify Perl as a virus.
>> +
>> + ALL
>> + LANGUAGES
>> + ARE
>> + NOT
>> + EQUALLY
>> + ABUSABLE
>> + !!!!!!!
>>
>> I believe the claim is "unmaintainable code", which is the ultimate
>> abuse.
>>
>> + I am not going to explain it again.
>>
>> Show me a language that makes the programmer use _useful_ variable names.
>> Show me a language that makes the programmer use subroutines and functions.
>> Show me a language that makes the programmer write comments as he goes along.
>> Show me a language that makes the programmer write a manual.
>>
>
>
>These are only SOME of the total different ways to abuse
>a language.
>
>Although I am not much of a Java fan, Java is much tougher to abuse than
>Perl. There are no pointers and it is easy to tell what is
>a function, a variable, an assignment, etc. There is also
>less "hidden communication" between operations.
Java has no pointers, perl has no pointers (that I know of), both have
references, however.
Java doesn't have functions, but that's just a technicality.
And as a side note what does the following java code do :
fred = ted.bill();
What about the following perl code :
@fred = ted->bill();
I can tell more about the perl code... both call a method and return a result,
the perl returns an array. With the java code I'd have to look a few pages
up in the code to find out what type fred is...
>Pascal has similar properties.
>
>(I am not promoting Java and Pascal, only pointing to them
>to help compare.)
>
>How about somebody take that cryptical signiture that
>somebody here keeps posting at the bottom and turn it
>into Pascal or Java. Let's see if they can make it
>equally confusing to reverse engineer.
I suspect that cryptic code in java would take on a different form. I supect
that form would more likely be a large collection of classes with a very
very deep inheritance tree, lots of over-riding, and inner classes everywhere.
Given a method call you couldn't tell what was being called and where without
reading thorugh all the code... This is basically the same problem you have
with C++ when people write stupid code...
Anyway here's a peice of Java code what does it do? Note it isn't actually
hard to work out, since it is very small and I haven't abused the language
(sionce I don't have the docs in front of me or the time to bother)...
class Crap {
protected String Crap;
public static void main(String[] args) {
System.out.println(new Crap(){});
}
public Crap(String Crap) {
this.Crap = Crap;
}
public Crap() {
Crap = new Crap("crap") {
public String toString() {
for (;;) {
try {
return new Crap("a"){}.toString();
}finally{
return new Crap("b"){}.toString();
}
}
}
}.toString();
}
public String toString() {
return Crap;
}
}
So what does it do... how many classes are involved.. how many method calls are
made.. how many objects are created... None of those questions are hard, but
I wouldn't want to have to deal with ten thousand lines of code like the
above...
--
Sam
So I did some research. On the Web, of course. Big mistake...
--Larry Wall
------------------------------
Date: Mon, 25 Jan 1999 00:24:55 -0500
From: "Ivan Pantophlet" <fletdog@bellatlantic.net>
Subject: Pleeeeeassee help!!!
Message-Id: <78gv9o$rj6@world6.bellatlantic.net>
How can I lift a number from an html document that was returned from a cgi
script and post it to a whole other apple soft script somewhere else? Case
in point:
I have a shopping cart that returns a html document that displays a grand
total of a purchase. I want to somehow take that total figure that was
returned and send it to a credit card script for veification and
processing. I was told that I would have to create a script to parse the
document and sent it that way.....man I don't know what the heck to do. I
just wish I could get some help with this.
fletdog@bellatlantic.net
------------------------------
Date: 25 Jan 1999 08:36:06 GMT
From: eric@fruitcom.com (Eric Smith)
Subject: sorting dates
Message-Id: <slrn7aoc37.2d3.eric@plum.fruitcom.com>
Hi Perl
Please forgive me if this question is answered well in the
literature as I have not found the answer yet.
I have a csv which contains a date field and I would like my
script to sort the lines by the date field.
csv ->
29/09/98,this,that,theother
23/09/98,this,that,theother
23/04/98,this,that,theother
TIA
Eric Smith
eric@fruitcom.com
------------------------------
Date: Mon, 25 Jan 1999 01:43:08 -0500
From: "Ronnie D. Jewell" <jewell@OnlineRAGE.com>
Subject: Re: Want to output $29.85 not $29.8585 ya know?
Message-Id: <36AC127C.8DF66676@OnlineRAGE.com>
heres how it is done in Selena's Wb store... hope it helps...
#######################################################################
# format_price #
#######################################################################
# format_price is used to format prices to two decimal
# places. It takes one argumnet, the price to be formatted
# and is called with the following syntax:
#
# $price =&format_price(xxx.yyyyy);
#
# Notice that the main calling routine must assign the
# returned formatted price to some variable for its own
# use.
#
# Also notice that this routine takes a value even if it
# is longer than two decimal places and formats it with
# rounding. Thus, you can utilize price calculations such
# as 12.99 * 7.985 (where 7.985 might be some tax value.
sub format_price
{
# The incoming price is set to a local variables and a few
# wroking local variables are defined.
local ($unformatted_price) = @_;
local ($formatted_price);
# The script then uses the rounding method in EXCEL. If
# the 3rd decimal place is > 4, then we round the 2nd
# decimal place up 1. Otherwise, we leave the number
# alone. Notice that we will use the substr function to
# pull off the last value in the three decimal place
# number and compare it using the EXCEL logic.
#
# Basically, the routine uses the rounding rules of
# sprintf.
# The unformatted_price is rounded to
# to two decimal places and returned to the calling
# routine.
$formatted_price = sprintf ("%.2f", $unformatted_price);
return $formatted_price;
}
Martien Verbruggen wrote:
> In article <36ABBF6C.21F3EEAA@cstone.net>,
> Bill Reid <wer@cstone.net> writes:
> > Hey.
> >
> > I have a simple script that takes some things from a form and then
> > computes the cost.... When I applay a tax (like 0.065) it displays four
> > digits behind the decimal. I just want to truncate the last two
> > digits.... or force two digits past the decimal point. Any suggestions?
>
> truncate? That's a bit nasty, isn't it? Do you mean round? Unless you
> don't cre about all those cents getting lost, you probably do.
>
> # perldoc -q round
> =head1 Found in /usr/local/lib/perl5/5.00502/pod/perlfaq4.pod
>
> =head2 Does perl have a round function? What about ceil() and
> floor()? Trig functions?
>
> For those of you with an older perldoc:
>
> # perldoc perlfaq4
> /round
>
> Martien
> --
> Martien Verbruggen |
> Interactive Media Division | 75% of the people make up 3/4 of the
> Commercial Dynamics Pty. Ltd. | population.
> NSW, Australia |
--
RAGE Enterprises
Ronnie D. Jewell jewell@onlinerage.com
voice: 304-525-1898
http://www.onlinerage.com
------------------------------
Date: 12 Dec 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 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 4740
**************************************