[comp.sources.bugs] a2p and perldb bugs

vqh@drutx.ATT.COM (HoangVQ) (03/01/88)

I tried mailing these to Larry Wall but they keep getting bounced back.
My copy of perl is at patch #23.

========================================================================

a2p bug #1: missing parenthesis after &&

An awk line:
	print $1 > tmpfile
is translated to:
    do Pick('>' . ($tmpfile)) &&
	print $Fld1;
which would cause perl to fail with syntax error.  Adding parentheses
around the print statement would fix it.

========================================================================

a2p bug #2: mishandling of blank lines

A blank line inserted anywhere in the following awk script will cause
a2p either to abort or generate wrong perl code.
--------------------------------------
{	if (NF > 4)
		print "Yes"
	else
		print "No" }
--------------------------------------

========================================================================

perldb bug #1: backslashes are not accepted.

The following script is acceptable to perl but perldb aborts at the \.
--------------------------------------
$var='(abc)';
if ($var =~ /\(/ ) { print "Yes\n"; }
--------------------------------------
-- 
V. Hoang, AT&T Denver, ihnp4!drutx!vqh

lwall@devvax.JPL.NASA.GOV (Larry Wall) (03/02/88)

In article <6860@drutx.ATT.COM> vqh@drutx.UUCP (HoangVQ) writes:
: a2p bug #1: missing parenthesis after &&
: a2p bug #2: mishandling of blank lines
: perldb bug #1: backslashes are not accepted.

Fixed in patch 24.

I've also changed the "standard" location from /bin/perl to /usr/bin/perl.

And I've done as I threatened earlier and added the unary operators:
	-r	File is readable by effective uid.
	-w	File is writeable by effective uid.
	-x	File is executable by effective uid.
	-o	File is owned by effective uid.
	-R	File is readable by real uid.
	-W	File is writeable by real uid.
	-X	File is executable by real uid.
	-O	File is owned by real uid.
	-e	File exists.
	-z	File has zero size.
	-s	File has non-zero size.
	-f	File is a plain file.
	-d	File is a directory.
	-l	File is a symbolic link.

Ambiguous things like $abc-exp($def) should survive--the lexer only returns
a file test if the following character is non-alphabetic.  I just hope you
guys haven't been writing $abc-s/foo/bar/.  :-)

And there's symlink(), for those that can support it.

Sorry, no glob yet.  Haven't figured out the best way to do it.

Larry Wall
lwall@jpl-devvax.jpl.nasa.gov