[8967] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2585 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 13 17:10:24 1998

Date: Wed, 13 May 98 14:00:41 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 13 May 1998     Volume: 8 Number: 2585

Today's topics:
    Re: a header for `Mail me copies' or `Do not mail me co (John Stanley)
    Re: a header for `Mail me copies' or `Do not mail me co (John Stanley)
        character echo (Cameron Lampley)
    Re: character echo <rra@stanford.edu>
    Re: character echo <tchrist@mox.perl.com>
        Code fragment not working (Help!?!) (Paul Hounshell)
    Re: Code fragment not working (Help!?!) <rra@stanford.edu>
    Re: collapse string <ludlow@us.ibm.com>
    Re: Cross-Platform 4-box Perl "Sharing" (John Porter)
    Re: Does Perl have a IDE?I don't like command line. (I R A Aggie)
    Re: Does Perl have a IDE?I don't like command line. (Ilya Zakharevich)
    Re: Does Perl have a IDE?I don't like command line. <tchrist@mox.perl.com>
    Re: Does Perl have a IDE?I don't like command line. <tchrist@mox.perl.com>
    Re: Does Perl have a IDE?I don't like command line. (Michael J Gebis)
    Re: Does Perl have a IDE?I don't like command line. <tchrist@mox.perl.com>
    Re: Does Perl have a IDE?I don't like command line. <rra@stanford.edu>
    Re: Does Perl have a IDE?I don't like command line. <tchrist@mox.perl.com>
    Re: Does Perl have a IDE?I don't like command line. (John Porter)
    Re: Does Perl have a IDE?I don't like command line. (Greg Bacon)
    Re: Does Perl have a IDE?I don't like command line. (John Porter)
    Re: eval doesn't catch exit in custom die (John Porter)
    Re: How can you break out of a 'while... ' loop in a fu <tchrist@mox.perl.com>
        how to add debug-only code without speed penalty [semi- (John Klassa)
    Re: how to add debug-only code without speed penalty [s (Ilya Zakharevich)
    Re: newbie question: handling errors <barnett@houston.Geco-Prakla.slb.com>
        OO perl and speed rdosser@my-dejanews.com
    Re: Perl compiler: does it work <tchrist@mox.perl.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 13 May 1998 19:17:38 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: a header for `Mail me copies' or `Do not mail me copies' (was Re: Ever Wonder Why Not Everyone Uses Modules?)
Message-Id: <6jcrki$o0t$1@news.NERO.NET>

In article <tb4syufost.fsf@blue.sea.net>,
Jari Aalto  <<jari.aalto@poboxes.com> wrote:
>| Please provide an RFC reference that defines this header for news.
>
>It's convention started and suggested by Lars. 

Oh, okay. That makes it a standard. Yes? If it was suggested by Lars, by
bother with the standards process? That's good enough for me.

>Just like you won't find
>the de facto signature separator "\n-- \n" anywhere from the RFCs.

That's right. And that is why I subtract points from anyone who talks
about the "standard signature separator". 

>This snipped is from Procmail Tips page at:
>ftp://cs.uta.fi/pub/ssjaaa/pm-tips.html
>
>jari
>
>    30.6 Mail-Copies-To header
>
>        [Suggested by Lars, the Author of Emacs Gnus]
>
>        ...Mail-Copies-To: is a header line used in messages on
>        Usenet to direct copies by email of followups to posts.

It is a header used in an attempt to direct copies. It does no such
thing anyplace I read news. It has no standard meaning.

>        A followup in a conforming client should generate in the response
>        message headers:

Conforming to what? There is no standard here to conform to.



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

Date: 13 May 1998 19:10:31 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: a header for `Mail me copies' or `Do not mail me copies'
Message-Id: <6jcr77$npn$1@news.NERO.NET>

In article <19980513.123722.9L1.rnr.w164w@locutus.ofB.ORG>,
Russell Schulz  <Russell_Schulz@locutus.ofB.ORG> wrote:
>> Oh, you mean proposal that Jamie Zawinski extracted from the more
>> complete proposal I wrote that dealt with the entire issue of mail-news
>> integration? But then I assume you know that and are just being dense.
>
>no, I hadn't particularly noticed your name in the acknowledgements,
>but it is there.

Yes, it is.

>where is your fuller proposal?

It was last seen on the mailnews-l mailing list. 

>>>> Please provide an RFC reference that defines this header for news.
>>>
>>> I can't.
>
>I put that on a line by itself so that I could tempt you into quoting
>it out of context.

When you put it on a line by itself, you defined the context. It's
called a "paragraph". Maybe you missed class the day they explained what
those are. As it stands, I quoted your entire paragraph. If that does
not lend enough context to your statements, perhaps you need to take a
composition class.

If, however, you are confused by the "context", I suggest you get a
threading newsreader, and thus you can study the context all on your
own, without my having to quote your entire article to keep you happy.




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

Date: 13 May 1998 20:00:20 GMT
From: cgl@acpub.duke.edu (Cameron Lampley)
Subject: character echo
Message-Id: <6jcu4k$e8$1@news.duke.edu>

    Does anyone know how to read in a password from stdin without echoing
characters to the screen?

Cameron


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

Date: 13 May 1998 13:09:08 -0700
From: Russ Allbery <rra@stanford.edu>
To: cgl@acpub.duke.edu (Cameron Lampley)
Subject: Re: character echo
Message-Id: <m3yaw6orvf.fsf@windlord.Stanford.EDU>

[ Posted and mailed. ]

Cameron Lampley <cgl@acpub.duke.edu> writes:

> Does anyone know how to read in a password from stdin without echoing
> characters to the screen?

perldoc -f crypt reveals:

[...]

Here's an example that makes sure that whoever runs this program knows
their own password:

    $pwd = (getpwuid($<))[1];
    $salt = substr($pwd, 0, 2);

    system "stty -echo";
    print "Password: ";
    chop($word = <STDIN>);
    print "\n";
    system "stty echo";

    if (crypt($word, $salt) ne $pwd) {
	die "Sorry...\n";
    } else {
	print "ok\n";
    }

Of course, typing in your own password to whoever asks you
for it is unwise.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 13 May 1998 20:16:39 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: character echo
Message-Id: <6jcv37$c3k$10@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    cgl@acpub.duke.edu (Cameron Lampley) writes:
:    Does anyone know how to read in a password from stdin without echoing
:characters to the screen?

Yes: I do.  

That's why it's in the standard documentation set, and the FAQs.

--tom
-- 
    "Even egotists are allowed to have opinions." --Larry Wall


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

Date: Wed, 13 May 1998 19:40:04 GMT
From: phounsh@ucdavis.edu (Paul Hounshell)
Subject: Code fragment not working (Help!?!)
Message-Id: <3559f3d0.181338134@news.ucdavis.edu>

OK, I really do not get this.  My If statement does not seem to be
working.  Line numbers are for reference and the Font used was MS Sans
Serif (8Pt) in case it doesn't display right.


Script Fragment
-------------------------

1	open(CREDIT_LIST_IN, "Credits.dat");
	while (eof(CREDIT_LIST_IN) != 1)
	      {
		$record1 = "";
5		$NextChar = getc(CREDIT_LIST_IN);
		while ($NextChar != ">")
		    {
			$record1 = "$record1$NextChar";	
			$NextChar = getc(CREDIT_LIST_IN);
10		    }
		print "\nRecord1 = $record1\n";

		$NextChar = getc(CREDIT_LIST_IN);
		if ($NextChar == "G")
15		    {
			$record2 = -1;
			getc(CREDIT_LIST_IN);
		    }
		elsif ($NextChar == "X")
20		    {
			$record2 = -2;
			getc(CREDIT_LIST_IN);
		    }
		else
25		    {
			$record2 = "";
			while ($NextChar != "<")
			    {
				$record2 = "$record2$NextChar";
				$NextChar = getc(CREDIT_LIST_IN);
30			    }
		    }
		getc(CREDIT_LIST_IN);
		print "\nRecord2 = $record2\n";
	    }
35	close(CREDIT_LIST_IN);


Script Comments
--------------------------
1 	# Open Credit File for Input
4	# Clear for the Next Copy of the Record
7	# Append characters until a '>'
11	# debugging to test result of Record1
13	# Second half of record
14	# Test for a 'G' or 'X' to determine a flag
24	# If not A or G, do same as Record1 until '<'
35	# Close Credit File (In)


Input File (Credits.dat)
----------------------------------
123>G<
124>15<
125>X<
126>12345<


Actual Output		Intended Output		Problems
----------------------		--------------------------
---------------
Record1 = 123		Record1 = 123

Record2 = -1		Record2 = -1

Record1 = 124		Record1 = 124

Record2 = 15		Record2 = 15

Record1 = 125		Record1 = 125

Record2 = -1		Record2 = -2		*** ERROR ***

Record1 = 126		Record1 = 126

Record2 = 12345	Record2 = 12345


>From what I've been able to understand, lines 19-23 do not ever run.
When "X" is found (and it is found), it runs through the section for
"G" (lines14-18).  If anyone knows something that I am forgetting,
please let me know as I am stumped.  If it matters, I am running Perl
5 on a Win95 machine.

Thank you very much,

	-Paul Hounshell
	phounsh


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

Date: 13 May 1998 13:13:47 -0700
From: Russ Allbery <rra@stanford.edu>
To: phounsh@ucdavis.edu (Paul Hounshell)
Subject: Re: Code fragment not working (Help!?!)
Message-Id: <m3u36uorno.fsf@windlord.Stanford.EDU>

[ Posted and mailed. ]

Paul Hounshell <phounsh@ucdavis.edu> writes:

> 		$NextChar = getc(CREDIT_LIST_IN);
> 		if ($NextChar == "G")
> 15		    {
> 			$record2 = -1;
> 			getc(CREDIT_LIST_IN);
> 		    }
> 		elsif ($NextChar == "X")
> 20		    {


Your problem is that you're using numeric equality to check the equality
of two strings.  For the purposes of ==, "G" == "X" == 0 because it
converts the string to a number first.

You want to use eq instead.

BTW, for future reference, this post was actually given a negative score
by my killfile and if I hadn't been looking for more posts because I felt
like answering a question, I never would have seen it.  That was due to
the "help!" in the subject line, which is generally a sign of a poorly
written subject line.  Something like "if comparison not doing what I
expect" would have been a better subject, would have given me a better
idea of what to look for in your code to solve your problem, and probably
would have meant more people would have read your post.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Wed, 13 May 1998 13:54:25 -0500
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: collapse string
Message-Id: <3559EC61.E580B067@us.ibm.com>

Kimron Yossi wrote:
> 
> Please , How can i collapse strings in perl .
> 
> example :
> 
> my string is 'c:\temp\my_file        '
> and i need to get it like this 'c:\temp\my_file'

The FAQ is your friend.

http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html#How_do_I_strip_blank_space_from_

You'll probably want to read the docs on "regex" or "regular
expressions" while you're at it.

-- 
James Ludlow (ludlow@us.ibm.com)
This isn't tech support, and all opinions are my own.


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

Date: Wed, 13 May 1998 19:24:38 GMT
From: jdporter@min.net (John Porter)
Subject: Re: Cross-Platform 4-box Perl "Sharing"
Message-Id: <MPG.fc3bf22f70cb3e99896b8@news.min.net>

On 13 May 1998 17:08:31 GMT,
in article <6jck2f$url$1@netnews.upenn.edu>,
siler@compstat.wharton.upenn.edu (Jack Siler) wrote:
>
> In retrospect this all seems straightforward to the point of
> triviality but I hadn't seen it in the newsgroup.  

Why would you see it in this newsgroup?
This sort of thing has been absolutely mundane for many years
in networked computing.
Still, it can be exciting when you see it for the first time.

John Porter


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

Date: Wed, 13 May 1998 15:00:53 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <fl_aggie-1305981500530001@aggie.coaps.fsu.edu>

In article <3559D169.66F5E089@order.booktraders.com>, Birgitt Funk
<birgitt@order.booktraders.com> wrote:

+ Thank you very much for the answer. It is the second advice I get
+ regarding picking PASCAL to learn programming with.

You're welcome. The only draw back to pascal, and I didn't mention
this, but it is rather important, is that it is mostly a useless
language. At least AFAIK. Maybe you should ask how big the pascal
code base is in the pascal.misc newsgroup?

Alternatively, there's Ada. From what I've been told, its even more
anal-retentive about pre-declaring everything you do than pascal. And
some people have told me Ada is actually good for somethings...

James - what, I'm still not completely sure...

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>


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

Date: 13 May 1998 19:06:24 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6jcqvg$rf1$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Chip Salzenberg
<chip@mail.atlantic.net>],
who wrote in article <6jbjco$v56$1@cyprus.atlantic.net>:
> According to ilya@math.ohio-state.edu (Ilya Zakharevich):
> >Chip Salzenberg <chip@mail.atlantic.net:
> >> According to ilya@math.ohio-state.edu (Ilya Zakharevich):
> >> >(grep is absolutely useless unless you know how deep you
> >> >need to search) if I need to lookup DOCs.
> >> 
> >>  1.  sh$  find /usr/man -type f -print | xargs grep FOO
> >>  2.  zsh$ grep FOO /usr/man/**/*(.)
> >
> >Yet another proof of my point.  One cannot use Perl docs on *nix
> >without fluency with (4 in your examples) other tools.
> 
> Ilya, why exaggerate?  

I *was not* exaggerating.  I even skipped two problems with your
approach: you need to know the absolute path to Perl manpages, and you
need to be able to read raw *roff.

> It helps you not.  The examples I give there
> require knowing grep and either zsh or find+xargs, so the tool counts
> are either two or three, never four.

Correct.  So it it not 4, it is 3.  So what?  Still not a solution for
a Joe Perl Programmer.

> Besides, if your man system works, then you just "man -k" and it's
> easy.  The zsh approach, or the find+xargs approach, is needed only if
> your system has a really stupid "man" command installed.

I did not *see* working man in my life (on the systems I was using)
(unless I spend endless time installing tom's man and making it work).

> The key here is that text files can be searched with whatever tool(s)
> you find convenient and appropriate.  "Book" files (or other formats)
> can be accessed only with special-purpose tools like VIEW.EXE.  I know
> which I'd prefer to have around.

As I explained, what you (or me) prefer is not relevant.  We are
discussing documentation, and documentation should be accessible to
uninitiated too.

Since VIEW.EXE supports only simplest RE, I need to perform something
like

	pfind f:/perllib/man '=~ /\btie.*\bvariable/s'

time to time too.  Having online book does not *prohibit* advanced
usage of docs.

Ilya


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

Date: 13 May 1998 19:54:14 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6jctp6$c3k$1@csnews.cs.colorado.edu>

In comp.lang.perl.misc, 
    Birgitt Funk <birgitt@order.booktraders.com> writes:
:Thank you very much for the answer. It is the second advice I get
:regarding picking PASCAL to learn programming with.

And here's one saying that Pascal is a bad language.  Read BrianK's paper
for why.  Or Larry's (or my?) words about why the whole loop/function
exit thing is a crock.  As a language, Pascal is an unrealistic pain in
the butt.

--tom
-- 
    Besides, REAL computers have a rename() system call.    :-)
                    --Larry Wall in <7937@jpl-devvax.JPL.NASA.GOV>


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

Date: 13 May 1998 19:54:51 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6jctqb$c3k$2@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    fl_aggie@thepentagon.com (I R A Aggie) writes:
:The only draw back to pascal...

Only one?  My God, there are many.  See bwk.

--tom
-- 
There are still some other things to do, so don't think if I didn't fix
your favorite bug that your bug report is in the bit bucket.  (It may be,
but don't think it.  :-)  Larry Wall in <7238@jpl-devvax.JPL.NASA.GOV>


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

Date: 13 May 1998 19:55:16 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6jctr4$r7i@mozo.cc.purdue.edu>

gbacon@cs.uah.edu (Greg Bacon) writes:
}In article <6jadad$65k@mozo.cc.purdue.edu>,
}	gebis@albrecht.ecn.purdue.edu (Michael J Gebis) writes:
}: I never claimed the language should
}: change, or be dumbed-down, in any way.

}The very act of exposing Perl's pristine beauty to the unappreciative,
}unthinking, and, hence, unworthy clueless droves of lose32 users is
}dumbing down the language.

