[10998] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4598 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 8 21:01:09 1999

Date: Fri, 8 Jan 99 18:00:14 -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           Fri, 8 Jan 1999     Volume: 8 Number: 4598

Today's topics:
    Re: "internal server error" <ludlow@us.ibm.com>
        Easy binary file access ? bluepuma@my-dejanews.com
    Re: Gratuitous warnings when statting files with newlin <hniksic@srce.hr>
    Re: Perl Criticism <mds-resource@mediaone.net>
    Re: Perl Criticism dturley@pobox.com
    Re: Perl Criticism (Heath Holcomb)
    Re: Someone asked how to capitalise first letter of eac (Steve Morris)
    Re: using strict with CGI.pm dturley@pobox.com
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 08 Jan 1999 19:14:21 -0600
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: "internal server error"
Message-Id: <3696AD6D.2109D902@us.ibm.com>

Eirik Johansen wrote:
 
> Who wants to learn Perl after feedback like this???
> 
> When one gets a lot of replies one should probably thank for them, but in
> this case, there are few replies to thank for. It's okay to give
> constructive critisism, but very little of this critisism is constructive. I
> agree that my first posting should'be been clearer, but why don't someone
> just say that in a nice way instead of making such a big deal out of how
> stupid I am.

The thing that really irritated me, and I think probably set most people
off in this thread is the part where you asked to have someone else run
your script for you for the simple purpose of debugging.  That's crazy
talk.  The fact is, if you don't have the ability to run your own
scripts, then you'll need this help with everything you ever write. 
That's simply no way to program.  Every script you ever write needs to
be debugged.  Step 1 should be to find a way to get access to perl.

You haven't got Unix?  Ok, so you've got a couple choices.  (1) Get
Unix.  Linux is available for nearly every pc type known right now
(free).  Unless you have something really old, or really obscure, you
can have your own Unix box.  (2) Run a non-native port of perl.  Much
like Linux and hardware, perl is available for nearly every OS you can
name (free).  A lot of my Perl programming is done on Win32, MacOS, or
BeOS.  

It is assumed that people who post to clpm have at least read the perl
docs and the faq.  Asking a question that could be answered by reading
these is like asking everyone to read it for you.  It is considered okay
to post questions involving clarifications of things that you've read. 
"I read this, but this line doesn't make sense.  What's it mean?"  These
types of questions are usually given a warm response.
 
> Before I repost my question, I would like to say something to some of the
> people replying to my message:
> 
> Abigail: What's your problem? Did you actually read my posting? The first
> line goes something like this: "I've just started learning Perl..." Did it
> ever occur to you that I either know what "-w" "use strict" or modules are
> nor do I know how to use them. I'm supposing that modules are some pre-made
> scripts since you say they are "made by people with a clue".(It's probably
> not!) Well, you obviously didn't read the rest of the the first sentence,
> cause it goes something like this: "...and I recently modified a CGI-script"

It considered good manners to read a newsgroup for at least a week
(usually two or more) before posting.  If you had done this, you would
have seen a ton of posts telling people to use -w and "use strict". 
You'd also see references to modules, or .pm files, which are covered in
the recommended reading (docs and faq).
 
> And did it ever occour to you that I might want to "have a clue" myself
> someday? And the only way to leraning this, is by doing it myself !

Of course you do.  Welcome.  Stay and learn.  You just have to be
willing to put in some work ahead of time to read the docs.  Work
through example code.  Learn to use the debugger (-d).  Become one with
Dejanews.  It's all part of being a beginner and coming up the learning
curve.

> I'm eager to learn CGI-scripting - so what if I "don't have the appropriate
> environment to test my work with."? I want to learn it just the same, and I
> will too, you'll see. And that I didn't give you an error message. The only
> error message I can give is in the subject line, you see THAT'S THE PROBLEM.

No.  This is wrong.  This is what, I believe, got everyone worked up. 
The problem is that you don't have any way to run your programs other
than through the browser.  This makes it really, really hard to debug
anything, which you obviously already have found out.  You have to get
access to perl.  It's really easy to do, and it will save you a lot of
time in the long run.

Perl is free and available for nearly every system you can name.  Far
and away the least expensive "appropriate [programming] environment"
available today is a pc running Linux.  A 486 will work just fine, and
you'll have access to perl, gcc, g++, a free web server, etc...  

