[12191] in Perl-Users-Digest
Perl-Users Digest, Issue: 5791 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 26 14:07:56 1999
Date: Wed, 26 May 99 11:01:30 -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, 26 May 1999 Volume: 8 Number: 5791
Today's topics:
Re: Perl "constructors" (Kai Henningsen)
Re: Perl "constructors" dhenders@cpsgroup.com
Re: Perl "constructors" zenin@bawdycaste.org
Re: Perl compiler...If or when <bradw@newbridge.com>
Re: PERLFUNC: y/// - transliterate a string <cassell@mail.cor.epa.gov>
Please help ? tvn007@my-deja.com
Re: Return of array <kensai@nortel.com>
Re: Timeout question (My code is included)... <aqumsieh@matrox.com>
Re: Want to create a auto login script <cassell@mail.cor.epa.gov>
Re: why doesn't my first program work?? (ok , third or <tchrist@mox.perl.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 26 May 1999 09:39:00 +0200
From: kaih=7H$kml8Xw-B@khms.westfalen.de (Kai Henningsen)
Subject: Re: Perl "constructors"
Message-Id: <7H$kml8Xw-B@khms.westfalen.de>
emschwar@rmi.net (Eric The Read) wrote on 24.05.99 in <xkfn1yuh2lv.fsf@valdemar.col.hp.com>:
> kaih=7HPvvhDXw-B@khms.westfalen.de (Kai Henningsen) writes:
> > emschwar@rmi.net (Eric The Read) wrote on 21.05.99 in
> > <xkfvhdmgjy4.fsf@valdemar.col.hp.com>:
> >
> > > And there's *still* no way to automatically die on an uncaught
> > > exception.
> >
> > Huh? I must not be getting something here. How do you not die on an
> > uncaught die()? Seems a contradiction to me.
>
> #!/usr/bin/perl -w
>
> eval { die "ack!"; };
>
> print "returning normally\n";
> exit 0;
That's a *caught* die(). Catching is what eval does.
> Since eval is perl's version of try, I'd expect the uncaught die() in
> there to propogate upward, and cause a die() in the outer program-- if it
> were really an exception. Since it's not really an exception, it doesn't
> require a catch (or, in the case of Perl, a "if($@) {...}".
That doesn't make much sense to me.
Oh, wait. You seem to think that in the traditional "try ... except ... "
syntax, "try" and "except" are two independant constructs. This seems
silly to me; the "except" is a part of the "try" IMHO. In languages with
the traditional "try ... except ..." syntax, you usually *can't* do a try
without the except (let's forget about "try ... finally ..." here :-)).
So, if eval{} means try, then there must be an except in there even if you
don't see it. And it is; it handles every exception by doing nothing.
You might say that the Perl way has a built-in default handler.
I think it may be better to think of this along the lines of the typical
catch-throw syntax, instead of the try/except-raise syntax.
Kai
--
http://www.westfalen.de/private/khms/
"... by God I *KNOW* what this network is for, and you can't have it."
- Russ Allbery (rra@stanford.edu)
------------------------------
Date: Wed, 26 May 1999 17:17:19 GMT
From: dhenders@cpsgroup.com
Subject: Re: Perl "constructors"
Message-Id: <7ihaas$2g6$1@nnrp1.deja.com>
Even though my newsfeed is down and I have to use Deja :(
I can't resist replying to this one.
(btw anyone know how i can use Deja.com as a newsfeed for Gnus)
In article <7hsnkp$rso$1@nnrp1.deja.com>,
armchair@my-dejanews.com wrote:
> In article <7hrosq$6vj$1@nnrp1.deja.com>,
> John Porter <jdporter@min.net> wrote:
> >
> > Oh, records. As I said elsewhere -- You have the source code.
>
> Stand back. Here come's Earl.
>
Let me guess,
Earl = Extraction And Report Language.
So your going to take Perl (= Practical Extraction and Report Language)
and remove the practical part?
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: 26 May 1999 17:34:54 GMT
From: zenin@bawdycaste.org
Subject: Re: Perl "constructors"
Message-Id: <927740249.63564@localhost>
John Porter <jdporter@min.net> wrote:
: In article <927680311.575832@localhost>,
: zenin@bawdycaste.org wrote:
>snip<
:> In practice, this is not a problem.
:
: No, in practice, it is extremely much of a problem, particularly
: for those of us who are used to using CGI::Carp.
:
: Hmm, I *thought* I threw Exception::Mine->new( @problems ),
: but what I caught was:
: [Wed May 26 09:49:26 1999] jamaica.cgi: Exception::Mine=HASH(0xc6e30) at
: ./jamaica.cgi line 102.
You explicitly use a module who's primary, if not single purpose for
existing is to override die() and friends, and you're surprised when
you find it actually does?
--
-Zenin (zenin@archive.rhps.org) Caffeine...for the mind.
Pizza......for the body.
Sushi......for the soul.
-- User Friendly
------------------------------
Date: 26 May 1999 12:39:45 -0400
From: bj <bradw@newbridge.com>
Subject: Re: Perl compiler...If or when
Message-Id: <op1btf7bx9q.fsf@newbridge.com>
Ala Qumsieh <aqumsieh@matrox.com> writes:
> Greg Bartels <gbartels@xli.com> writes:
>
> > My reason for wanting a compiler would be that someone could
> > run my program without having any perl stuff installed.
>
> Fair enough.
>
> > perl is not yet a universal language, and I have people at
> > work who have not installed perl on their PC's because
> > its too much work. We have no system administrator.
> > and we're an engineering company...
>
> Installing Perl is too much work? Who told you so? On Winblows, it is
> completely automated, and takes around 15 minutes. On *nix, it's
> almost completely automated (unless you have some weird OS which no
> one has heard of) and takes around the same time.
While the heavyweights in the Perl community see this as a perfectly
reasonable answer, in the some production environments it is not. Greg
mentioned he works in an engineering company. So do I and am
responsible for providing a CAD environment to many remote sites... it
has to work, it has to be turnkey, it has to be absolutely braindead
to install. We use perl and perltk a fair bit. We ship a prebuilt
perl tree as part of our environment as that is the only way we can
guarantee that the desired version of perl with all the modules we
require will be available, in a place that we can find.
Also, in response to your assertion that building perl is trivial... I
would respectfully disagree. On a standard config of Solaris it is
trivial, on Win95 (using the activestate build) is is easy, on HP-UX
it can be a pita (especially the Tk stuff) as the OS ships without a
real compiler, and without a full set of X11 libs. Once you have
acquired the libraries and built a proper set of tools, it is trivial
but for an non 'nix literate person it will take a lot longer than 15
minutes.
We also have some standalone tools. For these it would be very nice to
be able to compile these so that we did not have to worry about
providing an appropriate perl tree.
To make your solution work, we have to ensure that all sites build and
maintain a perl install to our specifications, and still have to
verify versions and module availability in all the programs. With a
"captive" install we know our programs will work. With a compiler we
could decide if it makes more sense to supply the perl tree or just
provide a compiled program.
Not having library paths statically built in would also be nice. (and
yes I know that I have the source and could fix it but I don't have
the time or currently the knowledge set to do so).
There are problem spaces where a having a perl compiler would be a
very good thing, which have nothing to do with hiding source code.
bj
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
bradw@newbridge.com Newbridge Networks Corporation
Brad Warkentin 600 March Road, Kanata, Ontario K2K 2E6
CAE Architect (613) 599-3600 ext. 6117 FAX: 599-3654
------------------------------
Date: Wed, 26 May 1999 10:57:58 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: Tom not Gnat <perlfaq-suggestions@perl.com>
Subject: Re: PERLFUNC: y/// - transliterate a string
Message-Id: <374C3626.780B5FFF@mail.cor.epa.gov>
Tom Christiansen wrote:
>
> [snip of header]
>
> NAME
> y/// - transliterate a string
>
> SYNOPSIS
> y///
>
> DESCRIPTION
> The transliteration operator. Same as `tr///'. See the perlop
> manpage.
s/transliterat/translat/;
As one of the Erinyes who relentlessly pursued Larry Rosler on
this subject last month, I vote for changing this in the Perl
docs. This seems to be the only place I can find the [mis]use
of 'transliteration' to describe this function.
But if you can convince me that the action of tr/// when
working with utf8 actually constitutes a transliteration
instead of a translation, I will return to the Underworld,
taking Tisiphone with me. :-)
David (but since you know me so well, you can call me Alecto)
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Wed, 26 May 1999 17:43:35 GMT
From: tvn007@my-deja.com
Subject: Please help ?
Message-Id: <7ihbs7$3j9$1@nnrp1.deja.com>
Hi,
Would someone please help me on this ?
I have the input file as follow: (just small sample )
DATA X Y Z
A B C;
N100 xyz 10X
011;
N10 xyz X01
000;
N12 xyz 000
001;
I would like the ouput as follow:
DATA X Y Z A B C;
N100 xyz 10X011;
N10 xyz X01000;
N12 xyz 000001;
Here is my solution, but it does not work:
while (<INFILE>) {
print OUTFILE ($_\n");
}
Thanks in advance for your help !
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: Wed, 26 May 1999 12:54:02 -0400
From: digital kensai <kensai@nortel.com>
To: kensai@bellsouth.net
Subject: Re: Return of array
Message-Id: <374C2729.325F4A53@nortel.com>
John Porter wrote:
> Sorry Mr. Kensai, YHO is incorrect.
This isn't personal. Don't get upset. -- I was saying something looks
clearer to me (thus "in My humble opinion", rather than taking some
viewpoint like "mine is the one true way" -- kind of like perl in general,
don't ya think?). Anyways, I trust implicitly that you do know exactly
what you are saying -- in fact, I could really use some help with my code,
all in the ooPerl thread, would you mind helping me learn?
-- I'm not saying you are wrong, that what I wrote is not an array slice.
But the behavior of variables in perl isn't what I was trying to
demonstrate -- I don't care if @{$x}->[0] == @$x->[0] == @$x[0], or not,
because I'm not trying to show that at all. I'm trying to show that I got
a valid 'handle' on my array, in the variable $arrayref...
> Any time there is an arrow, the thing on the LHS is a reference
> (except when it's a package name). Understanding this,
> $arrayref->[0] NEVER implies, to anyone familiar with Perl refs,
> that $arrayref is the array.
okay... hmmm, I see where you are coming from. At this point I am sure we
are talking about apples and oranges.
I am trying to show that this is possible; I want to be clear. I should
get the reference, and use it to show that I have gotten it. I never said
;
print @{$arrayref}->[0]; # the variable printed is the zeroth element of
the array
... instead I said ;
print @{$arrayref}->[0]; # prints 1
which is exactly correct -- perl should read the array slice and return
its values (since print works on a list). So let's lay that to rest. The
question is, what visual symbols are best at showing (1) the use of (2) an
array?
I do not maintain these truths to be self-evident. They apply to me (ie,
IMHO):
1: things like 'print' are perfect... you show people who have no knowledge
of computers or languages at all the basic concepts of variables and the
like with functions like 'print'. Since almost everyone who programs knows
what print is, and what to expect next, it is visually clear.
2: I don't know about anyone else, but when I'm scanning an unfamiliar page
of code for arrays, I always look first for the '@' symbol and the '[', ']'
symbols. Sure, the names of previous arrays, and other symbols, are clues
I use too, but these are the building blocks, the fundimentals I look for;
and further, when I see '@', I think array. Visually clear code
demonstrating the use of an array should have an @ symbol.
I'm not saying it was the most visually clear of all possible examples,
either. I was simply trying for that goal. Grok? Cool, so let's move on
to other questions posted (like mine). :)
> Remember also that the arrow is optional when it's between levels of
> a multi-level data structure dereference; and idiomatic Perl says
> to leave it out in these cases. So @{$arrayref}->[0] is just (ugly)
> long-hand for @{$arrayref}[0] -- which, as has already been mentioned,
> is inappropriate unless you specifically want a slice.
(in short: I never said I couldn't use a slice. print doesn't demand
non-slices, and neither does my example)
>
> --
> John Porter
> Put it on a plate, son. You'll enjoy it more.
>
> --== Sent via Deja.com http://www.deja.com/ ==--
> ---Share what you know. Learn what you don't.---
------------------------------
Date: Wed, 26 May 1999 11:33:06 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Timeout question (My code is included)...
Message-Id: <x3yvhdfyhfx.fsf@tigre.matrox.com>
"Vincent M. Padua" <vpadua@home.com> writes:
> time them out after X seconds and return them to the prompt where they
> must type hi again.
perldoc perlfaq8:
How do I timeout a slow event?
perldoc -f alarm
perldoc perlipc
HTH,
Ala
------------------------------
Date: Wed, 26 May 1999 10:40:15 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Want to create a auto login script
Message-Id: <374C31FF.D431CEB8@mail.cor.epa.gov>
Dipak Chowdhury wrote:
>
> Hi:
> I would like to run a program that lets me loginto a system and
> automatically provide username and password. Can I automate that with
> Perl in NT 4.0 environment? If so, any example will be appreciated.
Well, without more info, it sounds like you want to work with
Net::Telnet, which will let you do just that. There are plenty
of examples in the documentation that comes with the module.
But be aware of some basic problems with telnetting in NT
environments. Here's a quote straight from the Net::Telnet
documentation that will tell you the two major ones:
| By default, Windows machines don't come with a TELNET service.
| However, third party TELNET servers can be acquired to provide
| access to a DOS shell. As is all too familiar, many of these
| servers are of inferior quality.
| One particularly nasty problem is a server that sends ANSI
| terminal escape sequences despite being told not to. These
| escape sequences make your job of parsing the data much more
| difficult. You can sometimes avoid this with a server that
| prompts you for console mode. Choose no to console mode.
Good luck,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 26 May 1999 10:07:05 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: why doesn't my first program work?? (ok , third or something)
Message-Id: <374c1c29@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc, Scratchie <upsetter@ziplink.net> writes:
:Um, maybe because it's his *first* friggin' program?? Are you really that
That part failed to register. I'll send him a private note.
:PS: What's "obvious" about using ".pl" instead of some other suffix to
:represent a perl library?
+---------------------------------------------------------------+
| p l perl p l perl p l perl p l |
| e i library e i library e i library e i |
| r b r b r b r b |
| l r l r l r l r |
| a perl a perl a perl a |
| r library r library r library r |
| y y y y |
+---------------------------------------------------------------+
--tom
--
The computing field is always in need of new cliches. -- Alan Perlis
------------------------------
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 5791
**************************************