I was going to respond to this with something like "The cat is already
out of the bag.  Guess what?  You can try to hide perl from Win users
all you want, but they've already _seen_ it.  It's time to stop trying
to fight a battle you lost a long time ago.  Instead, it's time to do
whatever is necessary to spoon-feed the documentation to them so they stop
wasting time and bandwidth."

Like I said, I was going to respond with that, but then you went and
said:

}I'll say it again: there's nothing in the world stopping the subunix
}users from writing their own IDE complete with a really spiffy help
}system and floating yellow boxes and colored syntax and whatever other
}bloat they want to throw in.  If having such software is so vital and
}necessary, please go implement it; the world will thank you.

I think this means you've decided that perhaps IDEs might have value
and the mere existence of one might not be such a categorically bad
thing.  To be overly clear about things, I never demanded or even
asked that you or anybody ever write an IDE; I just thought that the
concept was dismissed too quickly for an idea that has some merit.

Apparently, you now agree with me.  

-- 
Mike Gebis  gebis@ecn.purdue.edu  mgebis@eternal.net


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

Date: 13 May 1998 19:57:57 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6jcu05$c3k$4@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    Greg Bacon <gbacon@cs.uah.edu> writes:
:The very act of exposing Perl's pristine beauty to the unappreciative,
:unthinking, and, hence, unworthy clueless droves of lose32 users is
:dumbing down the language.  

