pwolfe@kailand.kai.com (10/24/89)
One side effect of Perl Version 3.0 that broke a number of our scripts has to do with the normal filehandle names being changed from lowercase to uppercase (eg. from stdout to STDOUT), which changed the default detail line format name, so scripts that depended on that name being "stdout" now produce NO output at all. I can't say that this is actually a bug, but it was an unexpected change, and will delay installation of version 3 on a number of our machines (until all broken scripts can be found and fixed). The fix is to assign an detail record format name ($~ = "stdout";). While you're at it, you might as well assign the header format name too, just in case that changes sometime in the future. The enclosed example prints out the contents of the system password file (in the old manner, since I haven't gotten the new "getpwent()" routine to work yet). Near the bottom, I have a format line to define the detail line for the default standard output channel. With version 2, the default output filehandle is "stdout", so "format stdout =" works, and "format STDOUT =" doesn't. With version 3, the default output filehandle is "STDOUT", so the opposite is true. I have sent email to Larry Wall about this. Patrick Wolfe (pat@kai.com, kailand!pat) System Manager, Kuck & Associates, Inc. > #!/usr/bin/perl > > # uncomment these to allow this script to work under Perl V3 > #$^ = "top"; > #$~ = "stdout"; > > open (passwd, "/etc/passwd") || die "cannot open passwd file for input, stopped"; > > while (<passwd>) { > chop; > ($name, $passwd, $uid, $gid, $gcos, $dir, $shell) = split (/:/); > write; > } > close (passwd); > exit (0); > > format top = > Passwd File > Login Uid Gid Shell Home > ------------------------------------------------------------------------------- > . > > format stdout = > @<<<<<<< @>> @>> @<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< > $name $uid $gid $shell $dir > .
lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (10/26/89)
In article <2800019@kailand> pwolfe@kailand.kai.com writes:
:
: One side effect of Perl Version 3.0 that broke a number of our scripts has to
: do with the normal filehandle names being changed from lowercase to uppercase
: (eg. from stdout to STDOUT), which changed the default detail line format
: name, so scripts that depended on that name being "stdout" now produce NO
: output at all.
:
: I can't say that this is actually a bug, but it was an unexpected change, and
: will delay installation of version 3 on a number of our machines (until all
: broken scripts can be found and fixed). The fix is to assign an detail record
: format name ($~ = "stdout";). While you're at it, you might as well assign the
: header format name too, just in case that changes sometime in the future.
"format stdout" will be grandfathered in patch #1, when I get it together in
a day or two.
Larry Wall
lwall@jpl-devvax.jpl.nasa.gov