|
The general group of Perl4-to-Perl5 traps having to do with Signals, Sorting, and their
related subroutines, as well as general subroutine traps. Includes some OS-Specific traps.
- * (Signals)
-
Barewords that used to look like strings to Perl will now look like subroutine calls if a
subroutine by that name is defined before the compiler sees them.
sub SeeYa { warn"Hasta la vista, baby!" }
$SIG{'TERM'} = SeeYa;
print "SIGTERM is now $SIG{'TERM'}\n";
# perl4 prints: SIGTERM is now main'SeeYa
# perl5 prints: SIGTERM is now main::1 (and warns "Hasta la vista, baby!")
|
|
Use -w to catch this one
- * (Sort Subroutine)
-
reverse is no longer allowed as the name of a sort subroutine.
sub reverse{ print "yup "; $a <=> $b }
print sort reverse (2,1,3);
# perl4 prints: yup yup 123
# perl5 prints: 123
# perl5 warns (if using -w): Ambiguous call resolved as CORE::reverse()
|
|
- * warn() won't let you specify a
filehandle.
-
Although it _always_ printed to STDERR, warn() would let you specify a filehandle in
perl4. With perl5 it does not.
warn STDERR "Foo!";
# perl4 prints: Foo!
# perl5 prints: String found where operator expected
|
|
|
|