A man who doesn't fear calling a spade a spade -- or a CP/M user,
as the case may be.  Bravo.

See http://www.salon1999.com/21st/feature/ for more on this.

--tom
-- 
Personally, I don't care whether someone is cool enough to quote Doug
Gwyn--I only care whether Doug Gwyn is cool enough to quote. --Larry Wall


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

Date: 13 May 1998 13:03:15 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <m34syuq6po.fsf@windlord.Stanford.EDU>

Tom Christiansen <tchrist@mox.perl.com> writes:

> And here's one saying that Pascal is a bad language.  Read BrianK's
> paper for why.  Or Larry's (or my?) words about why the whole
> loop/function exit thing is a crock.  As a language, Pascal is an
> unrealistic pain in the butt.

Pascal is simple.  Yes, there are things you can't do in Pascal that you
want to do in a real programming language.  The fact that you can't do
them in Pascal means that there's less of Pascal to learn.  It's a
*teaching* language.

Maybe I'm old-fashioned, but I still think that the idea of a teaching
language is a good one, and that teaching students a full-blown real
language with all its idiosyncracies and complications right off the bat
is a bad idea.  All programmers know that once you have a good grasp on
the basics of one programming language, learning more is trivial.

Pascal teaches basic block structure and decomposition.  LISP teaches you
how to think of things in terms of lists rather than in terms of variables
and introduces functional thinking.  I'd never write a real application in
either language, but I'm *very* glad I learned them both and I think
knowing both makes me a considerably better programmer than if I tried to
learn how to program with C or Java or Perl.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 13 May 1998 20:15:53 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6jcv1p$c3k$9@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    gebis@albrecht.ecn.purdue.edu (Michael J Gebis) writes:
:It's time to stop trying
:to fight a battle you lost a long time ago.  

