|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Subject: added eval {}
Subject: eval 'stuff' now optimized to eval {stuff}
This set of patches doesn't have many enhancements but this is
one of them. The eval operator has two distinct semantic functions.
First, it runs the parser on some random string and executes it.
Second, it traps exceptions and returns them in $@. There are times
when you'd like to get the second function without the first. In
order to do that, you can now eval a block of code, which is parsed
like ordinary code at compile time, but which traps any run-time
errors and returns them in the $@ variable. For instance, to
trap divide by zero errors:
eval {
$answer = $foo / $bar;
};
warn $@ if $@;
Since single-quoted strings don't ever change, they are optimized
to the eval {} form the first time they are encountered at run-time.
This doesn't happen too often, though some of you have written things
like eval '&try_this;'. However, the righthand side of s///e is
evaluated as a single-quoted string, so this construct should run
somewhat faster now.
Subject: added sort {} LIST
Another enhancement that some of you have been hankering for.
You can now inline the sort subroutine as a block where the
subroutine name used to go:
@articles = sort {$a <=> $b;} readdir(DIR);
Subject: added some support for 64-bit integers
For Convexen and Crayen, which have 64-bit integers, there's
now pack, unpack and sprintf support for 64-bit integers.
Subject: sprintf() now supports any length of s field
You can now use formats like %2048s and %-8192.8192s. Perl will
totally bypass your system's sprintf() function on these. No,
you still probably can't say %2048d. No, I'm not going to
change that any time soon.
Subject: substr() and vec() weren't allowed in an lvalue list
Subject: extra comma at end of list is now allowed in more places (Hi, Felix!)
Subject: underscore is now allowed within literal octal and hex numbers
Various syntactic relaxations. You can now get away with
(substr($foo,0,3), substr($bar,0,3)) = ('abc', 'def');
(1,2,3,)[$x];
$addr = 0x1a20_ff0b;
Subject: safe malloc code now integrated into Perl's malloc when possible
To save a bunch of subroutine calls. If you use your system's
malloc it still has to use wrappers.
Subject: added support for dbz
By saying "make dbzperl" you can make a copy of Perl that can
access C news's dbz files. You still have to follow the dbz rules,
though, if you're going to try to write a dbz file.
Subject: there are now subroutines for calling back from C into Perl
Subject: usub/curses.mus now supports SysV curses
More C linkage support. I still haven't got Perl embeddable, but
we're getting there. That's too big an enhancement for this
update, in which I've been trying to stick to bug fixes, with some
success.
Subject: prepared for ctype implementations that don't define isascii()
A larger percentage of this update consists of code to do
consistent ctype processing whether or not <ctype.h> is 8-bit
clean.
Subject: /$foo/o optimizer could access deallocated data
Subject: certain optimizations of //g in array context returned too many values
Subject: regexp with no parens in array context returned wacky $`, $& and $'
Subject: $' not set right on some //g
Subject: grep of a split lost its values
Subject: # fields could write outside allocated memory
Subject: length($x) was sometimes wrong for numeric $x
Recently added or modified stuff that you kind of expect to be
a bit flaky still. Well, I do...
Subject: passing non-existend array elements to subrouting caused core dump
Subject: "foo" x -1 dumped core
Subject: truncate on a closed filehandle could dump
Subject: a last statement outside any block caused occasional core dumps
Subject: missing arguments caused core dump in -D8 code
Subject: cacheout.pl could dump core from invalid comparison operator
Subject: *foo = undef coredumped
Subject: warn '-' x 10000 dumped core
Subject: index("little", "longer string") could visit faraway places
A bunch of natty little bugs that you wouldn't generally run into
unless you're trying to be coy.
Subject: hex() didn't understand leading 0x
It wasn't documented that it should work, but oct() understands 0x,
so why not hex()? I dunno...
Subject: "foo\0" eq "foo" was sometimes optimized to true
Subject: eval confused by string containing null
Yet more holdovers from the time before Perl was 8-bit clean.
Subject: foreach on null list could spring memory leak
Subject: local(*FILEHANDLE) had a memory leak
Kind of slow leaks, as leaks go. Still...
Subject: minimum match length calculation in regexp is now cumulative
More substitutions can be done in place now because Perl knows
that patterns like in s/foo\s+bar/1234567/ have to match a
certain number of characters total. It used to be on that
particular pattern that it only knew that it had to match at
least 3 characters. Now it know it has to match at least 7.
Subject: multiple reallocations now avoided in 1 .. 100000
You still don't want to say 1 .. 1000000, but at least it will
refrain from allocating intermediate sized blocks while it's
constructing the value, and won't do the extra copies implied
by realloc.
Subject: indirect subroutine calls through magic vars (e.g. &$1) didn't work
Subject: defined(&$foo) and undef(&$foo) didn't work
Subject: certain perl errors should set EBADF so that $! looks better
Subject: stats of _ forgot whether prior stat was actually lstat
Subject: -T returned true on NFS directory
Subject: sysread() in socket was substituting recv()
Subject: formats didn't fill their fields as well as they could
Subject: ^ fields chopped hyphens on line break
Subject: -P didn't allow use of #elif or #undef
Subject: $0 was being truncated at times
Subject: forked exec on non-existent program now issues a warning
Various things you'd expect to work the way you expect, but
didn't when you did, or I did, or something...
Subject: perl mistook some streams for sockets because they return mode 0 too
Subject: reopening STDIN, STDOUT and STDERR failed on some machines
Problems opening files portably. So what's new?
Subject: cppstdin now installed outside of source directory
Subject: installperl now overrides installer's umask
People who used cppstdin for the cpp filter or who had their
umask set to 700 will now be happier. (And Configure will now
prefer /lib/cpp over cppstdin like it used to. If this gives
your machine heartburn because /lib/cpp doesn't set the symbols
it should, write a hints file to poke them into ccflags.)
Subject: initial .* in pattern had dependency on value of $*
An initial .* was optimized to have a ^ on the front to avoid retrying
when we know it won't match. Unfortunately this implicit ^ was
paying attention to $*, which it shouldn't have been.
Subject: certain patterns made use of garbage pointers from uncleared memory
Many of you saw this as a failure in t/op/pat.t.
Subject: perl now issues warning if $SIG{'ALARM'} is referenced
Since the book mentions "SIGALARM", I thought we needed this.
Subject: solitary subroutine references no longer trigger typo warnings
You can now use -w (more) profitably on programs that require
other files. I figured if you mistype a subroutine name you'll
get a fatal error anyway, unlike a variable, which just defaults
to being undefined.
Subject: $foo .= <BAR> could overrun malloced memory
Good old-fashioned bug.
Subject: \$ didn't always make it through double-quoter to regexp routines
Subject: \x and \c were subject to double interpretation in regexps
Subject: nested list operators could miscount parens
Subject: sort eval "whatever" didn't work
Syntactic misfeatures of various sorts.
Subject: find2perl produced incorrect code for -group
Subject: find2perl could be confused by names containing whitespace
Subject: in a2p, split on whitespace produced extra null field
Translator stuff.
Subject: new complete.pl from Wayne Thompson
Subject: assert.pl and exceptions.pl from Tom Christiansen
Subject: added Tom's c2ph stuff
Subject: getcwd.pl from Brandon S. Allbery
Subject: fastcwd.pl from John Basik
Subject: chat2.pl from Randal L. Schwartz
New contributed stuff. Thanks!
(Not that a lot of the other stuff isn't contributed too...)
Subject: debugger got confused over nested subroutine definitions
Subject: once-thru blocks didn't display right in the debugger
Subject: perldb.pl modified to run within emacs in perldb-mode
Debugger stuff. The first two were caused by not saving line
numbers at exactly the right moment.
Subject: documented meaning of scalar(%foo)
I also updated the Errata section of the man page.
Subject: various portability fixes
Subject: random cleanup
Subject: saberized perl
Type casts, saber warning message suppression, hints files and various
metaconfig fiddlehoods.
|
|
You now have the capability of linking C subroutines into a
special version of perl. See the files in usub/ for an example.
There is now an operator to include library modules with duplicate
suppression and error checking, called "require". (makelib has been
renamed to h2ph, and Tom Christiansen's h2pl stuff has been included
too. Perl .h files are now called .ph files to avoid confusion.)
It's now possible to truncate files if your machines supports any
of ftruncate(fd, size), chsize(fd, size) or fcntl(fd, F_FREESP, size).
Added -c switch to do compilation only, that is, to suppress
execution. Useful in combination with -D1024.
There's now a -x switch to extract a script from the input stream
so you can pipe articles containing Perl scripts directly into perl.
Previously, the only places you could use bare words in Perl were as
filehandles or labels. You can now put bare words (identifiers)
anywhere. If they have no interpretation as filehandles or labels,
they will be treated as if they had single quotes around them.
This works together nicely with the fact that you can use a
symbol name indirectly as a filehandle or to assign to *name.
It basically means you can write subroutines and pass filehandles
without quoting or *-ing them. (It also means the grammar is even
more ambiguous now--59 reduce/reduce conflicts!!! But it seems
to do the Right Thing.)
Added __LINE__ and __FILE__ tokens to let you interpolate the
current line number or filename, such as in a call to an error
routine, or to help you translate eval linenumbers to real
linenumbers.
Added __END__ token to let you mark the end of the program in
the input stream. (^D and ^Z are allowed synonyms.) Program text
and data can now both come from STDIN.
`command` in array context now returns array of lines. Previously
it would return a single element array holding all the lines.
An empty %array now returns 0 in scalar context so that you can
use it profitably in a conditional: &blurfl if %seen;
The include search path (@INC) now includes . explicity at the
end, so you can change it if you wish. Library routines now
have precedence by default.
Several pattern matching optimizations: I sped up /x+y/ patterns
greatly by not retrying on every x, and disabled backoff on
patterns anchored to the end like /\s+$/. This made /\s+$/ run
100 times faster on a string containing 70 spaces followed by an X.
Actual improvements will generally be less than that. I also
sped up {m,n} on simple items by making it a variant of *.
And /.*whatever/ is now optimizaed to /^.*whatever/ to avoid
retrying at every position in the event of failure. I fixed
character classes to allow backslashing hyphen, by popular
request.
In the past, $ in a pattern would sometimes match in the middle
of the string and sometimes not, if $* == 0. Now it will never
match except at the end of the string, or just before a terminating
newline. When $* == 1 behavior is as before.
In the README file, I've expanded on just how I think the GNU
General Public License applies to Perl and to things you might
want to do with Perl.
The interpreter used to set the global variable "line" to be
the current line number. Instead, it now sets a global pointer
to the current Perl statement, which is no more overhead, but
now we will have access to the file name and package name associated
with that statement, so that the debugger soon be upgraded to
allow debugging of evals and packages.
In the past, a conditional construct in an array context passed
the array context on to the conditional expression, causing
general consternation and confusion. Conditionals now always
supply a scalar context to the expression, and if that expression
turns out to be the one whose value is returned, the value is
coerced to an array value of one element.
The switch optimizer was confused by negative fractional values,
and truncating them the wrong direction.
Configure now checks for chsize, select and truncate functions, and
now asks if you want to put scripts into some separate directory
from your binaries. More and more people are establishing a common
directory across architectures for scripts, so this is getting
important.
It used to be that a numeric literal ended up being stored both
as a string and as a double. This could make for lots of wasted
storage if you said things like "$seen{$key} = 1;". So now
numeric literals are now stored only in floating point format,
which saves space, and generates at most one extra conversion per
literal over the life of the script.
The % operator had an off-by-one error if the left argument was
negative.
The pack and unpack functions have been upgraded. You
can now convert native float and double fields using f and d.
You can specify negative relative positions with X<n>, and absolute
positions in the record with @<n>. You can have a length of *
on the final field to indicate that it is to gobble all the rest
of the available fields. In unpack, if you precede a field
spec with %<n>, it does an n-bit checksum on it instead of the
value itself. (Thus "%16C*" will checksum just like the Sys V sum
program.) One totally wacked out evening I hacked a u format
in to pack and unpack uudecode-style strings.
A couple bugs were fixed in unpack--it couldn't unpack an A or a
format field in a scalar context, which is just supposed to
return the first field. The c and C formats were also calling
bcopy to copy each character. Yuck.
Machines without the setreuid() system call couldn't manipulate
$< and $> easily. Now, if you've got setuid(), you can say $< = $>
or $> = $< or even ($<, $>) = ($uid, $uid), as long as it's
something that can be done with setuid(). Similarly for setgid().
I've included various MSDOS and OS/2 patches that people have sent.
There's still more in the hopper...
An open on a pipe for output such as 'open(STDOUT,"|command")' left
STDOUT attached to the wrong file descriptor. This didn't matter
within Perl, but it made subprocesses expecting stdout to be on fd 1
rather irate.
The print command could fail to detect errors such as running out
room on the disk. Now it checks a little better.
Saying "print @foo" might only print out some of the elements
if there undefined elements in the middle of the array, due to
a reversed bit of logic in the print routine.
On machines with vfork the child process would allocate memory
in the parent without the parent knowing about it, or having any way
to free the memory so allocated. The parent now calls a cleanup
routine that knows whether that's what happened.
If the getsockname or getpeername functions returned a normal
Unix error, perl -w would report that you tried I/O on an
unopened socket, even though it was open.
MACH doesn't have seekdir or telldir. Who ever uses them anyway?
Under certain circumstances, an optimized pattern match could
pass a hint into the standard pattern matching routine which
the standard routine would then ignore. The next pattern match
after that would then get a "panic: hint in do_match" because the
hint didn't point into the current string of interest.
The $' variable returned a short string if it contained an
embedded null.
Two common split cases are now special-cased to avoid the regular
expression code. One is /\s+/ (and its cousin ' ', which also
trims leading whitespace). The other is /^/, which is very useful
for splitting a "here-is" quote into lines:
@lines = split(/^/, <<END);
Element 0
Element 1
Element 2
END
You couldn't split on a single case-insensitive letter because
the single character split optimization ignore the case folding
flag.
Sort now handles undefined strings right, and sorts lists
a little more efficiently because it weeds them out before
sorting so it doesn't have to check for them on every comparison.
The each() and keys() functions were returning garbage on null
keys in DBM files because the DBM iterator merely returns a pointer
into the buffer to a string that's not necessarily null terminated.
Internally, Perl keeps a null at the end of every string (though
allowing embedded nulls) and some routines make use of this
to avoid checking for the end of buffer on every comparison. So
this just needed to be treated as a special case.
The &, | and ^ operators will do bitwise operations on two strings,
but for some reason I hadn't implemented ~ to do a complement.
Using an associative array name with a % in dbmopen(%name...)
didn't work right, not because it didn't parse, but because the
dbm opening routine internally did the wrong thing with it.
You can now say dbmopen(name, 'filename', undef) to prevent it
from opening the dbm file if it doesn't exist.
The die operator simply exited if you didn't give an argument,
because that made sense before eval existed. But now it will be
equivalent to "die 'Died';".
Using the return function outside a subroutine returned a cryptic
message about not being able to pop a magical label off the stack.
It's now more informative.
On systems without the rename() system call, it's emulated with
unlink()/link()/unlink(), which could clobber a file if it
happened to unlink it before it linked it. Perl now checks to
make sure the source and destination filenames aren't in fact
the same directory entry.
The -s file test now returns size of file. Why not?
If you tried to write a general subroutine to open files, passing
in the filehandle as *filehandle, it didn't work because nobody
took responsibility to allocate the filehandle structure internally.
Now, passing *name to subroutine forces filehandle and array
creation on that symbol if they're already not created.
Reading input via <HANDLE> is now a little more efficient--it
does one less string copy.
The dumpvar.pl routine now fixes weird chars to be printable, and
allows you to specify a list of varables to display. The debugger
takes advantage of this. The debugger also now allows \ continuation
lines, and has an = command to let you make aliases easily. Line
numbers should now be correct even after lines containing only
a semicolon.
The action code for parsing split; with no arguments didn't
pass correct a corrent value of bufend to the scanpat it was
using to establish the /\s+/ pattern.
The $] variable returned the rcsid string and patchlevel. It still
returns that in a string context, but in a numeric context it
returns the version number (as in 4.0) + patchlevel / 1000.
So these patches are being applied to 3.018.
The variables $0, %ENV, @ARGV were retaining incorrect information
from the previous incarnation in dumped/undumped scripts.
The %ENV array is suppose to be global even inside packages, but
and off-by-one error kept it from being so.
The $| variable couldn't be set on a filehandle before the file
was opened. Now you can.
If errno == 0, the $! variable returned "Error 0" in a string
context, which is, unfortunately, a true string. It now returns ""
in string context if errno == 0, so you can use it reasonable in
a conditional without comparing it to 0: &cleanup if $!;
On some machines, conversion of a number to a string caused
a malloc string to be overrun by 1 character. More memory is
now allocated for such a string.
The tainting mechanism didn't work right on scripts that were setgid
but not setuid.
If you had reference to an array such as @name in a program, but
didn't invoke any of the usual array operations, the array never
got initialized.
The FPS compiler doesn't do default in a switch very well if the
value can be interpreted as a signed character. There's now a
#ifdef BADSWITCH for such machines.
Certain combinations of backslashed backslashes weren't correctly
parsed inside double-quoted strings.
"Here" strings caused warnings about uninitialized variables because
the string used internally to accumulate the lines wasn't initialized
according to the standards of the -w switch.
The a2p translator couldn't parse {foo = (bar == 123)} due to
a hangover from the old awk syntax. It also needed to put a
chop into a program if the program referenced NF so that the
field count would come out right when the split was done.
There was a missing semicolon when local($_) was emitted.
I also didn't realize that an explicity awk split on ' ' trims
leading whitespace just like the implicit split at the beginning
of the loop. The awk for..in loop has to be translated in one
of two ways in a2p, depending on whether the array was produced
by a split or by subscripting. If the array was a normal array,
a2p put out code that iterated over the array values rather than
the numeric indexes, which was wrong.
The s2p didn't translate \n correctly, stripping the backslash.
|