We already know that your computer can handle news reading.  If it can
handle that, it can handle Perl.
 
> If I had an error msg, I would've worked out the problem myself.

You need perl.
 
> There - that's some constructive critisism for you. Try using it sometime,
> instead of telling people to crawl under a rock (are you sure that your
> daddy allows you to play with the computer?)

And some for you also.  Please take it as such, and not as anything
personal.

Good luck,
-- 
James Ludlow (ludlow@us.ibm.com)
(Any opinions expressed are my own, not necessarily those of IBM)


------------------------------

Date: Sat, 09 Jan 1999 01:42:45 GMT
From: bluepuma@my-dejanews.com
Subject: Easy binary file access ?
Message-Id: <776c6k$7ub$1@nnrp1.dejanews.com>

Hi folks,

I have to analyse a web server log file, but the data was converted into
a binary file using c. Is there an easy way to access the data from perl ?
I'm not that familiar with all the object orientated "->" stuff.

regards   Michael


struct request
{
  unsigned int timestamp;
  unsigned int clientID;
  unsigned int objectID;
  unsigned int size;
  char method;
  char status;
  char type;
  char server;
};

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: 09 Jan 1999 02:10:04 +0100
From: Hrvoje Niksic <hniksic@srce.hr>
Subject: Re: Gratuitous warnings when statting files with newlines
Message-Id: <kigogo9w8sz.fsf@jagor.srce.hr>

I've now removed the warning using this code at the beginning of the
application:

$SIG{__WARN__} = sub
  { ($_[0] =~ /^Unsuccessful .* on filename containing newline/s)
      || warn $_[0]; };

However, grepping through textual error messages seems enormously
kludgy.  I wish there were a way to say something like
$WARNING{FILENAME_NEWLINE} = 0;


------------------------------

Date: Fri, 08 Jan 1999 19:15:43 -0600
From: "Michael D. Schleif" <mds-resource@mediaone.net>
Subject: Re: Perl Criticism
Message-Id: <3696ADBF.A44DBA60@mediaone.net>

O, do I feel a breeze?

topmind@technologist.com wrote:
> 
> Where are you getting *your* definition of "scripting" from?
> Is there a Department of Definitions in the World Trade Center?
< snip >
> You provided no clean cutoff point either. I am not sure
> exactly what your complaint is. You have no formal source
> of info nor opinion surveys to bash my definition of
> scripting. You are unarmed in your attack of my def.

And, your definition is delineated where?  Unfortunately, arbitrary
example *do not* a definition make ;)

> Since I have no Poor-O-Meter (either do you), it is only an opinion.
> I have never seen language builders publish in the public domain
> a list of reasons, trade-offs, considerations, etc. of why they
> picked what they did for the final version.
< snip > 
> No, but I am not being selfish by hiding away the decision
> process so that the next language maker has to start from
> scratch and repeat the same mistakes.

And, perl5-porters is a private club, excluding lower class riff-raff
like me?  Believe me, if I can lurk therein, anybody can }:-^

> Sometimes they
> say "I was influenced by a mix of X, Y, and Z." However, X, Y, and
> Z themselves never went thru such a process. Thus, bad ideas are
> taken from other's bad ideas.
< snip >
> They focus too narrowly on a few specimens. They make insufficent
> attempts to step back and look at the forest before disecting trees.