Back to the old sit back and accept your violation notion again.
Don't be silly.  We don't have to enjoy being screwed.

:Instead, it's time to do
:whatever is necessary to spoon-feed the documentation to them so they stop
:wasting time and bandwidth."

Nope.   Send the babies to playschool.

--tom
-- 
    "That which does not kill me makes me stranger." --Larry Wall


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

Date: Wed, 13 May 1998 20:42:47 GMT
From: jdporter@min.net (John Porter)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <MPG.fc3d16f6fe16eae9896bb@news.min.net>

On 13 May 1998 19:55:16 GMT,
in article <6jctr4$r7i@mozo.cc.purdue.edu>,
gebis@albrecht.ecn.purdue.edu (Michael J Gebis) wrote:
> ... Instead, it's time to do
> whatever is necessary to spoon-feed the documentation to them so they stop
> wasting time and bandwidth."

Does not compute.
Spoon-feeding the documentation IS a waste of time and bandwidth.
By doing it, we're complicit in the misuse of the ng bw, rather
than resistant to it, as we ought to be.

John Porter



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

Date: 13 May 1998 20:48:07 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6jd0u7$go7$2@info.uah.edu>

In article <m34syuq6po.fsf@windlord.stanford.edu>,
	Russ Allbery <rra@stanford.edu> writes:
: Maybe I'm old-fashioned, but I still think that the idea of a teaching
: language is a good one, and that teaching students a full-blown real
: language with all its idiosyncracies and complications right off the bat
: is a bad idea.  All programmers know that once you have a good grasp on
: the basics of one programming language, learning more is trivial.

There's no rule that says you can't teach your students to increment the
value bound to a variable with code like

    i = i + 1;

Certain subsets of C or Perl would make nice teaching languages IMHO.

Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: Wed, 13 May 1998 20:50:30 GMT
From: jdporter@min.net (John Porter)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <MPG.fc3d343bbd036b9896bc@news.min.net>

On 13 May 1998 13:03:15 -0700,
in article <m34syuq6po.fsf@windlord.Stanford.EDU>,
rra@stanford.edu (Russ Allbery) wrote:
> 
> Pascal is simple.  Yes, there are things you can't do in Pascal that you
> want to do in a real programming language.  The fact that you can't do
> them in Pascal means that there's less of Pascal to learn.  It's a
> *teaching* language.
>...
> Pascal teaches basic block structure and decomposition....

Pascal teaches some good things.  

Its notion of scoping is tons better than C; it's as simple as 
necessary, without omitting anything essential.

One thing Pascal has that I always wished for in C is nesting
of function/procedure declaration scopes.  Even in perl this
is a kludge, since the difference between a normal (top-level)
sub and a local sub is not transparent.

