Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Perl Bugs and Comments

2 views
Skip to first unread message

tch...@sushi.uucp

unread,
Feb 24, 1988, 1:14:00 PM2/24/88
to

I've compiled perl after applying all 22 of Larry's patches, and have
written a few programs that use it. In the course of writing these,
I've discovered two possible bugs and several peculiarities. I'm
going to outline them here for discussion, rather than just mailing lwall.
First, though, I want to say that I *like* perl. It's something I've
wanted for a long time, and I sincerely want to take my hat off to
Larry for it. So don't take these as gripes, but constructive
comments.


A pair of bugs:

A) $! is always 25 (ENOTTY), regardless of what I've just done.
The documentation says it should contain "the current value
of errno, with all the usual caveats". I think I understand how
things interract with errno, but I can't explain this one.

B) Certain kinds of variable references misbehave when imbedded in a
string:

"this $#ARGV in a string" prints "this ARGV in a string"
"this $_[$i] in a string" prints "this <whole line>[i] in a string"

where <whole line> is the current input record; others are literals.


Now for some things that are sadly lacking:

1) There is no perror() mechanism. I would like to be able to say
die "$file: $SYSERR[$!]" unless open(fd,$file);

2) There is no mechanism for internal file globbing. Saying
@manfiles = split(' ',`ls /usr/man/man?/$arg.* 2> /dev/null`);
is such an overkill -- plus I must check $? as the bourne shell
returns the unglobbed string if it makes no match.

3) It would be nice if $ENV{'SHELL'} would be honored for `evals`.

4) There is no mechanism for "if" tests, like -e, -x, -w, -d, ...
Using the `eval` mechanism is clumsy, inefficient, and sometimes
impossible. For example,

if ( `if [ -e a* 2> /dev/null ]; then echo 1; fi` ) {

will succeed for just ONE a* file, not zero or more than one.

5) I wish I didn't have to use two statements for this:
$hours = $_[3];
$hours =~ s/:.*//;
I would like to say
$hours = $_[3] =~ s/:.*//;
but in this context, perl says it's is a pattern-compare and returns
one or zero.

6) You can link but not symlink; if you're a BSD system this should be
possible.

7) I've had trouble with the array/scalar notation, as well as not
always being certain whether to use a $ or @ at all. I've always
worked it out, but it's somehow not very intuitive. Has anyone else
had this problem?


--tom

Tom Christiansen
CONVEX Computer Corporation

UUCP: ...{ihnp4,uiucdcs,ut-sally,sun}!convex!tchrist (america)
UUCP: ...{mcvax!{nlcvx,inria}!cvxfr,connie,eurodem}!convex!tchrist (europe)
ARPA: convex!tch...@sally.utexas.edu

BELL: (214) 952-0447 (office)

0 new messages