I believe that Mr. Hegel called this `historical dialectic.'  You may
have heard of it?
  thesis
  antithesis
  synthesis

> Unix tends to use what I call "command piping" where the
> results of operation A get fed into operation B, and
> B's results go to C, etc.
< snip >
> One can also look at it as an operator that returns
> or feeds to an array. The distinction is probably trivial in Perl.

Please, illuminate me, why is it that you ignore the variety of
historical texts (Knuth, et al.) in favor of an arbitrary labeling
scheme of your own?  Those who have labored to create a credible
treatise are aware of a need to develop a reasonable naming schemata and
use same in construction of persuasive argument.  I'm sure you have
heard of human speech and common discourse?  Again, communicating a
useful point is often, in and of itself, reason enough to speak ;)

> If it satisfies your trivia gland, I will footnote my article
> (which is not intended to be a Perl lesson anyhow).

What, then, is your intent?  Yes, lip service we have seen; but, nary a
coherent point!

> You seem too obsessed with history to evaluate my suggestions
> on their merit. History claims are only about 8% of my
> article. Why are you dwelling on this 8%. Your alleged
> corrections to my Perl examples are useful (as they may
> help me clarify some of my wording to prevent future
> misinterpretation.) However, dwelling
> on history

Remarkably, it *has* sufficed for maybe fifty thousand years !!!

> or non-formal definitions will get us
> nowhere.

That, dear toplessmind, is precisely your most serious flaw.  Please,
summarize and enumerate your points in an orderly, coherent manner -- it
is called communication . . .

> Until you can find a better collection of freely available
> lists and evaluation of langauge implimentation options,
> you have very little room to criticize me.

O, I get it!  At last, the point !?!?  Ooo, I am *so* diappointed -- I
thought that this was leading to something substantive, and now I find
that this is only a `freely available list!'  And, here, I thought that
scouring terabytes of sniffer output had the absolutely *lowest* ROI. 
No, you, dear bottomfeeder, have now that dubious distinction!

Please, have a good life counting your 0's and 1's . . .

-- 

Best Regards,

mds
mds resource
888.250.3987

"Dare to fix things before they break . . . "

"Our capacity for understanding is inversely proportional to how much we
think we know.  The more I know, the more I know I don't know . . . "


------------------------------

Date: Sat, 09 Jan 1999 01:19:54 GMT
From: dturley@pobox.com
Subject: Re: Perl Criticism
Message-Id: <776aro$6q5$1@nnrp1.dejanews.com>

In article <775olp$m66$1@nnrp1.dejanews.com>,
  topmind@technologist.com wrote:

> I just ran this example:
>
> $a = 5;
> print "before " . $a . "\n";
> mysub();
> print "after " . $a;
>
> sub mysub {
>     $a = 2;
>     mysub2();
> }
>
> sub mysub2 {
>   $a = 99;
> }
>
> An here is the output:
>
> before 5
> after 99
>
> Where did the 99 come from if each sub did not inherit the variable
> scope of it's parent?

I think you are confusing piss-poor programming practices with language
shortcomings. Your posts have had one good result. Reading them makes me feel
like a damn-good programmer!
____________________________________
David Turley
dturley@pobox.com
http://www.binary.net/dturley/

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: Sat, 09 Jan 1999 00:29:53 GMT
From: holcojh5@REMOVEMEwfu.edu (Heath Holcomb)
Subject: Re: Perl Criticism
Message-Id: <3697a0de.342220857@enews.newsguy.com>

On Thu, 07 Jan 1999 23:31:50 GMT, topmind@technologist.com wrote:


>
>Perhaps there is no sharp dividing line, but one can still make a dichotomy.
>Your statement is like saying, "There are no such thing as short people
>because there is no clear dividing line."
>
>Scripting languages are not *optimized* for:
>
>1. Fast applications like 3D graphics.
>
>2. Critical military and medical applications.
>
>3. Building a big commercial OS and/or interpreter.
>
>4. Building mass-distribution applications like wordprocessing.
>

It seems odd to categorize languages based on their applications when
what you're talking about is design and syntax. There are many
examples of languages that aren't *optimized* for any of these things,
but yet I doubt anyone would consider them scripting languages.
Prolog, MATLAB, and LISP, for example.

See Tom Christiansen's post (or any of a hundred others) on this. I'm
not going to reiterate it because this point has already been beaten
to death.

>>> [Unnecessary deviations from the "function rule".]
>This seems like an effort to codify something that is more a matter of taste
>than anything else. <<
>
>I gave 3 criteria why the function rule is important. (Simpler language,
>easier to document, easier to learn). If you disagree, I challenge you to
>give higher- ranking criteria or reasons. Criticism is easy, supplying
>alternatives is the hard part.
>

My problem is not necessarily with the rule but with the way you're
applying it. We're talking about consistency versus ease of use and
again, this depends on which you value more. Both have benefits, both
have drawbacks. It's up to the language designer to strike a balance.

>>> Perl's parameter passing takes a little getting used to, but I see no real
>problem with it. <<
>
>1. Very tough to mix arrays and scalars unless you have only one array at the
>end of the list.
>