I would prefer never to have to program in Pascal for a living,
but I believe it is more than adequate as a teaching language.

If Pascal Considered Inadequate, then how do Modula-2/Modula-3/Oberon
stack up as teaching languages?  

John Porter




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

Date: Wed, 13 May 1998 19:14:03 GMT
From: jdporter@min.net (John Porter)
Subject: Re: eval doesn't catch exit in custom die
Message-Id: <MPG.fc3bca79eef67af9896b7@news.min.net>

On Wed, 13 May 1998 12:59:11 GMT,
in article <355a98e4.2831823@news.tornado.be>,
bart.mediamind@tornado.be (Bart Lateur) wrote:
> 
>...
> "die" isn't caught! It remains fatal!
> 
> The only way around this (that I found), is to clear $SIG{__DIE__} in
> the eval blok:
>...
> 
> Question: is there another way to terminate a __DIE__ sub, that is NOT
> fatal in eval? "die" doesn't die in eval, but ONLY if you didn't set
> $SIG{__DIE__} yourself (even outside of the eval block). Surely, this
> can't be the way it's supposed to be?

Well, that's the way it is.  Your __DIE__ sub said exit, so exit.
eval doesn't catch exits.

What you want to do is die in your __DIE__ sub, not exit.
The doc says that in this case, the builtin die is called, so
as to prevent an infinite recursion.

hth,
John Porter


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

Date: 13 May 1998 20:01:26 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How can you break out of a 'while... ' loop in a function?
Message-Id: <6jcu6m$c3k$5@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, "Igor Krivokon" <igor.k@usa.net> writes:
:Afair, Pascal *has* next, break and return. No redo, though.

It certainly never used to.  You must be talking about one 
of the non-standard Pascals, or a new standard.

That still doesn't address bwk's complaints.

--tom
-- 
    Although the Perl Slogan is There's More Than One Way to Do It, I hesitate
    to make 10 ways to do something.  :-)
            --Larry Wall in <9695@jpl-devvax.JPL.NASA.GOV>


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

Date: 13 May 1998 18:49:03 GMT
From: klassa@aursgh.aur.alcatel.com (John Klassa)
Subject: how to add debug-only code without speed penalty [semi-long]
Message-Id: <6jcpuv$qlf$1@aurwww.aur.alcatel.com>

I've been reading Steve Maguire's _Writing Solid Code_, a book on writing
solid C code.  Intrigued by some of his ideas, I was trying to figure
out how to add "debug-only" code to my perl scripts -- code which might
make catching bugs a little easier during development, but which needs to
disappear in production.  He makes liberal use of #ifdef DEBUG / #endif to
accomplish this in the book...

I realize that the -P flag tells perl to run the script through the C
preprocessor before compilation, but that seems a little cheesy. :-)
I was curious as to how much of a delay is incurred by something like:

	if ($DEBUG)
	{
	    # do something meaningful here
	} 

I decided to test the extreme case first, to see if perl would optimize it
away.  That is, to my thinking, something that *ought* to be optimized away
is:

	if (0)
	{
	    # do something meaningful here
	}

Since there's no way the "if" test should ever pass, period, I figured that
perl would get rid of it during compilation.  Seemingly, not so.

    use Benchmark;

    timethese(10000, {
	'with' => sub { my $foo;
			for (my $idx = 0; $idx < 1000; $idx++)
			{
			    if (0)
			    {
				if ($foo > 2000)
				{
				    print STDERR "Error!\n";
				}
			    }
			    ++$foo;
			}
		    },
	'without' => sub { my $foo;
			   for (my $idx = 0; $idx < 1000; $idx++)
			   {
			       ++$foo;
			   }
		       }});

