📄 perl5004delta.pod
字号:
Tells the compiler to enable (or disable) the use of POSIX locales for
builtin operations.
When C<use locale> is in effect, the current LC_CTYPE locale is used
for regular expressions and case mapping; LC_COLLATE for string
ordering; and LC_NUMERIC for numeric formating in printf and sprintf
(but B<not> in print). LC_NUMERIC is always used in write, since
lexical scoping of formats is problematic at best.
Each C<use locale> or C<no locale> affects statements to the end of
the enclosing BLOCK or, if not inside a BLOCK, to the end of the
current file. Locales can be switched and queried with
POSIX::setlocale().
See L<perllocale> for more information.
=item use ops
Disable unsafe opcodes, or any named opcodes, when compiling Perl code.
=item use vmsish
Enable VMS-specific language features. Currently, there are three
VMS-specific features available: 'status', which makes C<$?> and
C<system> return genuine VMS status values instead of emulating POSIX;
'exit', which makes C<exit> take a genuine VMS status value instead of
assuming that C<exit 1> is an error; and 'time', which makes all times
relative to the local time zone, in the VMS tradition.
=back
=head1 Modules
=head2 Required Updates
Though Perl 5.004 is compatible with almost all modules that work
with Perl 5.003, there are a few exceptions:
Module Required Version for Perl 5.004
------ -------------------------------
Filter Filter-1.12
LWP libwww-perl-5.08
Tk Tk400.202 (-w makes noise)
Also, the majordomo mailing list program, version 1.94.1, doesn't work
with Perl 5.004 (nor with perl 4), because it executes an invalid
regular expression. This bug is fixed in majordomo version 1.94.2.
=head2 Installation directories
The I<installperl> script now places the Perl source files for
extensions in the architecture-specific library directory, which is
where the shared libraries for extensions have always been. This
change is intended to allow administrators to keep the Perl 5.004
library directory unchanged from a previous version, without running
the risk of binary incompatibility between extensions' Perl source and
shared libraries.
=head2 Module information summary
Brand new modules, arranged by topic rather than strictly
alphabetically:
CGI.pm Web server interface ("Common Gateway Interface")
CGI/Apache.pm Support for Apache's Perl module
CGI/Carp.pm Log server errors with helpful context
CGI/Fast.pm Support for FastCGI (persistent server process)
CGI/Push.pm Support for server push
CGI/Switch.pm Simple interface for multiple server types
CPAN Interface to Comprehensive Perl Archive Network
CPAN::FirstTime Utility for creating CPAN configuration file
CPAN::Nox Runs CPAN while avoiding compiled extensions
IO.pm Top-level interface to IO::* classes
IO/File.pm IO::File extension Perl module
IO/Handle.pm IO::Handle extension Perl module
IO/Pipe.pm IO::Pipe extension Perl module
IO/Seekable.pm IO::Seekable extension Perl module
IO/Select.pm IO::Select extension Perl module
IO/Socket.pm IO::Socket extension Perl module
Opcode.pm Disable named opcodes when compiling Perl code
ExtUtils/Embed.pm Utilities for embedding Perl in C programs
ExtUtils/testlib.pm Fixes up @INC to use just-built extension
FindBin.pm Find path of currently executing program
Class/Struct.pm Declare struct-like datatypes as Perl classes
File/stat.pm By-name interface to Perl's builtin stat
Net/hostent.pm By-name interface to Perl's builtin gethost*
Net/netent.pm By-name interface to Perl's builtin getnet*
Net/protoent.pm By-name interface to Perl's builtin getproto*
Net/servent.pm By-name interface to Perl's builtin getserv*
Time/gmtime.pm By-name interface to Perl's builtin gmtime
Time/localtime.pm By-name interface to Perl's builtin localtime
Time/tm.pm Internal object for Time::{gm,local}time
User/grent.pm By-name interface to Perl's builtin getgr*
User/pwent.pm By-name interface to Perl's builtin getpw*
Tie/RefHash.pm Base class for tied hashes with references as keys
UNIVERSAL.pm Base class for *ALL* classes
=head2 Fcntl
New constants in the existing Fcntl modules are now supported,
provided that your operating system happens to support them:
F_GETOWN F_SETOWN
O_ASYNC O_DEFER O_DSYNC O_FSYNC O_SYNC
O_EXLOCK O_SHLOCK
These constants are intended for use with the Perl operators sysopen()
and fcntl() and the basic database modules like SDBM_File. For the
exact meaning of these and other Fcntl constants please refer to your
operating system's documentation for fcntl() and open().
In addition, the Fcntl module now provides these constants for use
with the Perl operator flock():
LOCK_SH LOCK_EX LOCK_NB LOCK_UN
These constants are defined in all environments (because where there is
no flock() system call, Perl emulates it). However, for historical
reasons, these constants are not exported unless they are explicitly
requested with the ":flock" tag (e.g. C<use Fcntl ':flock'>).
=head2 IO
The IO module provides a simple mechanism to load all of the IO modules at one
go. Currently this includes:
IO::Handle
IO::Seekable
IO::File
IO::Pipe
IO::Socket
For more information on any of these modules, please see its
respective documentation.
=head2 Math::Complex
The Math::Complex module has been totally rewritten, and now supports
more operations. These are overloaded:
+ - * / ** <=> neg ~ abs sqrt exp log sin cos atan2 "" (stringify)
And these functions are now exported:
pi i Re Im arg
log10 logn ln cbrt root
tan
csc sec cot
asin acos atan
acsc asec acot
sinh cosh tanh
csch sech coth
asinh acosh atanh
acsch asech acoth
cplx cplxe
=head2 Math::Trig
This new module provides a simpler interface to parts of Math::Complex for
those who need trigonometric functions only for real numbers.
=head2 DB_File
There have been quite a few changes made to DB_File. Here are a few of
the highlights:
=over
=item *
Fixed a handful of bugs.
=item *
By public demand, added support for the standard hash function exists().
=item *
Made it compatible with Berkeley DB 1.86.
=item *
Made negative subscripts work with RECNO interface.
=item *
Changed the default flags from O_RDWR to O_CREAT|O_RDWR and the default
mode from 0640 to 0666.
=item *
Made DB_File automatically import the open() constants (O_RDWR,
O_CREAT etc.) from Fcntl, if available.
=item *
Updated documentation.
=back
Refer to the HISTORY section in DB_File.pm for a complete list of
changes. Everything after DB_File 1.01 has been added since 5.003.
=head2 Net::Ping
Major rewrite - support added for both udp echo and real icmp pings.
=head2 Object-oriented overrides for builtin operators
Many of the Perl builtins returning lists now have
object-oriented overrides. These are:
File::stat
Net::hostent
Net::netent
Net::protoent
Net::servent
Time::gmtime
Time::localtime
User::grent
User::pwent
For example, you can now say
use File::stat;
use User::pwent;
$his = (stat($filename)->st_uid == pwent($whoever)->pw_uid);
=head1 Utility Changes
=head2 pod2html
=over
=item Sends converted HTML to standard output
The I<pod2html> utility included with Perl 5.004 is entirely new.
By default, it sends the converted HTML to its standard output,
instead of writing it to a file like Perl 5.003's I<pod2html> did.
Use the B<--outfile=FILENAME> option to write to a file.
=back
=head2 xsubpp
=over
=item C<void> XSUBs now default to returning nothing
Due to a documentation/implementation bug in previous versions of
Perl, XSUBs with a return type of C<void> have actually been
returning one value. Usually that value was the GV for the XSUB,
but sometimes it was some already freed or reused value, which would
sometimes lead to program failure.
In Perl 5.004, if an XSUB is declared as returning C<void>, it
actually returns no value, i.e. an empty list (though there is a
backward-compatibility exception; see below). If your XSUB really
does return an SV, you should give it a return type of C<SV *>.
For backward compatibility, I<xsubpp> tries to guess whether a
C<void> XSUB is really C<void> or if it wants to return an C<SV *>.
It does so by examining the text of the XSUB: if I<xsubpp> finds
what looks like an assignment to C<ST(0)>, it assumes that the
XSUB's return type is really C<SV *>.
=back
=head1 C Language API Changes
=over
=item C<gv_fetchmethod> and C<perl_call_sv>
The C<gv_fetchmethod> function finds a method for an object, just like
in Perl 5.003. The GV it returns may be a method cache entry.
However, in Perl 5.004, method cache entries are not visible to users;
therefore, they can no longer be passed directly to C<perl_call_sv>.
Instead, you should use the C<GvCV> macro on the GV to extract its CV,
and pass the CV to C<perl_call_sv>.
The most likely symptom of passing the result of C<gv_fetchmethod> to
C<perl_call_sv> is Perl's producing an "Undefined subroutine called"
error on the I<second> call to a given method (since there is no cache
on the first call).
=item C<perl_eval_pv>
A new function handy for eval'ing strings of Perl code inside C code.
This function returns the value from the eval statement, which can
be used instead of fetching globals from the symbol table. See
L<perlguts>, L<perlembed> and L<perlcall> for details and examples.
=item Extended API for manipulating hashes
Internal handling of hash keys has changed. The old hashtable API is
still fully supported, and will likely remain so. The additions to the
API allow passing keys as C<SV*>s, so that C<tied> hashes can be given
real scalars as keys rather than plain strings (nontied hashes still
can only use strings as keys). New extensions must use the new hash
access functions and macros if they wish to use C<SV*> keys. These
additions also make it feasible to manipulate C<HE*>s (hash entries),
which can be more efficient. See L<perlguts> for details.
=back
=head1 Documentation Changes
Many of the base and library pods were updated. These
new pods are included in section 1:
=over
=item L<perldelta>
This document.
=item L<perlfaq>
Frequently asked questions.
=item L<perllocale>
Locale support (internationalization and localization).
=item L<perltoot>
Tutorial on Perl OO programming.
=item L<perlapio>
Perl internal IO abstraction interface.
=item L<perlmodlib>
Perl module library and recommended practice for module creation.
Extracted from L<perlmod> (which is much smaller as a result).
=item L<perldebug>
Although not new, this has been massively updated.
=item L<perlsec>
Although not new, this has been massively updated.
=back
=head1 New Diagnostics
Several new conditions will trigger warnings that were
silent before. Some only affect certain platforms.
The following new warnings and errors outline these.
These messages are classified as follows (listed in
increasing order of desperation):
(W) A warning (optional).
(D) A deprecation (optional).
(S) A severe warning (mandatory).
(F) A fatal error (trappable).
(P) An internal error you should never see (trappable).
(X) A very fatal error (nontrappable).
(A) An alien error message (not generated by Perl).
=over
=item "my" variable %s masks earlier declaration in same scope
(W) A lexical variable has been redeclared in the same scope, effectively
eliminating all access to the previous instance. This is almost always
a typographical error. Note that the earlier variable will still exist
until the end of the scope or until all closure referents to it are
destroyed.
=item %s argument is not a HASH element or slice
(F) The argument to delete() must be either a hash element, such as
$foo{$bar}
$ref->[12]->{"susie"}
or a hash slice, such as
@foo{$bar, $baz, $xyzzy}
@{$ref->[12]}{"susie", "queue"}
=item Allocation too large: %lx
(X) You can't allocate more than 64K on an MS-DOS machine.
=item Allocation too large
(F) You can't allocate more than 2^31+"small amount" bytes.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -