summaryrefslogtreecommitdiff
path: root/eg
diff options
context:
space:
mode:
authorLarry Wall <lwall@jpl-devvax.jpl.nasa.gov>1990-10-15 23:06:10 +0000
committerLarry Wall <lwall@jpl-devvax.jpl.nasa.gov>1990-10-15 23:06:10 +0000
commitb6ccd89c4e9e943419de0b1846c5d54324a5ed8a (patch)
treecf53739fa44a61cbf5f940f6677797b116ce25cb /eg
parent6eb13c3b624098fc688ac86672bc30e26cbf8fd4 (diff)
downloadperl-b6ccd89c4e9e943419de0b1846c5d54324a5ed8a.tar.gz
perl 3.0 patch #29 (combined patch)
This set of patches pretty much brings you up to the functionality that version 4.0 will have. The Perl Book documents version 4.0. Perhaps these should be called release notes... :-) Enhancements: Many of the changes relate to making the debugger work better. It now runs your scripts at nearly full speed because it no longer calls a subroutine on every statement. The debugger now doesn't get confused about packages, evals and other filenames. More variables (though still not all) are available within the debugger. Related to this is the fact that every statement now knows which package and filename it was compiled in, so package semantics are now much more straightforward. Every variable also knows which package it was compiled in. So many places that used to print out just the variable name now prefix the variable name with the package name. Notably, if you print *foo it now gives *package'foo. Along with these, there is now a "caller" function which returns the context of the current subroutine call. See the man page for more details. Chip Salzenberg sent the patches for System V IPC (msg, sem and shm) so I dropped them in. There was no way to wait for a specific pid, which was silly, since Perl was already keeping track of the information. So I added the waitpid() call, which uses Unix's wait4() or waitpid() if available, and otherwise emulates them (at least as far as letting you wait for a particular pid--it doesn't emulate non-blocking wait). For use in sorting routines, there are now two new operators, cmp and <=>. These do string and numeric comparison, returning -1, 0 or 1 when the first argument is less than, equal to or greater than the second argument. Occasionally one finds that one wants to evaluate an operator in a scalar context, even though it's part of a LIST. For this purpose, there is now a scalar() operator. For instance, the approved fix for the novice error of using <> in assigning to a local is now: local($var) = scalar(<STDIN>); Perl's ordinary I/O is done using standard I/O routines. Every now and then this gets in your way. You may now access the system calls read() and write() via the Perl functions sysread() and syswrite(). They should not be intermixed with ordinary I/O calls unless you know what you're doing. Along with this, both the sysread() and read() functions allow you an optional 4th argument giving an offset into the string you're reading into, so for instance you can easily finish up partial reads. As a bit of syntactic sugar, you can now use the file tests -M, -A and -C to determine the age of a file in (possibly fractional) days as of the time the script started running. This makes it much easier to write midnight cleanup scripts with precision. The index() and rindex() functions now have an optional 3rd argument which tells it where to start looking, so you can now iterate through a string using these functions. The substr() function's 3rd argument is now optional, and if omitted, the function returns everything to the end of the string. The tr/// translation function now understands c, d and s options, just like the tr program. (Well, almost just like. The d option only deletes characters that aren't in the replacement string.) The c complementes the character class to match and the s option squishes out multiple occurrences of any replacement class characters. The reverse function, used in a scalar context, now reverses its scalar argument as a string. Dale Worley posted a patch to add @###.## type fields to formats. I said, "Neat!" and dropped it in, lock, stock and sinker. Kai Uwe Rommel sent a bunch of MSDOS and OS/2 updates, which I (mostly) incorporated. I can't vouch for them, but they look okay. Any data stored after the __END__ marker can be accesses now via the DATA filehandle, which is automatically opened onto the script at that point. (Well, actually, it's just kept open, since it was already open to read the script.) The taintperl program now checks for world writable PATH components, and complains if any are found (if PATH is used). Bug fixes: It used to be that you could get core dumps by such means as @$foo=(); @foo[42]; (1,2,3)[42]; $#foo = 50; foreach $elem (@foo) { $elem = 1; } This is no longer so. (For those who are up on Perl internals, the stack policy no longer allows Nullstr--all undefined values must be passed as &str_undef.) If you say something like local($foo,$bar); or local($initialized,$foo,$bar) = ('one value'); $foo and $bar are now initialized to the undefined value, rather than the defined null string. Array assignment to special arrays is now better supported. For instance, @ENV = () clears the environment, and %foo = () will now clear any dbm file bound to %foo. On the subject of dbm files, the highly visible bugs at patchlevel 28 have been fixed. You can now open dbm files readonly, and you don't have to do a dummy assignment to make the cache allocate itself. The modulus operator wasn't working right on negative values because of a misplaced cast. For instance, -5 % 5 was returning the value 5, which is clearly wrong. Certain operations coredumped if you didn't supply a value: close; eof; Previously, if the subroutine supplied for a sort operation didn't exist, it failed quietly. Now it produces a fatal error. The bitwise complement operator ~ didn't work on vec() strings longer than one byte because of failure to increment a loop variable. The oct and hex functions returned a negative result if the highest bit was set. They now return an unsigned result, which seems a little less confusing. Likewise, the token 0x80000000 also produces an unsigned value now. Some machines didn't like to see 0x87654321 in an #ifdef because they think of the symbols as signed. The tests have been changed to just look at the lower 4 nybbles of the value, which is sufficient to determine endianness, at least as far as the #ifdefs are concerned. The unshift operator did not return the documented value, which was the number of elements in the new array. Instead it returned the last unshifted argument, more or less by accident. -w sometimes printed spurious warnings about ARGV and ENV when referencing the arrays indirectly through shift or exec. This was because the typo test was misplaced before the code that exempts special variables from the typo test. If you said 'require "./foo.pl"', it would look in someplace like /usr/local/lib/perl/./foo.pl instead of the current directory. This works more like people expect now. The require error messages also referred to wrong file, if they worked at all. The h2ph program didn't translate includes right--it should have changed .h to .ph. Patterns with multiple short literal strings sometimes failed. This was a problem with the code that looks for a maximal literal string to feed to the Boyer-Moore searching routine. The code was gluing together literal strings that weren't continuous. The $* variable controls multi-line pattern matching. When it's 0, patterns are supposed to match as if the string contained a single line. Unfortunately, /^pat/ occasionally matched in middle of string under certain conditions. Recently the regular expression routines were upgraded to do {n,m} more efficiently. In doing this, however, I manufactured a couple of bugs: /.{n,m}$/ could match with fewer than n characters remaining on the line, and patterns like /\d{9}/ could match more than 9 characters. The undefined value has an actual physical location in Perl, and pointers to it are passed around. By certain circuitous routes it was possible to clobber the undefined value so that it was no longer undefined--kind of like making /dev/null into a real file. Hopefully this can't happen any more. op.stat could fail if /bin/0 existed, because of a while (<*>) {... This has been changed to a while (defined($_ = <*>)) {... The length of a search pattern was limited by the length of tokenbuf internally. This restriction has been removed. The null character gave the tokener indigestion when used as a delimiter for m// or s///. There was a bunch of other cleanupish things that are too trivial to mention here.
Diffstat (limited to 'eg')
-rw-r--r--eg/sysvipc/README9
1 files changed, 9 insertions, 0 deletions
diff --git a/eg/sysvipc/README b/eg/sysvipc/README
new file mode 100644
index 0000000000..54094f1d85
--- /dev/null
+++ b/eg/sysvipc/README
@@ -0,0 +1,9 @@
+FYEnjoyment, here are the test scripts I used while implementing SysV
+IPC in Perl. Each of them must be run with the parameter "s" for
+"send" or "r" for "receive"; in each case, the receiver is the server
+and the sender is the client.
+
+--
+Chip Salzenberg at ComDev/TCT <chip@tct.uucp>, <uunet!ateng!tct!chip>
+
+