results in:

    Benchmark: timing 10000 iterations of with, without...
	  with: 30 secs (27.77 usr  0.01 sys = 27.78 cpu)
       without: 28 secs (26.68 usr  0.00 sys = 26.68 cpu)

under 5.004_03.  That is, there *is* a slight slowdown...

Have others attempted to insert code that's only used during development?
If so, did you go the -P route?  Thoughts/experiences appreciated.

Thanks,
John

-- 
John Klassa / Alcatel Telecom / Raleigh, NC, USA <><


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

Date: 13 May 1998 19:17:57 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: how to add debug-only code without speed penalty [semi-long]
Message-Id: <6jcrl5$s7m$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to John Klassa
<klassa@aur.alcatel.com>],
who wrote in article <6jcpuv$qlf$1@aurwww.aur.alcatel.com>:
>     use Benchmark;
> 
>     timethese(10000, {
> 	'with' => sub { my $foo;
> 			for (my $idx = 0; $idx < 1000; $idx++)
> 			{
> 			    if (0)
> 			    {
> 				if ($foo > 2000)
> 				{
> 				    print STDERR "Error!\n";
> 				}
> 			    }
> 			    ++$foo;
> 			}
> 		    },
> 	'without' => sub { my $foo;
> 			   for (my $idx = 0; $idx < 1000; $idx++)
> 			   {
> 			       ++$foo;
> 			   }
> 		       }});
> 
> results in:
> 
>     Benchmark: timing 10000 iterations of with, without...
> 	  with: 30 secs (27.77 usr  0.01 sys = 27.78 cpu)
>        without: 28 secs (26.68 usr  0.00 sys = 26.68 cpu)
> 
> under 5.004_03.  That is, there *is* a slight slowdown...

Try it with _64.  I think I optimized away one NULL opcode which was
left by 1 in

     1 while FOO;

This patch may have removed also the NULL opcode which is left by 
     if (0) {FOO}

May not...  Hope this helps,
Ilya


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

Date: Wed, 13 May 1998 13:26:35 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: newbie question: handling errors
Message-Id: <3559E5DB.FE847C5A@houston.Geco-Prakla.slb.com>

Scott Stark wrote:
> 
> Can anyone tell me a good source for learning how to handle errors in a perl
> script? That is, if a routine fails, do this or that, etc. (other than just
> "die"). I looked in the FAQ but the only mention of errors is "Error checking
> is left as an exercise for the reader." Whew!
Well, if
open (FH,"myfile") or die "Couldn't open myfile: $!\n";

works, why wouldn't you wonder if:
open (FH,"myfile") or handle_error("Couldn't open myfile: $!\n");

sub handle_error {
    $errorMsg = shift;
    print "You silly person:  $errorMsg\n";
    # do whatever you want here!
}
	

should work???

Is that what you had in mind?

HTH.

Dave

-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

----------------------------------------------------------------------
Dave Barnett                 U.S.: barnett@houston.Geco-Prakla.slb.com
DAPD Software Support Eng    U.K.: barnett@gatwick.Geco-Prakla.slb.com
----------------------------------------------------------------------


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

Date: Wed, 13 May 1998 20:25:49 GMT
From: rdosser@my-dejanews.com
Subject: OO perl and speed
Message-Id: <6jcvkd$7cp$1@nnrp1.dejanews.com>

In man perltoot, Tom refers a couple of times to the speed of OO perl - that
direct hash lookups are an order of magnitude faster than method lookup, and
"if you wanted fast, you wouldn't be using objects at all." Can anybody point
me to a resource expanding on that? I want to know more about the tradeoffs.

Thanks,
Ralph Dosser

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: 13 May 1998 20:03:02 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl compiler: does it work
Message-Id: <6jcu9m$c3k$6@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    Rick Meldrum <rjk@fprsdev3.fmr.com> writes:
:    a) reduce the time this script takes to run, and

You won't do that.  You would only reduce compile time.

:    b) provide a slightly more secure "entry point" into our systems.

Security through obscurity, eh?  That's not very helpful.

:So I am still curious if the compiler will help, or if it is better left
:as a toy (like the FAQ says)???

Yup.

--tom
-- 
    I don't believe it's written in Perl, though it probably
    ought to have been.  :-)
	--Larry Wall in <1995Feb21.180249.25507@netlabs.com>


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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 V8 Issue 2585
**************************************

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