Not true. References are easy to use. See perlsub and perlref. Just
because you're unfamiliar with the way something works doesn't mean
it's broken.

>2. "Getting used to" means it is tougher to learn, with little benefits in
>return.
>

Again, I don't buy your logic here. Someone who has never used
anything but C is likely to think that a functional language like LISP
(which you apparently consider to be a "scripting language") takes
some "getting used to."  It's a different design philosophy. That
doesn't mean that there aren't benefits to learning it. 

It took me 20 minutes to figure out Perl's parameter passing. Any
reasonably intelligent person is not going to have a problem with it. 


>>> ["Leaky" assignment statements] Again, a matter of taste. <<
>
>It's all a matter of taste, but at least I am attempting to evaluate different
>"tastes". Leaky assignments create several rough spots in a language. Their
>risks outweigh the benefits IMO.
>

Fine. My opinion is different. What I'm pointing out is that you're
equating a problem in language design with a disagreement on what
amounts to a difference in taste. This is a convenient, easily
understood, and well documented feature that has been used extensively
in many popular languages. It has also been debated extensively and a
reasonable argument can be made either way. 

>>> Using default arguments (which I think is what you mean by "command piping")
>
>is optional. If you think it makes your code hard to read, then don't do it.
><<
>
>Optional = stupid programmers will overuse it and stick SOMEBODY ELSE with the
>mess! Hit and run programming.
>

You're arguing philosophy, not pointing out a flaw in Perl. Part of
the Perl philosophy (and UNIX, for that matter) is not to design
things for the lowest common denominator, a consideration you're
tacitly assuming here. If you want to design a language targeted at
stupid programmers, then by all means do so. It seems like a waste of
time to me. It would be simpler to fire them or train them properly.

>>> If you're going to post something like this here, you *really* need to make
>sure you've done your homework first. <<
>
>You have not pointed out a single factual error on my part. (I am sure they
>exist, but not rampant.)
>

I noticed that you conveniently snipped the factual error that I did
bother to point out.

Had what you posted to the newsgroup contained specific factual
statements, I might have done so more. As it is, I didn't want to
waste bandwidth dissecting an 80k web page, particularly since much of
it is only vaguely on topic anyway. See Tom Christiansen's post for
some of what I could have said. 

>Keep trying.
>

What's the point? I've spent enough time on this. I'm through.

Heath

--
Heath Holcomb                 * They don't know what to call it
holcojh5@REMOVEMEwfu.edu      * but they all say it's wrong
http://www.wfu.edu/~holcojh5/ * Well, I don't see no greener pastures
delete REMOVEME to email      * This must be where I belong


------------------------------

Date: 9 Jan 1999 01:22:13 GMT
From: morris@rahul.net (Steve Morris)
Subject: Re: Someone asked how to capitalise first letter of each word
Message-Id: <776b05$ial$1@samba.rahul.net>

This one will work if you agree with Perl's definition of the start of a
word.

#!/usr/bin/perl -w
while(<DATA>){
        s/\b(\w)/\U$1/g;
        print;
}


__DATA__
Here is some stuff
on a couple of  lines
'hello there'

steve ( perhaps with these words capitalized also )




------------------------------

Date: Sat, 09 Jan 1999 01:27:37 GMT
From: dturley@pobox.com
Subject: Re: using strict with CGI.pm
Message-Id: <776ba7$78e$1@nnrp1.dejanews.com>

In article <775oa0$9cp$1@remarQ.com>,
  "Xah Lee" <xah@web-central.net> wrote:

> Yes. I ALWAYS use strict. CGI.pm is not very well designed, and its author
> apparently isn't a "strict nut" like I am. However, you can use CGI.pm with
> use strict while still using the functional interface. I've been doing
> exactly that for several months.
>
> There isn't any special thing you must do. One thing comes to mind is
> quotes, i.e. use '-name'=>... instead of -name=>... .

Huh? I use strict with CGI.pm all the time, always use the function-oriented
syntax, and I've never used quotes like that. There must be another reason why
strict is failing for you. The only "problem" I've found is that use
CGI::Carp(fatalsToBrowser); produces a warning with -w.
____________________________________
David Turley
dturley@pobox.com
http://www.binary.net/dturley/

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

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 4598
**************************************

home help back first fref pref prev next nref lref last post