--- /dev/null
+;; Default settings for all except cpan/
+((nil . ((indent-tabs-mode . nil))) ; all modes
+ (cperl-mode . ((cperl-indent-level 4)))
+ (c-mode . ((c-indentation-style . bsd)
+ (c-basic-offset . 4))))
James Jurach <muaddib@erf.net>
James E Keenan <jkeenan@cpan.org>
James Mastros <james@mastros.biz>
+James McCoy <vega.james@gmail.com>
James Raspass <jraspass@gmail.com>
Jamshid Afshar
Jan D. <jan.djarv@mbox200.swipnet.se>
ansi2knr=''
aphostname='/bin/hostname'
api_revision='5'
-api_subversion='10'
+api_subversion='11'
api_version='21'
-api_versionstring='5.21.10'
+api_versionstring='5.21.11'
ar='ar'
-archlib='/usr/lib/perl5/5.21.10/armv4l-linux'
-archlibexp='/usr/lib/perl5/5.21.10/armv4l-linux'
+archlib='/usr/lib/perl5/5.21.11/armv4l-linux'
+archlibexp='/usr/lib/perl5/5.21.11/armv4l-linux'
archname64=''
archname='armv4l-linux'
archobjs=''
cat='cat'
cc='cc'
cccdlflags='-fpic'
-ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/5.21.10/armv4l-linux/CORE'
+ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/5.21.11/armv4l-linux/CORE'
ccflags='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
ccflags_uselargefiles='-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
ccname='arm-linux-gcc'
inc_version_list_init='0'
incpath=''
inews=''
-installarchlib='./install_me_here/usr/lib/perl5/5.21.10/armv4l-linux'
+installarchlib='./install_me_here/usr/lib/perl5/5.21.11/armv4l-linux'
installbin='./install_me_here/usr/bin'
installhtml1dir=''
installhtml3dir=''
installman3dir='./install_me_here/usr/share/man/man3'
installprefix='./install_me_here/usr'
installprefixexp='./install_me_here/usr'
-installprivlib='./install_me_here/usr/lib/perl5/5.21.10'
+installprivlib='./install_me_here/usr/lib/perl5/5.21.11'
installscript='./install_me_here/usr/bin'
-installsitearch='./install_me_here/usr/lib/perl5/site_perl/5.21.10/armv4l-linux'
+installsitearch='./install_me_here/usr/lib/perl5/site_perl/5.21.11/armv4l-linux'
installsitebin='./install_me_here/usr/bin'
installsitehtml1dir=''
installsitehtml3dir=''
-installsitelib='./install_me_here/usr/lib/perl5/site_perl/5.21.10'
+installsitelib='./install_me_here/usr/lib/perl5/site_perl/5.21.11'
installsiteman1dir='./install_me_here/usr/share/man/man1'
installsiteman3dir='./install_me_here/usr/share/man/man3'
installsitescript='./install_me_here/usr/bin'
pr=''
prefix='/usr'
prefixexp='/usr'
-privlib='/usr/lib/perl5/5.21.10'
-privlibexp='/usr/lib/perl5/5.21.10'
+privlib='/usr/lib/perl5/5.21.11'
+privlibexp='/usr/lib/perl5/5.21.11'
procselfexe='"/proc/self/exe"'
prototype='define'
ptrsize='4'
sig_num_init='0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 6, 17, 29, 31, 0'
sig_size='68'
signal_t='void'
-sitearch='/usr/lib/perl5/site_perl/5.21.10/armv4l-linux'
-sitearchexp='/usr/lib/perl5/site_perl/5.21.10/armv4l-linux'
+sitearch='/usr/lib/perl5/site_perl/5.21.11/armv4l-linux'
+sitearchexp='/usr/lib/perl5/site_perl/5.21.11/armv4l-linux'
sitebin='/usr/bin'
sitebinexp='/usr/bin'
sitehtml1dir=''
sitehtml1direxp=''
sitehtml3dir=''
sitehtml3direxp=''
-sitelib='/usr/lib/perl5/site_perl/5.21.10'
+sitelib='/usr/lib/perl5/site_perl/5.21.11'
sitelib_stem='/usr/lib/perl5/site_perl'
-sitelibexp='/usr/lib/perl5/site_perl/5.21.10'
+sitelibexp='/usr/lib/perl5/site_perl/5.21.11'
siteman1dir='/usr/share/man/man1'
siteman1direxp='/usr/share/man/man1'
siteman3dir='/usr/share/man/man3'
strerror_r_proto='0'
strings='/usr/include/string.h'
submit=''
-subversion='10'
+subversion='11'
sysman='/usr/share/man/man1'
tail=''
tar=''
vendorprefixexp=''
vendorscript=''
vendorscriptexp=''
-version='5.21.10'
-version_patchlevel_string='version 21 subversion 10'
+version='5.21.11'
+version_patchlevel_string='version 21 subversion 11'
versiononly='undef'
vi=''
xlibpth='/usr/lib/386 /lib/386'
config_argc=0
PERL_REVISION=5
PERL_VERSION=21
-PERL_SUBVERSION=10
+PERL_SUBVERSION=11
PERL_API_REVISION=5
PERL_API_VERSION=21
-PERL_API_SUBVERSION=10
+PERL_API_SUBVERSION=11
PERL_PATCHLEVEL=
PERL_CONFIG_SH=true
ansi2knr=''
aphostname='/bin/hostname'
api_revision='5'
-api_subversion='10'
+api_subversion='11'
api_version='21'
-api_versionstring='5.21.10'
+api_versionstring='5.21.11'
ar='ar'
-archlib='/usr/lib/perl5/5.21.10/armv4l-linux'
-archlibexp='/usr/lib/perl5/5.21.10/armv4l-linux'
+archlib='/usr/lib/perl5/5.21.11/armv4l-linux'
+archlibexp='/usr/lib/perl5/5.21.11/armv4l-linux'
archname64=''
archname='armv4l-linux'
archobjs=''
cat='cat'
cc='arm-none-linux-gnueabi-gcc'
cccdlflags='-fpic'
-ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/5.21.10/armv4l-linux/CORE'
+ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/5.21.11/armv4l-linux/CORE'
ccflags='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
ccflags_uselargefiles='-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
ccname='arm-linux-gcc'
inc_version_list_init='0'
incpath=''
inews=''
-installarchlib='./install_me_here/usr/lib/perl5/5.21.10/armv4l-linux'
+installarchlib='./install_me_here/usr/lib/perl5/5.21.11/armv4l-linux'
installbin='./install_me_here/usr/bin'
installhtml1dir=''
installhtml3dir=''
installman3dir='./install_me_here/usr/share/man/man3'
installprefix='./install_me_here/usr'
installprefixexp='./install_me_here/usr'
-installprivlib='./install_me_here/usr/lib/perl5/5.21.10'
+installprivlib='./install_me_here/usr/lib/perl5/5.21.11'
installscript='./install_me_here/usr/bin'
-installsitearch='./install_me_here/usr/lib/perl5/site_perl/5.21.10/armv4l-linux'
+installsitearch='./install_me_here/usr/lib/perl5/site_perl/5.21.11/armv4l-linux'
installsitebin='./install_me_here/usr/bin'
installsitehtml1dir=''
installsitehtml3dir=''
-installsitelib='./install_me_here/usr/lib/perl5/site_perl/5.21.10'
+installsitelib='./install_me_here/usr/lib/perl5/site_perl/5.21.11'
installsiteman1dir='./install_me_here/usr/share/man/man1'
installsiteman3dir='./install_me_here/usr/share/man/man3'
installsitescript='./install_me_here/usr/bin'
pr=''
prefix='/usr'
prefixexp='/usr'
-privlib='/usr/lib/perl5/5.21.10'
-privlibexp='/usr/lib/perl5/5.21.10'
+privlib='/usr/lib/perl5/5.21.11'
+privlibexp='/usr/lib/perl5/5.21.11'
procselfexe='"/proc/self/exe"'
prototype='define'
ptrsize='4'
sig_num_init='0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 6, 17, 29, 31, 0'
sig_size='68'
signal_t='void'
-sitearch='/usr/lib/perl5/site_perl/5.21.10/armv4l-linux'
-sitearchexp='/usr/lib/perl5/site_perl/5.21.10/armv4l-linux'
+sitearch='/usr/lib/perl5/site_perl/5.21.11/armv4l-linux'
+sitearchexp='/usr/lib/perl5/site_perl/5.21.11/armv4l-linux'
sitebin='/usr/bin'
sitebinexp='/usr/bin'
sitehtml1dir=''
sitehtml1direxp=''
sitehtml3dir=''
sitehtml3direxp=''
-sitelib='/usr/lib/perl5/site_perl/5.21.10'
+sitelib='/usr/lib/perl5/site_perl/5.21.11'
sitelib_stem='/usr/lib/perl5/site_perl'
-sitelibexp='/usr/lib/perl5/site_perl/5.21.10'
+sitelibexp='/usr/lib/perl5/site_perl/5.21.11'
siteman1dir='/usr/share/man/man1'
siteman1direxp='/usr/share/man/man1'
siteman3dir='/usr/share/man/man3'
strerror_r_proto='0'
strings='/usr/include/string.h'
submit=''
-subversion='10'
+subversion='11'
sysman='/usr/share/man/man1'
tail=''
tar=''
vendorprefixexp=''
vendorscript=''
vendorscriptexp=''
-version='5.21.10'
-version_patchlevel_string='version 21 subversion 10'
+version='5.21.11'
+version_patchlevel_string='version 21 subversion 11'
versiononly='undef'
vi=''
xlibpth='/usr/lib/386 /lib/386'
config_argc=0
PERL_REVISION=5
PERL_VERSION=21
-PERL_SUBVERSION=10
+PERL_SUBVERSION=11
PERL_API_REVISION=5
PERL_API_VERSION=21
-PERL_API_SUBVERSION=10
+PERL_API_SUBVERSION=11
PERL_PATCHLEVEL=
PERL_CONFIG_SH=true
=item Directories for the perl distribution
-By default, Configure will use the following directories for 5.21.10.
+By default, Configure will use the following directories for 5.21.11.
$version is the full perl version number, including subversion, e.g.
5.12.3, and $archname is a string like sun4-sunos,
determined by Configure. The full definitions of all Configure
=head1 Coexistence with earlier versions of perl 5
-Perl 5.21.10 is not binary compatible with earlier versions of Perl.
+Perl 5.21.11 is not binary compatible with earlier versions of Perl.
In other words, you will have to recompile your XS modules.
In general, you can usually safely upgrade from one version of Perl
libraries after 5.6.0, but not for executables. TODO?) One convenient
way to do this is by using a separate prefix for each version, such as
- sh Configure -Dprefix=/opt/perl5.21.10
+ sh Configure -Dprefix=/opt/perl5.21.11
-and adding /opt/perl5.21.10/bin to the shell PATH variable. Such users
+and adding /opt/perl5.21.11/bin to the shell PATH variable. Such users
may also wish to add a symbolic link /usr/local/bin/perl so that
scripts can still start with #!/usr/local/bin/perl.
subversions may not have all the compatibility wrinkles ironed out
yet.
-=head2 Upgrading from 5.21.8 or earlier
+=head2 Upgrading from 5.21.10 or earlier
-B<Perl 5.21.10 may not be binary compatible with Perl 5.21.9 or
+B<Perl 5.21.11 may not be binary compatible with Perl 5.21.10 or
earlier Perl releases.> Perl modules having binary parts
(meaning that a C compiler is used) will have to be recompiled to be
-used with 5.21.10. If you find you do need to rebuild an extension with
-5.21.10, you may safely do so without disturbing the older
+used with 5.21.11. If you find you do need to rebuild an extension with
+5.21.11, you may safely do so without disturbing the older
installations. (See L<"Coexistence with earlier versions of perl 5">
above.)
print("$f\n");
}
-in Linux with perl-5.21.10 is as follows (under $Config{prefix}):
+in Linux with perl-5.21.11 is as follows (under $Config{prefix}):
./bin/perl
- ./lib/perl5/5.21.10/strict.pm
- ./lib/perl5/5.21.10/warnings.pm
- ./lib/perl5/5.21.10/i686-linux/File/Glob.pm
- ./lib/perl5/5.21.10/feature.pm
- ./lib/perl5/5.21.10/XSLoader.pm
- ./lib/perl5/5.21.10/i686-linux/auto/File/Glob/Glob.so
+ ./lib/perl5/5.21.11/strict.pm
+ ./lib/perl5/5.21.11/warnings.pm
+ ./lib/perl5/5.21.11/i686-linux/File/Glob.pm
+ ./lib/perl5/5.21.11/feature.pm
+ ./lib/perl5/5.21.11/XSLoader.pm
+ ./lib/perl5/5.21.11/i686-linux/auto/File/Glob/Glob.so
Secondly, for perl-5.10.1, the Debian perl-base package contains 591
files, (of which 510 are for lib/unicore) totaling about 3.5MB in its
cpan/Digest/t/file.t See if Digest extensions work
cpan/Digest/t/lib/Digest/Dummy.pm See if Digest extensions work
cpan/Digest/t/security.t See if Digest extensions work
+cpan/.dir-locals.el Emacs control file
cpan/Encode/bin/enc2xs Encode module generator
cpan/Encode/bin/encguess guess character encodings of files
cpan/Encode/bin/piconv iconv by perl
cv.h Code value header
cygwin/cygwin.c Additional code for Cygwin port
deb.c Debugging routines
+.dir-locals.el Emacs control file
dist/Attribute-Handlers/Changes Attribute::Handlers
dist/Attribute-Handlers/demo/demo2.pl Attribute::Handlers demo
dist/Attribute-Handlers/demo/demo3.pl Attribute::Handlers demo
ext/XS-APItest/t/gotosub.t XS::APItest: tests goto &xsub and hints
ext/XS-APItest/t/grok.t XS::APItest: tests for grok* functions
ext/XS-APItest/t/gv_autoload4.t XS::APItest: tests for gv_autoload4() and variants
+ext/XS-APItest/t/gv_const_sv.t XS::APItest: test gv_const_sv()
ext/XS-APItest/t/gv_fetchmeth_autoload.t XS::APItest: tests for gv_fetchmeth_autoload() and variants
ext/XS-APItest/t/gv_fetchmethod_flags.t XS::APItest: tests for gv_fetchmethod_flags() and variants
ext/XS-APItest/t/gv_fetchmeth.t XS::APItest: tests for gv_fetchmeth() and variants
pod/perl5201delta.pod Perl changes in version 5.20.1
pod/perl5202delta.pod Perl changes in version 5.20.2
pod/perl5210delta.pod Perl changes in version 5.21.0
+pod/perl52110delta.pod Perl changes in version 5.21.10
pod/perl5211delta.pod Perl changes in version 5.21.1
pod/perl5212delta.pod Perl changes in version 5.21.2
pod/perl5213delta.pod Perl changes in version 5.21.3
t/porting/podcheck.t Test the POD of shipped modules is well formed
t/porting/pod_rules.t Check that various pod lists are consistent
t/porting/readme.t Check that all files in Porting/ are mentioned in Porting/README.pod
+t/porting/re_context.t Check assumptions made by save_re_context()
t/porting/regen.t Check that regen.pl doesn't need running
t/porting/ss_dup.t Check that sv.c:ss_dup handle everything
t/porting/test_bootstrap.t Test that the instructions for test bootstrapping aren't accidentally overlooked.
"dist/threads-shared",
"dist/Tie-File",
"dist/XSLoader",
+ "lib/perl5db",
"win32"
],
"file" : [
"url" : "http://perl5.git.perl.org/"
}
},
- "version" : "5.021010"
+ "version" : "5.021011"
}
- dist/threads-shared
- dist/Tie-File
- dist/XSLoader
+ - lib/perl5db
- win32
file:
- autodoc.pl
homepage: http://www.perl.org/
license: http://dev.perl.org/licenses/
repository: http://perl5.git.perl.org/
-version: '5.021010'
+version: '5.021011'
ndt_obj = $(obj0) $(obj1) $(obj2) $(obj3) $(ARCHOBJS)
obj = $(ndt_obj) $(DTRACE_O)
-perltoc_pod_prereqs = extra.pods pod/perl52110delta.pod pod/perlapi.pod pod/perlintern.pod pod/perlmodlib.pod pod/perluniprops.pod
+perltoc_pod_prereqs = extra.pods pod/perl52111delta.pod pod/perlapi.pod pod/perlintern.pod pod/perlmodlib.pod pod/perluniprops.pod
generated_pods = pod/perltoc.pod $(perltoc_pod_prereqs)
generated_headers = uudmap.h bitcount.h mg_data.h
pod/perlmodlib.pod: $(MINIPERL_EXE) pod/perlmodlib.PL MANIFEST
$(MINIPERL) pod/perlmodlib.PL -q
-pod/perl52110delta.pod: pod/perldelta.pod
- $(RMS) pod/perl52110delta.pod
- $(LNS) perldelta.pod pod/perl52110delta.pod
+pod/perl52111delta.pod: pod/perldelta.pod
+ $(RMS) pod/perl52111delta.pod
+ $(LNS) perldelta.pod pod/perl52111delta.pod
extra.pods: $(MINIPERL_EXE)
-@test ! -f extra.pods || rm -f `cat extra.pods`
# Here comes the CW tools - TO BE FILLED TO BUILD WITH CW -
-MODULE_DESC = "Perl 5.21.10 for NetWare"
+MODULE_DESC = "Perl 5.21.11 for NetWare"
CCTYPE = CodeWarrior
C_COMPILER = mwccnlm -c
CPP_COMPILER = mwccnlm
# versioned installation can be obtained by setting INST_TOP above to a
# path that includes an arbitrary version string.
#
-INST_VER = \5.21.10
+INST_VER = \5.21.11
#
# Comment this out if you DON'T want your perl installation to have
* This symbol contains the ~name expanded version of ARCHLIB, to be used
* in programs that are not prepared to deal with ~ expansion at run-time.
*/
-#define ARCHLIB "c:\\perl\\5.21.10\\lib\\NetWare-x86-multi-thread" /**/
+#define ARCHLIB "c:\\perl\\5.21.11\\lib\\NetWare-x86-multi-thread" /**/
/*#define ARCHLIB_EXP "" /**/
/* ARCHNAME:
* This symbol is the filename expanded version of the BIN symbol, for
* programs that do not want to deal with that at run-time.
*/
-#define BIN "c:\\perl\\5.21.10\\bin\\NetWare-x86-multi-thread" /**/
-#define BIN_EXP "c:\\perl\\5.21.10\\bin\\NetWare-x86-multi-thread" /**/
+#define BIN "c:\\perl\\5.21.11\\bin\\NetWare-x86-multi-thread" /**/
+#define BIN_EXP "c:\\perl\\5.21.11\\bin\\NetWare-x86-multi-thread" /**/
/* BYTEORDER:
* This symbol holds the hexadecimal constant defined in byteorder,
* This symbol contains the ~name expanded version of SITEARCH, to be used
* in programs that are not prepared to deal with ~ expansion at run-time.
*/
-#define SITEARCH "c:\\perl\\site\\5.21.10\\lib\\NetWare-x86-multi-thread" /**/
+#define SITEARCH "c:\\perl\\site\\5.21.11\\lib\\NetWare-x86-multi-thread" /**/
/*#define SITEARCH_EXP "" /**/
/* SITELIB:
* removed. The elements in inc_version_list (inc_version_list.U) can
* be tacked onto this variable to generate a list of directories to search.
*/
-#define SITELIB "c:\\perl\\site\\5.21.10\\lib" /**/
+#define SITELIB "c:\\perl\\site\\5.21.11\\lib" /**/
/*#define SITELIB_EXP "" /**/
#define SITELIB_STEM "" /**/
},
'Config::Perl::V' => {
- 'DISTRIBUTION' => 'HMBRAND/Config-Perl-V-0.23.tgz',
+ 'DISTRIBUTION' => 'HMBRAND/Config-Perl-V-0.24.tgz',
'FILES' => q[cpan/Config-Perl-V],
'EXCLUDED' => [qw(
examples/show-v.pl
- t/00_pod.t
- t/01_pod.t
)],
},
},
'IO::Socket::IP' => {
- 'DISTRIBUTION' => 'PEVANS/IO-Socket-IP-0.36.tar.gz',
+ 'DISTRIBUTION' => 'PEVANS/IO-Socket-IP-0.37.tar.gz',
'FILES' => q[cpan/IO-Socket-IP],
'EXCLUDED' => [
qr{^examples/},
},
'Module::CoreList' => {
- 'DISTRIBUTION' => 'BINGOS/Module-CoreList-5.20150220.tar.gz',
+ 'DISTRIBUTION' => 'BINGOS/Module-CoreList-5.20150320.tar.gz',
'FILES' => q[dist/Module-CoreList],
},
}
}
-# Local variables:
-# cperl-indent-level: 4
-# indent-tabs-mode: nil
-# End:
-#
# ex: set ts=8 sts=4 sw=4 et:
=cut
-# Local variables:
-# cperl-indent-level: 4
-# indent-tabs-mode: nil
-# End:
-#
# ex: set ts=8 sts=4 sw=4 et:
ansi2knr=''
aphostname='/bin/hostname'
api_revision='5'
-api_subversion='10'
+api_subversion='11'
api_version='21'
-api_versionstring='5.21.10'
+api_versionstring='5.21.11'
ar='ar'
-archlib='/pro/lib/perl5/5.21.10/i686-linux-64int'
-archlibexp='/pro/lib/perl5/5.21.10/i686-linux-64int'
+archlib='/pro/lib/perl5/5.21.11/i686-linux-64int'
+archlibexp='/pro/lib/perl5/5.21.11/i686-linux-64int'
archname64='64int'
archname='i686-linux-64int'
archobjs=''
incpth='/usr/lib/gcc/i586-suse-linux/4.8/include /usr/local/include /usr/lib/gcc/i586-suse-linux/4.8/include-fixed /usr/lib/gcc/i586-suse-linux/4.8/../../../../i586-suse-linux/include /usr/include'
inews=''
initialinstalllocation='/pro/bin'
-installarchlib='/pro/lib/perl5/5.21.10/i686-linux-64int'
+installarchlib='/pro/lib/perl5/5.21.11/i686-linux-64int'
installbin='/pro/bin'
installhtml1dir=''
installhtml3dir=''
installman3dir='/pro/local/man/man3'
installprefix='/pro'
installprefixexp='/pro'
-installprivlib='/pro/lib/perl5/5.21.10'
+installprivlib='/pro/lib/perl5/5.21.11'
installscript='/pro/bin'
-installsitearch='/pro/lib/perl5/site_perl/5.21.10/i686-linux-64int'
+installsitearch='/pro/lib/perl5/site_perl/5.21.11/i686-linux-64int'
installsitebin='/pro/bin'
installsitehtml1dir=''
installsitehtml3dir=''
-installsitelib='/pro/lib/perl5/site_perl/5.21.10'
+installsitelib='/pro/lib/perl5/site_perl/5.21.11'
installsiteman1dir='/pro/local/man/man1'
installsiteman3dir='/pro/local/man/man3'
installsitescript='/pro/bin'
perl_static_inline='static __inline__'
perladmin='hmbrand@cpan.org'
perllibs='-lnsl -ldl -lm -lcrypt -lutil -lc'
-perlpath='/pro/bin/perl5.21.10'
+perlpath='/pro/bin/perl5.21.11'
pg='pg'
phostname='hostname'
pidtype='pid_t'
pr=''
prefix='/pro'
prefixexp='/pro'
-privlib='/pro/lib/perl5/5.21.10'
-privlibexp='/pro/lib/perl5/5.21.10'
+privlib='/pro/lib/perl5/5.21.11'
+privlibexp='/pro/lib/perl5/5.21.11'
procselfexe='"/proc/self/exe"'
prototype='define'
ptrsize='4'
sig_num_init='0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 6, 17, 29, 31, 0'
sig_size='69'
signal_t='void'
-sitearch='/pro/lib/perl5/site_perl/5.21.10/i686-linux-64int'
-sitearchexp='/pro/lib/perl5/site_perl/5.21.10/i686-linux-64int'
+sitearch='/pro/lib/perl5/site_perl/5.21.11/i686-linux-64int'
+sitearchexp='/pro/lib/perl5/site_perl/5.21.11/i686-linux-64int'
sitebin='/pro/bin'
sitebinexp='/pro/bin'
sitehtml1dir=''
sitehtml1direxp=''
sitehtml3dir=''
sitehtml3direxp=''
-sitelib='/pro/lib/perl5/site_perl/5.21.10'
+sitelib='/pro/lib/perl5/site_perl/5.21.11'
sitelib_stem='/pro/lib/perl5/site_perl'
-sitelibexp='/pro/lib/perl5/site_perl/5.21.10'
+sitelibexp='/pro/lib/perl5/site_perl/5.21.11'
siteman1dir='/pro/local/man/man1'
siteman1direxp='/pro/local/man/man1'
siteman3dir='/pro/local/man/man3'
ssizetype='ssize_t'
st_ino_sign='1'
st_ino_size='8'
-startperl='#!/pro/bin/perl5.21.10'
+startperl='#!/pro/bin/perl5.21.11'
startsh='#!/bin/sh'
static_ext=' '
stdchar='char'
strerror_r_proto='0'
strings='/usr/include/string.h'
submit=''
-subversion='10'
+subversion='11'
sysman='/usr/share/man/man1'
sysroot=''
tail=''
vendorprefixexp=''
vendorscript=''
vendorscriptexp=''
-version='5.21.10'
-version_patchlevel_string='version 21 subversion 10'
+version='5.21.11'
+version_patchlevel_string='version 21 subversion 11'
versiononly='define'
vi=''
xlibpth='/usr/lib/386 /lib/386'
zip='zip'
PERL_REVISION=5
PERL_VERSION=21
-PERL_SUBVERSION=10
+PERL_SUBVERSION=11
PERL_API_REVISION=5
PERL_API_VERSION=21
-PERL_API_SUBVERSION=10
+PERL_API_SUBVERSION=11
PERL_PATCHLEVEL=''
PERL_CONFIG_SH=true
: Variables propagated from previous config.sh file.
* This symbol contains the ~name expanded version of ARCHLIB, to be used
* in programs that are not prepared to deal with ~ expansion at run-time.
*/
-#define ARCHLIB "/pro/lib/perl5/5.21.10/i686-linux-64int-ld" /**/
-#define ARCHLIB_EXP "/pro/lib/perl5/5.21.10/i686-linux-64int-ld" /**/
+#define ARCHLIB "/pro/lib/perl5/5.21.11/i686-linux-64int-ld" /**/
+#define ARCHLIB_EXP "/pro/lib/perl5/5.21.11/i686-linux-64int-ld" /**/
/* ARCHNAME:
* This symbol holds a string representing the architecture name.
* This symbol contains the ~name expanded version of PRIVLIB, to be used
* in programs that are not prepared to deal with ~ expansion at run-time.
*/
-#define PRIVLIB "/pro/lib/perl5/5.21.10" /**/
-#define PRIVLIB_EXP "/pro/lib/perl5/5.21.10" /**/
+#define PRIVLIB "/pro/lib/perl5/5.21.11" /**/
+#define PRIVLIB_EXP "/pro/lib/perl5/5.21.11" /**/
/* PTRSIZE:
* This symbol contains the size of a pointer, so that the C preprocessor
* This symbol contains the ~name expanded version of SITEARCH, to be used
* in programs that are not prepared to deal with ~ expansion at run-time.
*/
-#define SITEARCH "/pro/lib/perl5/site_perl/5.21.10/i686-linux-64int-ld" /**/
-#define SITEARCH_EXP "/pro/lib/perl5/site_perl/5.21.10/i686-linux-64int-ld" /**/
+#define SITEARCH "/pro/lib/perl5/site_perl/5.21.11/i686-linux-64int-ld" /**/
+#define SITEARCH_EXP "/pro/lib/perl5/site_perl/5.21.11/i686-linux-64int-ld" /**/
/* SITELIB:
* This symbol contains the name of the private library for this package.
* removed. The elements in inc_version_list (inc_version_list.U) can
* be tacked onto this variable to generate a list of directories to search.
*/
-#define SITELIB "/pro/lib/perl5/site_perl/5.21.10" /**/
-#define SITELIB_EXP "/pro/lib/perl5/site_perl/5.21.10" /**/
+#define SITELIB "/pro/lib/perl5/site_perl/5.21.11" /**/
+#define SITELIB_EXP "/pro/lib/perl5/site_perl/5.21.11" /**/
#define SITELIB_STEM "/pro/lib/perl5/site_perl" /**/
/* SSize_t:
* script to make sure (one hopes) that it runs with perl and not
* some shell.
*/
-#define STARTPERL "#!/pro/bin/perl5.21.10" /**/
+#define STARTPERL "#!/pro/bin/perl5.21.11" /**/
/* HAS_STDIO_STREAM_ARRAY:
* This symbol, if defined, tells that there is an array
=head1 EPIGRAPHS
+=head2 v5.21.10 - Aldous Huxley, "The Devils of Loudun"
+
+L<Announced on 2015-03-20 by Steve Hay|http://www.nntp.perl.org/group/perl.perl5.porters/2015/03/msg226847.html>
+
+The fire burned on, the good fathers continued to sprinkle and intone.
+Suddenly a flock of pigeons came swooping down from the church and
+started to wheel around the roaring column of flame and smoke. The
+crowd shouted, the archers waved their halberds at the birds, Lactance
+and Tranquille splashed them on the wing with holy water. In vain. The
+pigeons were not to be driven away. Round and round they flew, diving
+through the smoke, singeing their feathers in the flames. Both parties
+claimed a miracle. For the parson's enemies the birds, quite obviously,
+were a troop of devils, come to fetch away his soul. For his friends,
+they were emblems of the Holy Ghost and living proof of his innocence.
+It never seems to have occurred to anyone that they were just pigeons,
+obeying the laws of their own, their blessedly other-than-human nature.
+
=head2 v5.21.9 - Emily Dickinson, "There is Another Sky"
-L<Announced on 2015-02-20 by Sawyer X|http://nntp.perl.org/group/perl.perl5.porters/226002>
+L<Announced on 2015-02-20 by Sawyer X|http://www.nntp.perl.org/group/perl.perl5.porters/2015/02/msg226002.html>
There is another sky,
Ever serene and fair,
my @files = ('autodoc.pl', 'lib/unicore/mktables', 'TestInit.pm',
'Porting/Maintainers.pm', 'Porting/perldelta_template.pod',
map { get_module_files($_) } @CPAN);
-my @dirs = ('cpan', 'win32', grep { -d $_ && $_ !~ /^cpan/ } map { get_module_pat($_) } @CPAN);
+my @dirs = ('cpan', 'win32', 'lib/perl5db', grep { -d $_ && $_ !~ /^cpan/ } map { get_module_pat($_) } @CPAN);
my %dirs;
@dirs{@dirs} = ();
notify_success();
-# Local variables:
-# cperl-indent-level: 4
-# indent-tabs-mode: nil
-# End:
-#
# ex: set ts=8 sts=4 sw=4 et:
=item *
+L<B::Generate> version 1.50
+
+=item *
+
L<B::Utils> version 0.25
=item *
XXX Generate this with:
- perl Porting/acknowledgements.pl v5.21.10..HEAD
+ perl Porting/acknowledgements.pl v5.21.11..HEAD
=head1 Reporting Bugs
XXX Generate this with:
- perl Porting/acknowledgements.pl v5.21.10..HEAD
+ perl Porting/acknowledgements.pl v5.21.11..HEAD
=head1 Reporting Bugs
1;
-# Local variables:
-# cperl-indent-level: 4
-# indent-tabs-mode: nil
-# End:
-#
# ex: set ts=8 sts=4 sw=4 et:
process($_, $Build{$_}, main->can("do_$_"), $Test && ++$test, $Verbose)
foreach sort keys %Build;
-# Local variables:
-# cperl-indent-level: 4
-# indent-tabs-mode: nil
-# End:
-#
# ex: set ts=8 sts=4 sw=4 et:
=head2 Perl 5.21
- 2014-05-20 5.21.0 ✓ Ricardo Signes
- 2014-06-20 5.21.1 ✓ Matthew Horsfall
- 2014-07-20 5.21.2 ✓ Abigail
- 2014-08-20 5.21.3 ✓ Peter Martini
- 2014-09-20 5.21.4 ✓ Steve Hay
- 2014-10-20 5.21.5 ✓ Abigail
- 2014-11-20 5.21.6 ✓ Chris "BinGOs" Williams
- 2014-12-20 5.21.7 ✓ Max Maischein
- 2015-01-20 5.21.8 ✓ Matthew Horsfall
- 2015-02-20 5.21.9 ✓ Sawyer X
- 2015-03-20 5.21.10 Steve Hay
+ 2014-05-20 5.21.0 ✓ Ricardo Signes
+ 2014-06-20 5.21.1 ✓ Matthew Horsfall
+ 2014-07-20 5.21.2 ✓ Abigail
+ 2014-08-20 5.21.3 ✓ Peter Martini
+ 2014-09-20 5.21.4 ✓ Steve Hay
+ 2014-10-20 5.21.5 ✓ Abigail
+ 2014-11-20 5.21.6 ✓ Chris "BinGOs" Williams
+ 2014-12-20 5.21.7 ✓ Max Maischein
+ 2015-01-20 5.21.8 ✓ Matthew Horsfall
+ 2015-02-20 5.21.9 ✓ Sawyer X
+ 2015-03-20 5.21.10 ✓ Steve Hay
2015-04-20 5.21.11 ?
(RC0 for 5.22.0 will be released once we think that all the blockers have been
On these systems, it might be the default compilation mode, and there
is currently no guarantee that passing no use64bitall option to the
Configure process will build a 32bit perl. Implementing -Duse32bit*
-options would be nice for perl 5.21.10.
+options would be nice for perl 5.21.11.
=head2 Profile Perl - am I hot or not?
=head1 Big projects
Tasks that will get your name mentioned in the description of the "Highlights
-of 5.21.10"
+of 5.21.11"
=head2 make ithreads more robust
Make perl executable and create a symlink for libperl:
chmod a+x /boot/common/bin/perl
- cd /boot/common/lib; ln -s perl5/5.21.10/BePC-haiku/CORE/libperl.so .
+ cd /boot/common/lib; ln -s perl5/5.21.11/BePC-haiku/CORE/libperl.so .
-Replace C<5.21.10> with your respective version of Perl.
+Replace C<5.21.11> with your respective version of Perl.
=head1 KNOWN PROBLEMS
This document briefly describes Perl under Mac OS X.
- curl -O http://www.cpan.org/src/perl-5.21.10.tar.gz
- tar -xzf perl-5.21.10.tar.gz
- cd perl-5.21.10
+ curl -O http://www.cpan.org/src/perl-5.21.11.tar.gz
+ tar -xzf perl-5.21.11.tar.gz
+ cd perl-5.21.11
./Configure -des -Dprefix=/usr/local/
make
make test
=head1 DESCRIPTION
-The latest Perl release (5.21.10 as of this writing) builds without changes
+The latest Perl release (5.21.11 as of this writing) builds without changes
under all versions of Mac OS X from 10.3 "Panther" onwards.
In order to build your own version of Perl you will need 'make',
=item Additional Perl modules
- unzip perl_ste.zip -d f:/perllib/lib/site_perl/5.21.10/
+ unzip perl_ste.zip -d f:/perllib/lib/site_perl/5.21.11/
Same remark as above applies. Additionally, if this directory is not
one of directories on @INC (and @INC is influenced by C<PERLLIB_PREFIX>), you
choice. Once you have done so, use a command like the following to
unpack the archive:
- vmstar -xvf perl-5^.21^.10.tar
+ vmstar -xvf perl-5^.21^.11.tar
Then set default to the top-level source directory like so:
- set default [.perl-5^.21^.10]
+ set default [.perl-5^.21^.11]
and proceed with configuration as described in the next section.
#endif /* _INC_PERL_XSUB_H */ /* include guard */
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
}
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
#define newAV() MUTABLE_AV(newSV_type(SVt_PVAV))
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
}
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
multicall_cop = CvSTART(cv); \
} STMT_END
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
--- /dev/null
+;; Empty file to avoid imposing the defaults from the parent directory
+;; on code imported from CPAN
# vim: ts=4 sts=4 sw=4:
use strict;
package CPAN;
-$CPAN::VERSION = '2.10';
+$CPAN::VERSION = '2.11';
$CPAN::VERSION =~ s/_//;
# we need to run chdir all over and we would get at wrong libraries
},
$CPAN::VERSION,
- $rl_avail
)
}
my($continuation) = "";
use Config;
use Exporter;
use vars qw($VERSION @ISA @EXPORT_OK %EXPORT_TAGS);
-$VERSION = "0.23";
+$VERSION = "0.24";
@ISA = ("Exporter");
@EXPORT_OK = qw( plv2hash summary myconfig signature );
%EXPORT_TAGS = (
USE_LOCALE_TIME
USE_LONG_DOUBLE
USE_PERLIO
+ USE_QUADMATH
USE_REENTRANT_API
USE_SFIO
USE_SOCKS
BEGIN {
use Test::More;
- my $tests = 92;
+ my $tests = 93;
unless ($ENV{PERL_CORE}) {
require Test::NoWarnings;
Test::NoWarnings->import ();
BEGIN {
use Test::More;
- my $tests = 92;
+ my $tests = 93;
unless ($ENV{PERL_CORE}) {
require Test::NoWarnings;
Test::NoWarnings->import ();
BEGIN {
use Test::More;
- my $tests = 91;
+ my $tests = 92;
unless ($ENV{PERL_CORE}) {
require Test::NoWarnings;
Test::NoWarnings->import ();
BEGIN {
use Test::More;
- my $tests = 93;
+ my $tests = 94;
unless ($ENV{PERL_CORE}) {
require Test::NoWarnings;
Test::NoWarnings->import ();
BEGIN {
use Test::More;
- my $tests = 93;
+ my $tests = 94;
unless ($ENV{PERL_CORE}) {
require Test::NoWarnings;
Test::NoWarnings->import ();
BEGIN {
use Test::More;
- my $tests = 92;
+ my $tests = 93;
unless ($ENV{PERL_CORE}) {
require Test::NoWarnings;
Test::NoWarnings->import ();
BEGIN {
use Test::More;
- my $tests = 150;
+ my $tests = 151;
unless ($ENV{PERL_CORE}) {
require Test::NoWarnings;
Test::NoWarnings->import ();
BEGIN {
use Test::More;
- my $tests = 111;
+ my $tests = 112;
unless ($ENV{PERL_CORE}) {
require Test::NoWarnings;
Test::NoWarnings->import ();
BEGIN {
use Test::More;
- my $tests = 111;
+ my $tests = 112;
unless ($ENV{PERL_CORE}) {
require Test::NoWarnings;
Test::NoWarnings->import ();
BEGIN {
use Test::More;
- my $tests = 111;
+ my $tests = 112;
unless ($ENV{PERL_CORE}) {
require Test::NoWarnings;
Test::NoWarnings->import ();
# $VERSION needs to be set before use base 'IO::Socket'
# - https://rt.cpan.org/Ticket/Display.html?id=92107
BEGIN {
- $VERSION = '0.36';
+ $VERSION = '0.37';
}
use strict;
my @localinfos;
my @peerinfos;
+ my $listenqueue = $arg->{Listen};
+ if( defined $listenqueue and
+ ( defined $arg->{PeerHost} || defined $arg->{PeerService} || defined $arg->{PeerAddrInfo} ) ) {
+ croak "Cannot Listen with a peer address";
+ }
+
if( defined $arg->{GetAddrInfoFlags} ) {
$hints{flags} = $arg->{GetAddrInfoFlags};
}
push @sockopts_enabled, SO_REUSEPORT if $arg->{ReusePort};
push @sockopts_enabled, SO_BROADCAST if $arg->{Broadcast};
- my $listenqueue = $arg->{Listen};
-
- croak "Cannot Listen with a PeerHost" if defined $listenqueue and @peerinfos;
-
my $blocking = $arg->{Blocking};
defined $blocking or $blocking = 1;
return 1;
}
- if( $! == EINPROGRESS or HAVE_MSWIN32 && $! == Errno::EWOULDBLOCK() ) {
+ if( $! == EINPROGRESS or $! == EWOULDBLOCK ) {
${*$self}{io_socket_ip_connect_in_progress} = 1;
return 0;
}
=cut
-sub sockhost { my $self = shift; ( $self->_get_host_service( $self->sockname, NI_NUMERICHOST, NIx_NOSERV ) )[0] }
-sub sockport { my $self = shift; ( $self->_get_host_service( $self->sockname, NI_NUMERICSERV, NIx_NOHOST ) )[1] }
+sub sockhost { my $self = shift; scalar +( $self->_get_host_service( $self->sockname, NI_NUMERICHOST, NIx_NOSERV ) )[0] }
+sub sockport { my $self = shift; scalar +( $self->_get_host_service( $self->sockname, NI_NUMERICSERV, NIx_NOHOST ) )[1] }
-sub sockhostname { my $self = shift; ( $self->_get_host_service( $self->sockname, 0, NIx_NOSERV ) )[0] }
-sub sockservice { my $self = shift; ( $self->_get_host_service( $self->sockname, 0, NIx_NOHOST ) )[1] }
+sub sockhostname { my $self = shift; scalar +( $self->_get_host_service( $self->sockname, 0, NIx_NOSERV ) )[0] }
+sub sockservice { my $self = shift; scalar +( $self->_get_host_service( $self->sockname, 0, NIx_NOHOST ) )[1] }
=head2 $addr = $sock->sockaddr
=cut
-sub peerhost { my $self = shift; ( $self->_get_host_service( $self->peername, NI_NUMERICHOST, NIx_NOSERV ) )[0] }
-sub peerport { my $self = shift; ( $self->_get_host_service( $self->peername, NI_NUMERICSERV, NIx_NOHOST ) )[1] }
+sub peerhost { my $self = shift; scalar +( $self->_get_host_service( $self->peername, NI_NUMERICHOST, NIx_NOSERV ) )[0] }
+sub peerport { my $self = shift; scalar +( $self->_get_host_service( $self->peername, NI_NUMERICSERV, NIx_NOHOST ) )[1] }
-sub peerhostname { my $self = shift; ( $self->_get_host_service( $self->peername, 0, NIx_NOSERV ) )[0] }
-sub peerservice { my $self = shift; ( $self->_get_host_service( $self->peername, 0, NIx_NOHOST ) )[1] }
+sub peerhostname { my $self = shift; scalar +( $self->_get_host_service( $self->peername, 0, NIx_NOSERV ) )[0] }
+sub peerservice { my $self = shift; scalar +( $self->_get_host_service( $self->peername, 0, NIx_NOHOST ) )[1] }
=head2 $addr = $peer->peeraddr
# Versions of IO::Socket before 1.35 may leave socktype undef if from, say, an
# ->fdopen call. In this case we'll apply a fix
BEGIN {
- if( $IO::Socket::VERSION < 1.35 ) {
+ if( eval($IO::Socket::VERSION) < 1.35 ) {
*socktype = sub {
my $self = shift;
my $type = $self->SUPER::socktype;
my $testserver = IO::Socket::IP->new(
( $socktype eq "SOCK_STREAM" ? ( Listen => 1 ) : () ),
LocalHost => "127.0.0.1",
- Port => 0,
+ LocalPort => "0",
Type => Socket->$socktype,
);
ok( eval { $testserver->peerport; 1 }, "\$testserver->peerport does not die for $socktype" )
or do { chomp( my $e = $@ ); diag( "Exception was: $e" ) };
+ is_deeply( { host => $testserver->peerhost, port => $testserver->peerport },
+ { host => undef, port => undef },
+ 'peerhost/peersock yield scalar' );
+
my $socket = IO::Socket::INET->new(
PeerHost => "127.0.0.1",
PeerPort => $testserver->sockport,
my $testserver = IO::Socket::IP->new(
( $socktype eq "SOCK_STREAM" ? ( Listen => 1 ) : () ),
LocalHost => "127.0.0.1",
- Port => 0,
+ LocalPort => "0",
Type => Socket->$socktype,
) or die "Cannot listen on PF_INET - $@";
my $testserver = IO::Socket::IP->new(
( $socktype eq "SOCK_STREAM" ? ( Listen => 1 ) : () ),
LocalHost => "::1",
- Port => 0,
+ LocalPort => "0",
Type => Socket->$socktype,
GetAddrInfoFlags => 0, # disable AI_ADDRCONFIG
);
my $testserver = IO::Socket::IP->new(
( $socktype eq "SOCK_STREAM" ? ( Listen => 1 ) : () ),
LocalHost => "::1",
- Port => 0,
+ LocalPort => "0",
Type => Socket->$socktype,
) or die "Cannot listen on PF_INET6 - $@";
eval { defined IPV6_V6ONLY } or
plan skip_all => "IPV6_V6ONLY not available";
+# https://rt.cpan.org/Ticket/Display.html?id=102662
+$^O eq "irix" and
+ plan skip_all => "$^O: IPV6_V6ONLY exists but getnameinfo() fails with EAI_NONAME";
+
# Don't be locale-sensitive
$! = Errno::ECONNREFUSED;
my $ECONNREFUSED_STR = "$!";
#endif
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
}
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
our $VERSION;
BEGIN {
- $VERSION = '3.27';
+ $VERSION = '3.28';
}
use ExtUtils::ParseXS::Constants $VERSION;
use ExtUtils::ParseXS::CountLines $VERSION;
use warnings;
use Symbol;
-our $VERSION = '3.27';
+our $VERSION = '3.28';
=head1 NAME
package ExtUtils::ParseXS::CountLines;
use strict;
-our $VERSION = '3.27';
+our $VERSION = '3.28';
our $SECTION_END_MARKER;
use strict;
use warnings;
-our $VERSION = '3.27';
+our $VERSION = '3.28';
=head1 NAME
use warnings;
use Exporter;
use File::Spec;
-use lib qw( lib );
use ExtUtils::ParseXS::Constants ();
-our $VERSION = '3.27';
+our $VERSION = '3.28';
our (@ISA, @EXPORT_OK);
@ISA = qw(Exporter);
use 5.006001;
use strict;
use warnings;
-our $VERSION = '3.25';
-#use Carp qw(croak);
+our $VERSION = '3.28';
require ExtUtils::ParseXS;
require ExtUtils::ParseXS::Constants;
use 5.006001;
use strict;
use warnings;
-our $VERSION = '3.25';
+our $VERSION = '3.28';
use ExtUtils::Typemaps;
use 5.006001;
use strict;
use warnings;
-our $VERSION = '3.25';
+our $VERSION = '3.28';
=head1 NAME
use 5.006001;
use strict;
use warnings;
-our $VERSION = '3.25';
+our $VERSION = '3.28';
=head1 NAME
use warnings;
require ExtUtils::Typemaps;
-our $VERSION = '3.25';
+our $VERSION = '3.28';
=head1 NAME
or ask your system administrator to run the make for you.
Alternately, you can specify the exact directory to place the extension's
-files by placing a "PREFIX=/destination/directory" after the make install.
+files by placing a "PREFIX=/destination/directory" after the make install
(or in between the make and install if you have a brain-dead version of make).
This can be very useful if you are building an extension that will eventually
be distributed to multiple systems. You can then just archive the files in
+5.20150420
+ - Updated for v5.21.11
+
5.20150320
- Updated for v5.21.10
%bug_tracker %deprecated %delta/;
use Module::CoreList::TieHashDelta;
use version;
-$VERSION = '5.20150320';
+$VERSION = '5.20150420';
sub _released_order { # Sort helper, to make '?' sort after everything else
(substr($released{$a}, 0, 1) eq "?")
5.020002 => '2015-02-14',
5.021009 => '2015-02-21',
5.021010 => '2015-03-20',
+ 5.021011 => '2015-04-20',
);
for my $version ( sort { $a <=> $b } keys %released ) {
'Test::Stream::Util' => 1,
}
},
+ 5.021011 => {
+ delta_from => 5.021010,
+ changed => {
+ 'B' => '1.58',
+ 'B::Deparse' => '1.35',
+ 'B::Op_private' => '5.021011',
+ 'CPAN' => '2.11',
+ 'Config' => '5.021011',
+ 'Config::Perl::V' => '0.24',
+ 'Cwd' => '3.56',
+ 'ExtUtils::Miniperl' => '1.05',
+ 'ExtUtils::ParseXS' => '3.28',
+ 'ExtUtils::ParseXS::Constants'=> '3.28',
+ 'ExtUtils::ParseXS::CountLines'=> '3.28',
+ 'ExtUtils::ParseXS::Eval'=> '3.28',
+ 'ExtUtils::ParseXS::Utilities'=> '3.28',
+ 'ExtUtils::Typemaps' => '3.28',
+ 'ExtUtils::Typemaps::Cmd'=> '3.28',
+ 'ExtUtils::Typemaps::InputMap'=> '3.28',
+ 'ExtUtils::Typemaps::OutputMap'=> '3.28',
+ 'ExtUtils::Typemaps::Type'=> '3.28',
+ 'File::Spec' => '3.56',
+ 'File::Spec::Cygwin' => '3.56',
+ 'File::Spec::Epoc' => '3.56',
+ 'File::Spec::Functions' => '3.56',
+ 'File::Spec::Mac' => '3.56',
+ 'File::Spec::OS2' => '3.56',
+ 'File::Spec::Unix' => '3.56',
+ 'File::Spec::VMS' => '3.56',
+ 'File::Spec::Win32' => '3.56',
+ 'IO::Socket::IP' => '0.37',
+ 'Module::CoreList' => '5.20150420',
+ 'Module::CoreList::TieHashDelta'=> '5.20150420',
+ 'Module::CoreList::Utils'=> '5.20150420',
+ 'PerlIO::mmap' => '0.014',
+ 'XS::APItest' => '0.72',
+ 'attributes' => '0.27',
+ 'if' => '0.0604',
+ 'utf8' => '1.16',
+ 'warnings' => '1.32',
+ },
+ removed => {
+ }
+ },
);
sub is_core
my $final_release = removed_from($module);
- return 0 if defined($final_release) && $perl_version > $final_release;
+ return 0 if defined($final_release) && $perl_version >= $final_release;
# If a minimum version of the module was specified:
# Step through all perl releases ($prn)
my @releases = ($perl_version);
my $rel = $perl_version;
while (defined($rel)) {
- $rel = $delta{$rel}->{delta_from};
+ # XXX: This line is a sign of failure. -- rjbs, 2015-04-15
+ my $this_delta = $delta{$rel} || $delta{ sprintf '%0.6f', $rel };
+ $rel = $this_delta->{delta_from};
unshift(@releases, $rel) if defined($rel);
}
RELEASE:
removed => {
}
},
+ 5.021011 => {
+ delta_from => 5.02101,
+ changed => {
+ },
+ removed => {
+ }
+ },
);
for my $version (sort { $a <=> $b } keys %deprecated) {
use strict;
use vars qw($VERSION);
-$VERSION = '5.20150320';
+$VERSION = '5.20150420';
sub TIEHASH {
my ($class, $changed, $removed, $parent) = @_;
use Module::CoreList;
use Module::CoreList::TieHashDelta;
-$VERSION = '5.20150320';
+$VERSION = '5.20150420';
sub utilities {
my $perl = shift;
removed => {
}
},
+ 5.021011 => {
+ delta_from => 5.02101,
+ changed => {
+ },
+ removed => {
+ }
+ },
);
for my $version (sort { $a <=> $b } keys %delta) {
#!perl -w
use strict;
use Module::CoreList;
-use Test::More tests => 34;
+use Test::More tests => 38;
BEGIN { require_ok('Module::CoreList'); }
ok(Module::CoreList->is_core('DB_File', '1.01', '5.002'), "DB_File 1.01 was included in 5.002");
ok(!Module::CoreList->is_core('DB_File', '1.03', '5.002'), "DB_File 1.03 wasn't included in 5.002");
ok(Module::CoreList->is_core('DB_File', '1.03', '5.00307'), "DB_File 1.03 was included in 5.00307");
+
+ok(! Module::CoreList->is_core("CGI", undef, 5.021), "CGI not in 5.021");
+ok(! Module::CoreList->is_core("CGI", undef, 5.021001), "CGI not in 5.021001");
+
+ok( Module::CoreList::is_core("Config", 0, "5.020"), "Config v0+ is in core in 5.020");
+ok( Module::CoreList::is_core("Config", undef, "5.020"), "Config v(undef) is in core in 7.020");
use Exporter;
use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION);
-$VERSION = '3.55';
+$VERSION = '3.56';
my $xs_version = $VERSION;
$VERSION =~ tr/_//;
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
use strict;
use vars qw(@ISA $VERSION);
-$VERSION = '3.55';
+$VERSION = '3.56';
$VERSION =~ tr/_//;
my %module = (MacOS => 'Mac',
use vars qw(@ISA $VERSION);
require File::Spec::Unix;
-$VERSION = '3.55';
+$VERSION = '3.56';
$VERSION =~ tr/_//;
@ISA = qw(File::Spec::Unix);
use strict;
use vars qw($VERSION @ISA);
-$VERSION = '3.55';
+$VERSION = '3.56';
$VERSION =~ tr/_//;
require File::Spec::Unix;
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION);
-$VERSION = '3.55';
+$VERSION = '3.56';
$VERSION =~ tr/_//;
require Exporter;
use vars qw(@ISA $VERSION);
require File::Spec::Unix;
-$VERSION = '3.55';
+$VERSION = '3.56';
$VERSION =~ tr/_//;
@ISA = qw(File::Spec::Unix);
use vars qw(@ISA $VERSION);
require File::Spec::Unix;
-$VERSION = '3.55';
+$VERSION = '3.56';
$VERSION =~ tr/_//;
@ISA = qw(File::Spec::Unix);
use strict;
use vars qw($VERSION);
-$VERSION = '3.55';
+$VERSION = '3.56';
my $xs_version = $VERSION;
$VERSION =~ tr/_//;
use vars qw(@ISA $VERSION);
require File::Spec::Unix;
-$VERSION = '3.55';
+$VERSION = '3.56';
$VERSION =~ tr/_//;
@ISA = qw(File::Spec::Unix);
use vars qw(@ISA $VERSION);
require File::Spec::Unix;
-$VERSION = '3.55';
+$VERSION = '3.56';
$VERSION =~ tr/_//;
@ISA = qw(File::Spec::Unix);
package if;
-$VERSION = '0.0603';
+$VERSION = '0.0604';
sub work {
my $method = shift() ? 'import' : 'unimport';
=head1 NAME
-if - C<use> a Perl module if a condition holds
+if - C<use> a Perl module if a condition holds (also can C<no> a module)
=head1 SYNOPSIS
use if CONDITION, MODULE => ARGUMENTS;
+ no if CONDITION, MODULE => ARGUMENTS;
=head1 DESCRIPTION
-The C<if> module is used to conditionally load another module.
+The C<if> module is used to conditionally load or unload another module.
The construct
use if CONDITION, MODULE => ARGUMENTS;
and if so, generates a warning),
unless you've installed a more recent version of L<Text::Soundex> from CPAN.
+You can also specify to NOT use something:
+
+ no if $] ge 5.021_006, warnings => "locale";
+
+This warning category was added in the specified Perl version (a development
+release). Without the C<'if'>, trying to use it in an earlier release would
+generate an unknown warning category error.
+
=head1 BUGS
The current implementation does not allow specification of the
}
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
}
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
#define PERL_NO_DEV_RANDOM
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
}
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
if (o->op_savefree) sv_catpvs(tmpsv, ",SAVEFREE");
if (o->op_static) sv_catpvs(tmpsv, ",STATIC");
if (o->op_folded) sv_catpvs(tmpsv, ",FOLDED");
- if (o->op_lastsib) sv_catpvs(tmpsv, ",LASTSIB");
+ if (o->op_moresib) sv_catpvs(tmpsv, ",MORESIB");
Perl_dump_indent(aTHX_ level, file, "FLAGS = (%s)\n",
SvCUR(tmpsv) ? SvPVX_const(tmpsv) + 1 : "");
}
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
EXp |void |op_clear |NN OP* o
Ap |void |op_refcnt_lock
Ap |void |op_refcnt_unlock
-Apdn |OP* |op_sibling_splice|NN OP *parent|NULLOK OP *start \
+Apdn |OP* |op_sibling_splice|NULLOK OP *parent|NULLOK OP *start \
|int del_count|NULLOK OP* insert
+#ifdef PERL_OP_PARENT
Apdn |OP* |op_parent|NN OP *o
+#endif
#if defined(PERL_IN_OP_C)
s |OP* |listkids |NULLOK OP* o
#endif
#endif
#if defined(PERL_IN_DUMP_C)
-s |CV* |deb_curcv |const I32 ix
+s |CV* |deb_curcv |I32 ix
s |void |debprof |NN const OP *o
s |UV |sequence_num |NULLOK const OP *o
s |SV* |pm_description |NN const PMOP *pm
#define op_free(a) Perl_op_free(aTHX_ a)
#define op_linklist(a) Perl_op_linklist(aTHX_ a)
#define op_null(a) Perl_op_null(aTHX_ a)
-#define op_parent Perl_op_parent
#define op_prepend_elem(a,b,c) Perl_op_prepend_elem(aTHX_ a,b,c)
#define op_refcnt_lock() Perl_op_refcnt_lock(aTHX)
#define op_refcnt_unlock() Perl_op_refcnt_unlock(aTHX)
#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C)
#define _get_regclass_nonbitmap_data(a,b,c,d,e,f) Perl__get_regclass_nonbitmap_data(aTHX_ a,b,c,d,e,f)
#endif
+#if defined(PERL_OP_PARENT)
+#define op_parent Perl_op_parent
+#endif
#if defined(UNLINK_ALL_VERSIONS)
#define unlnk(a) Perl_unlnk(aTHX_ a)
#endif
# walkoptree comes from B.xs
BEGIN {
- $B::VERSION = '1.57';
+ $B::VERSION = '1.58';
@B::EXPORT_OK = ();
# Our BOOT code needs $VERSION set, and will append to @EXPORT_OK.
{ STR_WITH_LEN("static"), op_offset_special, 0, },/*49*/
# if PERL_VERSION >= 19
{ STR_WITH_LEN("folded"), op_offset_special, 0, },/*50*/
- { STR_WITH_LEN("lastsib"), op_offset_special, 0, },/*51*/
+ { STR_WITH_LEN("moresib"), op_offset_special, 0, },/*51*/
{ STR_WITH_LEN("parent"), op_offset_special, 0, },/*52*/
# endif
#endif
B::OP::savefree = 48
B::OP::static = 49
B::OP::folded = 50
- B::OP::lastsib = 51
+ B::OP::moresib = 51
B::OP::parent = 52
B::METHOP::first = 53
B::METHOP::meth_sv = 54
case 49: /* B::OP::static */
#if PERL_VERSION >= 19
case 50: /* B::OP::folded */
- case 51: /* B::OP::lastsib */
+ case 51: /* B::OP::moresib */
#endif
#endif
/* These are all bitfields, so we can't take their addresses */
: ix == 48 ? o->op_savefree
: ix == 49 ? o->op_static
: ix == 50 ? o->op_folded
- : ix == 51 ? o->op_lastsib
+ : ix == 51 ? o->op_moresib
: o->op_spare)));
break;
case 33: /* B::LISTOP::children */
PTR2IV(CopHINTHASH_get(cCOPo)));
break;
case 52: /* B::OP::parent */
+#ifdef PERL_OP_PARENT
ret = make_op_object(aTHX_ op_parent(o));
+#else
+ ret = make_op_object(aTHX_ NULL);
+#endif
break;
case 53: /* B::METHOP::first */
/* METHOP struct has an op_first/op_meth_sv union
# test op_parent
SKIP: {
- unless ($Config::Config{ccflags} =~ /PERL_OP_PARENT/) {
+ unless ($B::OP::does_parent) {
skip "op_parent only present with -DPERL_OP_PARENT builds", 6;
}
my $lineseq = B::svref_2object(sub{my $x = 1})->ROOT->first;
my $first = $lineseq->first;
my $second = $first->sibling;
is(ref $second->sibling, "B::NULL", 'op_parent: second sibling is null');
- is($first->lastsib, 0 , 'op_parent: first sibling: !lastsib');
- is($second->lastsib, 1, 'op_parent: second sibling: lastsib');
+ is($first->moresib, 1 , 'op_parent: first sibling: moresib');
+ is($second->moresib, 0, 'op_parent: second sibling: !moresib');
is($$lineseq, ${$first->parent}, 'op_parent: first sibling okay');
is($$lineseq, ${$second->parent}, 'op_parent: second sibling okay');
}
{
1 TYPE = leave ===> NULL
TARG = 1
- FLAGS = (VOID,KIDS,PARENS,SLABBED,LASTSIB)
+ FLAGS = (VOID,KIDS,PARENS,SLABBED)
PRIVATE = (REFC)
REFCNT = 1
{
2 TYPE = enter ===> 3
- FLAGS = (UNKNOWN,SLABBED)
+ FLAGS = (UNKNOWN,SLABBED,MORESIB)
}
{
3 TYPE = nextstate ===> 4
- FLAGS = (VOID,SLABBED)
+ FLAGS = (VOID,SLABBED,MORESIB)
LINE = 1
PACKAGE = "t"
}
{
5 TYPE = entersub ===> 1
TARG = 1
- FLAGS = (VOID,KIDS,STACKED,SLABBED,LASTSIB)
+ FLAGS = (VOID,KIDS,STACKED,SLABBED)
PRIVATE = (TARG)
{
6 TYPE = null ===> (5)
(was list)
- FLAGS = (UNKNOWN,KIDS,SLABBED,LASTSIB)
+ FLAGS = (UNKNOWN,KIDS,SLABBED)
{
4 TYPE = pushmark ===> 7
- FLAGS = (SCALAR,SLABBED)
+ FLAGS = (SCALAR,SLABBED,MORESIB)
}
{
8 TYPE = null ===> (6)
(was rv2cv)
- FLAGS = (SCALAR,KIDS,SLABBED,LASTSIB)
+ FLAGS = (SCALAR,KIDS,SLABBED)
PRIVATE = (0x1)
{
7 TYPE = gv ===> 5
- FLAGS = (SCALAR,SLABBED,LASTSIB)
+ FLAGS = (SCALAR,SLABBED)
GV_OR_PADIX
}
}
@ISA = qw(Exporter);
@EXPORT = qw(writemain);
-$VERSION = '1.04';
+$VERSION = '1.05';
# blead will run this with miniperl, hence we can't use autodie or File::Temp
my $temp;
=cut
-# Local variables:
-# c-indentation-style: bsd
-# c-basic-offset: 4
-# indent-tabs-mode: nil
-# End:
-#
# ex: set ts=8 sts=4 sw=4 et:
package PerlIO::mmap;
use strict;
use warnings;
-our $VERSION = '0.013';
+our $VERSION = '0.014';
use XSLoader;
XSLoader::load(__PACKAGE__, __PACKAGE__->VERSION);
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
use warnings;
use Carp;
-our $VERSION = '0.71';
+our $VERSION = '0.72';
require XSLoader;
}
XPUSHs( gv ? (SV*)gv : &PL_sv_undef);
+SV *
+gv_const_sv(SV *name)
+ PREINIT:
+ GV *gv;
+ CODE:
+ if (SvPOK(name)) {
+ HV *stash = gv_stashpv("main",0);
+ HE *he = hv_fetch_ent(stash, name, 0, 0);
+ gv = (GV *)HeVAL(he);
+ }
+ else {
+ gv = (GV *)name;
+ }
+ RETVAL = gv_const_sv(gv);
+ if (!RETVAL)
+ XSRETURN_EMPTY;
+ RETVAL = newSVsv(RETVAL);
+ OUTPUT:
+ RETVAL
+
void
whichsig_type(namesv, type)
SV* namesv
CvROOT(PL_compcv) = (OP *)1;
o = newFOROP(0, 0, newOP(OP_PUSHMARK, 0), 0, 0);
#ifdef PERL_OP_PARENT
- if (cLOOPx(cUNOPo->op_first)->op_last->op_sibling
+ if (cLOOPx(cUNOPo->op_first)->op_last->op_sibparent
!= cUNOPo->op_first)
{
Perl_warn(aTHX_ "Op parent pointer is stale");
/*
* Local variables:
* mode: c
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
* End:
*
* ex: set ts=8 sts=4 sw=4 et:
--- /dev/null
+#!perl
+
+use strict;
+use warnings;
+use Test::More tests => 6;
+
+use XS::APItest;
+
+sub foo () { "abc" }
+
+sub bar { }
+
+is(XS::APItest::gv_const_sv(*foo), "abc", "on const glob");
+is(XS::APItest::gv_const_sv("foo"), "abc", "on const by name");
+is(XS::APItest::gv_const_sv($::{"foo"}), "abc", "on const by lookup");
+is(XS::APItest::gv_const_sv(*bar), undef, "on non-const glob");
+is(XS::APItest::gv_const_sv("bar"), undef, "on non-const by name");
+is(XS::APItest::gv_const_sv($::{"bar"}), undef, "on non-const by lookup");
package attributes;
-our $VERSION = 0.26;
+our $VERSION = 0.27;
@EXPORT_OK = qw(get reftype);
@EXPORT = ();
XSRETURN(1);
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
#define PERL_NO_GET_CONTEXT
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
#define fgets(s,n,f) _CANNOT _fgets_
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
#include "perlapi.h" /* bring in PL_force_link_funcs */
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
if (SvTYPE(gv) == SVt_PVGV)
return cv_const_sv(GvCVu(gv));
- return SvROK(gv) && SvTYPE(SvRV(gv)) != SVt_PVAV ? SvRV(gv) : NULL;
+ return SvROK(gv) && SvTYPE(SvRV(gv)) != SVt_PVAV && SvTYPE(SvRV(gv)) != SVt_PVCV ? SvRV(gv) : NULL;
}
GP *
}
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
#define gv_SVadd(gv) gv_add_by_type((gv), SVt_NULL)
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
#endif /* HANDY_H */
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
# mkdir -p /opt/perl-catamount
# mkdir -p /opt/perl-catamount/include
# mkdir -p /opt/perl-catamount/lib
-# mkdir -p /opt/perl-catamount/lib/perl5/5.21.10
+# mkdir -p /opt/perl-catamount/lib/perl5/5.21.11
# mkdir -p /opt/perl-catamount/bin
# cp *.h /opt/perl-catamount/include
# cp libperl.a /opt/perl-catamount/lib
-# cp -pr lib/* /opt/perl-catamount/lib/perl5/5.21.10
+# cp -pr lib/* /opt/perl-catamount/lib/perl5/5.21.11
# cp miniperl perl run.sh cc.sh /opt/perl-catamount/lib
#
# With the headers and the libperl.a you can embed Perl to your Catamount
Perl_croak(aTHX_ "panic: refcounted_he_fetch_pvn bad flags %"UVxf,
(UV)flags);
if (!chain)
- return &PL_sv_placeholder;
+ goto ret;
if (flags & REFCOUNTED_HE_KEY_UTF8) {
/* For searching purposes, canonicalise to Latin-1 where possible. */
const char *keyend = keypv + keylen, *p;
return sv_2mortal(refcounted_he_value(chain));
}
}
+ ret:
return flags & REFCOUNTED_HE_EXISTS ? NULL : &PL_sv_placeholder;
}
#endif
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
#include "hv_func.h"
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
#endif /*compile once*/
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
}
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
$packlist->write() unless $opts{notify};
print " Installation complete\n" if $opts{verbose};
-# Local variables:
-# cperl-indent-level: 4
-# indent-tabs-mode: nil
-# End:
-#
# ex: set ts=8 sts=4 sw=4 et:
}
}
-# Local variables:
-# cperl-indent-level: 4
-# indent-tabs-mode: nil
-# End:
-#
# ex: set ts=8 sts=4 sw=4 et:
PERLVARI(I, statname, SV *, NULL)
#ifdef HAS_TIMES
-/* Will be removed soon after v5.21.10. See RT #121351 */
+/* Will be removed soon after v5.21.11. See RT #121351 */
PERLVAR(I, timesbuf, struct tms)
#endif
PERLVARI(I, padlist_generation, U32, 1) /* id to identify padlist clones */
-/* The last unconditional member of the interpreter structure when 5.21.10 was
+/* The last unconditional member of the interpreter structure when 5.21.11 was
released. The offset of the end of this is baked into a global variable in
any shared perl library which will allow a sanity test in future perl
releases. */
#endif /* __Inc__IPerl___ */
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
MDEREF_SHIFT
);
-$VERSION = '1.34';
+$VERSION = '1.35';
use strict;
use vars qw/$AUTOLOAD/;
use warnings ();
my $self = shift;
my($op, $cx) = @_;
my $kid = $op->first;
- return "<" . $self->deparse($kid, 1) . ">" if is_scalar($kid);
+ if (is_scalar($kid)) {
+ my $kid_deparsed = $self->deparse($kid, 1);
+ return '<<>>' if $op->flags & OPf_SPECIAL and $kid_deparsed eq 'ARGV';
+ return "<$kid_deparsed>";
+ }
return $self->unop($op, $cx, "readline");
}
readline *$_;
readline *{$_;};
####
+# <<>>
+$_ = <<>>;
+####
# \x{}
my $foo = "Ab\x{100}\200\x{200}\237Cd\000Ef\x{1000}\cA\x{2000}\cZ";
my $bar = "\x{100}";
our %bits;
-our $VERSION = "5.021010";
+our $VERSION = "5.021011";
$bits{$_}{3} = 'OPpENTERSUB_AMPER' for qw(entersub rv2cv);
$bits{$_}{6} = 'OPpENTERSUB_DB' for qw(entersub rv2cv);
$bits{$_}{6} = 'OPpREFCOUNTED' for qw(leave leaveeval leavesub leavesublv leavewrite);
$bits{$_}{6} = 'OPpRUNTIME' for qw(match pushre qr subst substcont);
$bits{$_}{2} = 'OPpSLICEWARNING' for qw(aslice hslice padav padhv rv2av rv2hv);
-$bits{$_}{4} = 'OPpTARGET_MY' for qw(abs add atan2 chdir chmod chomp chown chr chroot complement concat cos crypt divide exec exp flock getpgrp getppid getpriority hex i_add i_divide i_modulo i_multiply i_ncmp i_subtract index int kill left_shift length link log match mkdir modulo multiply nbit_and nbit_or nbit_xor ncomplement oct ord pow push pushre qr rand rename repeat right_shift rindex rmdir schomp scmp scomplement setpgrp setpriority sin sleep split sqrt srand stringify subst subtract symlink system time trans transr unlink unshift utime vec wait waitpid);
+$bits{$_}{4} = 'OPpTARGET_MY' for qw(abs add atan2 chdir chmod chomp chown chr chroot concat cos crypt divide exec exp flock getpgrp getppid getpriority hex i_add i_divide i_modulo i_multiply i_subtract index int kill left_shift length link log match mkdir modulo multiply nbit_and nbit_or nbit_xor ncomplement oct ord pow push pushre qr rand rename right_shift rindex rmdir schomp scomplement setpgrp setpriority sin sleep sqrt srand stringify subst subtract symlink system time trans transr unlink unshift utime wait waitpid);
$bits{$_}{5} = 'OPpTRANS_COMPLEMENT' for qw(trans transr);
$bits{$_}{7} = 'OPpTRANS_DELETE' for qw(trans transr);
$bits{$_}{0} = 'OPpTRANS_FROM_UTF' for qw(trans transr);
OPpSORT_DESCEND => [qw(sort)],
OPpSPLIT_IMPLIM => [qw(split)],
OPpSUBSTR_REPL_FIRST => [qw(substr)],
- OPpTARGET_MY => [qw(abs add atan2 chdir chmod chomp chown chr chroot complement concat cos crypt divide exec exp flock getpgrp getppid getpriority hex i_add i_divide i_modulo i_multiply i_ncmp i_subtract index int kill left_shift length link log match mkdir modulo multiply nbit_and nbit_or nbit_xor ncomplement oct ord pow push pushre qr rand rename repeat right_shift rindex rmdir schomp scmp scomplement setpgrp setpriority sin sleep split sqrt srand stringify subst subtract symlink system time trans transr unlink unshift utime vec wait waitpid)],
+ OPpTARGET_MY => [qw(abs add atan2 chdir chmod chomp chown chr chroot concat cos crypt divide exec exp flock getpgrp getppid getpriority hex i_add i_divide i_modulo i_multiply i_subtract index int kill left_shift length link log match mkdir modulo multiply nbit_and nbit_or nbit_xor ncomplement oct ord pow push pushre qr rand rename right_shift rindex rmdir schomp scomplement setpgrp setpriority sin sleep sqrt srand stringify subst subtract symlink system time trans transr unlink unshift utime wait waitpid)],
OPpTRANS_COMPLEMENT => [qw(trans transr)],
);
done_testing;
-# Local variables:
-# cperl-indent-level: 4
-# indent-tabs-mode: nil
-# End:
-#
# ex: set ts=8 sts=4 sw=4 et:
# Debugger for Perl 5.00x; perl5db.pl patch level:
use vars qw($VERSION $header);
-$VERSION = '1.48';
+$VERSION = '1.49';
$header = "perl5db.pl version $VERSION";
lock($DBGR);
print "Threads support enabled\n";
} else {
+ *lock = sub(*) {};
*share = sub(\[$@%]) {};
}
}
$utf8::hint_bits = 0x00800000;
-our $VERSION = '1.15';
+our $VERSION = '1.16';
sub import {
$^H |= $utf8::hint_bits;
platforms and UTF-EBCDIC on EBCDIC based platforms.
See also the effects of the C<-C> switch and its cousin, the
-C<$ENV{PERL_UNICODE}>, in L<perlrun>.
+C<PERL_UNICODE> environment variable, in L<perlrun>.
Enabling the C<utf8> pragma has the following effect:
package warnings;
-our $VERSION = '1.31';
+our $VERSION = '1.32';
# Verify that we're called correctly so that warnings will work.
# see also strict.pm.
=head2 Fatal Warnings
X<warning, fatal>
-The presence of the word "FATAL" in the category list will escalate any
-warnings detected from the categories specified in the lexical scope
-into fatal errors. In the code below, the use of C<time>, C<length>
+The presence of the word "FATAL" in the category list will escalate
+warnings in those categories into fatal errors in that lexical scope.
+
+B<NOTE:> FATAL warnings should be used with care, particularly
+C<< FATAL => 'all' >>.
+
+Libraries using L<warnings::warn|/FUNCTIONS> for custom warning categories
+generally don't expect L<warnings::warn|/FUNCTIONS> to be fatal and can wind up
+in an unexpected state as a result. For XS modules issuing categorized
+warnings, such unanticipated exceptions could also expose memory leak bugs.
+
+Moreover, the Perl interpreter itself has had serious bugs involving
+fatalized warnings. For a summary of resolved and unresolved problems as
+of January 2015, please see
+L<this perl5-porters post|http://www.nntp.perl.org/group/perl.perl5.porters/2015/01/msg225235.html>.
+
+While some developers find fatalizing some warnings to be a useful
+defensive programming technique, using C<< FATAL => 'all' >> to fatalize
+all possible warning categories -- including custom ones -- is particularly
+risky. Therefore, the use of C<< FATAL => 'all' >> is
+L<discouraged|perlpolicy/discouraged>.
+
+The L<strictures|strictures/VERSION-2> module on CPAN offers one example of
+a warnings subset that the module's authors believe is relatively safe to
+fatalize.
+
+B<NOTE:> users of FATAL warnings, especially those using
+C<< FATAL => 'all' >>, should be fully aware that they are risking future
+portability of their programs by doing so. Perl makes absolutely no
+commitments to not introduce new warnings or warnings categories in the
+future; indeed, we explicitly reserve the right to do so. Code that may
+not warn now may warn in a future release of Perl if the Perl5 development
+team deems it in the best interests of the community to do so. Should code
+using FATAL warnings break due to the introduction of a new warning we will
+NOT consider it an incompatible change. Users of FATAL warnings should
+take special caution during upgrades to check to see if their code triggers
+any new warnings and should pay particular attention to the fine print of
+the documentation of the features they use to ensure they do not exploit
+features that are documented as risky, deprecated, or unspecified, or where
+the documentation says "so don't do that", or anything with the same sense
+and spirit. Use of such features in combination with FATAL warnings is
+ENTIRELY AT THE USER'S RISK.
+
+The following documentation describes how to use FATAL warnings but the
+perl5 porters strongly recommend that you understand the risks before doing
+so, especially for library code intended for use by others, as there is no
+way for downstream users to change the choice of fatal categories.
+
+In the code below, the use of C<time>, C<length>
and C<join> can all produce a C<"Useless use of xxx in void context">
warning.
C<< no warnings 'FATAL'; >> was unspecified; they did not behave as if
they included the C<< => 'all' >> portion. As of 5.20, they do.)
-B<NOTE:> Users of FATAL warnings, especially
-those using C<< FATAL => 'all' >>
-should be fully aware that they are risking future portability of their
-programs by doing so. Perl makes absolutely no commitments to not
-introduce new warnings, or warnings categories in the future, and indeed
-we explicitly reserve the right to do so. Code that may not warn now may
-warn in a future release of Perl if the Perl5 development team deems it
-in the best interests of the community to do so. Should code using FATAL
-warnings break due to the introduction of a new warning we will NOT
-consider it an incompatible change. Users of FATAL warnings should take
-special caution during upgrades to check to see if their code triggers
-any new warnings and should pay particular attention to the fine print of
-the documentation of the features they use to ensure they do not exploit
-features that are documented as risky, deprecated, or unspecified, or where
-the documentation says "so don't do that", or anything with the same sense
-and spirit. Use of such features in combination with FATAL warnings is
-ENTIRELY AT THE USER'S RISK.
-
=head2 Reporting Warnings from a Module
X<warning, reporting> X<warning, registering>
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
Perl_my_cxt_index
);
}
+
+unless ($define{'PERL_OP_PARENT'}) {
+ ++$skip{$_} foreach qw(
+ Perl_op_parent
+ );
+}
+
if ($define{'NO_MATHOMS'}) {
# win32 builds happen in the win32/ subdirectory, but vms builds happen
# at the top level, so we need to look in two candidate locations for
#endif /* ! defined USE_PERL_SBRK */
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
return NATIVE_TO_UNI(valid_utf8_to_uvchr(s, retlen));
}
-void
-Perl_save_re_context(pTHX)
-{
- PERL_UNUSED_CONTEXT;
-}
-
/*
=for apidoc Am|HV *|pad_compname_type|PADOFFSET po
#endif /* NO_MATHOMS */
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
if (flags & G_WRITING_TO_STDERR) {
SAVETMPS;
+ save_re_context();
SAVESPTR(PL_stderrgv);
PL_stderrgv = NULL;
}
}
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
#define whichsig(pv) whichsig_pv(pv)
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
}
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
#endif
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
#endif /*not define EBCDIC */
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
#endif
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
DEBUG_S_warn((aTHX_ "allocating op at %p, slab %p", (void*)o, (void*)slab));
gotit:
- /* lastsib == 1, op_sibling == 0 implies a solitary unattached op */
- o->op_lastsib = 1;
- assert(!o->op_sibling);
+#ifdef PERL_OP_PARENT
+ /* moresib == 0, op_sibling == 0 implies a solitary unattached op */
+ assert(!o->op_moresib);
+ assert(!o->op_sibparent);
+#endif
return (void *)o;
}
more different nodes. Performs the necessary op_first/op_last
housekeeping on the parent node and op_sibling manipulation on the
children. The last deleted node will be marked as as the last node by
-updating the op_sibling or op_lastsib field as appropriate.
+updating the op_sibling/op_sibparent or op_moresib field as appropriate.
Note that op_next is not manipulated, and nodes are not freed; that is the
responsibility of the caller. It also won't create a new list op for an
empty list etc; use higher-level functions like op_append_elem() for that.
-parent is the parent node of the sibling chain.
+parent is the parent node of the sibling chain. It may passed as NULL if
+the splicing doesn't affect the first or last op in the chain.
start is the node preceding the first node to be spliced. Node(s)
following it will be deleted, and ops will be inserted after it. If it is
splice(P, B, 0, X-Y) | | NULL
A-B-C-D A-B-X-Y-C-D
+
+For lower-level direct manipulation of C<op_sibparent> and C<op_moresib>,
+see C<OpMORESIB_set>, C<OpLASTSIB_set>, C<OpMAYBESIB_set>.
+
=cut
*/
OP *
Perl_op_sibling_splice(OP *parent, OP *start, int del_count, OP* insert)
{
- OP *first = start ? OpSIBLING(start) : cLISTOPx(parent)->op_first;
+ OP *first;
OP *rest;
OP *last_del = NULL;
OP *last_ins = NULL;
- PERL_ARGS_ASSERT_OP_SIBLING_SPLICE;
+ if (start)
+ first = OpSIBLING(start);
+ else if (!parent)
+ goto no_parent;
+ else
+ first = cLISTOPx(parent)->op_first;
assert(del_count >= -1);
while (--del_count && OpHAS_SIBLING(last_del))
last_del = OpSIBLING(last_del);
rest = OpSIBLING(last_del);
- OpSIBLING_set(last_del, NULL);
- last_del->op_lastsib = 1;
+ OpLASTSIB_set(last_del, NULL);
}
else
rest = first;
last_ins = insert;
while (OpHAS_SIBLING(last_ins))
last_ins = OpSIBLING(last_ins);
- OpSIBLING_set(last_ins, rest);
- last_ins->op_lastsib = rest ? 0 : 1;
+ OpMAYBESIB_set(last_ins, rest, NULL);
}
else
insert = rest;
if (start) {
- OpSIBLING_set(start, insert);
- start->op_lastsib = insert ? 0 : 1;
+ OpMAYBESIB_set(start, insert, NULL);
}
else {
+ if (!parent)
+ goto no_parent;
cLISTOPx(parent)->op_first = insert;
if (insert)
parent->op_flags |= OPf_KIDS;
if (!rest) {
/* update op_last etc */
- U32 type = parent->op_type;
+ U32 type;
OP *lastop;
+ if (!parent)
+ goto no_parent;
+
+ type = parent->op_type;
if (type == OP_NULL)
type = parent->op_targ;
type = PL_opargs[type] & OA_CLASS_MASK;
)
cLISTOPx(parent)->op_last = lastop;
- if (lastop) {
- lastop->op_lastsib = 1;
-#ifdef PERL_OP_PARENT
- lastop->op_sibling = parent;
-#endif
- }
+ if (lastop)
+ OpLASTSIB_set(lastop, parent);
}
return last_del ? first : NULL;
+
+ no_parent:
+ Perl_croak_nocontext("panic: op_sibling_splice(): NULL parent");
}
+
+#ifdef PERL_OP_PARENT
+
/*
=for apidoc op_parent
-returns the parent OP of o, if it has a parent. Returns NULL otherwise.
-(Currently perl must be built with C<-DPERL_OP_PARENT> for this feature to
-work.
+Returns the parent OP of o, if it has a parent. Returns NULL otherwise.
+This function is only available on perls built with C<-DPERL_OP_PARENT>.
=cut
*/
Perl_op_parent(OP *o)
{
PERL_ARGS_ASSERT_OP_PARENT;
-#ifdef PERL_OP_PARENT
while (OpHAS_SIBLING(o))
o = OpSIBLING(o);
- return o->op_sibling;
-#else
- PERL_UNUSED_ARG(o);
- return NULL;
-#endif
+ return o->op_sibparent;
}
+#endif
+
/* replace the sibling following start with a new UNOP, which becomes
* the parent of the original sibling; e.g.
logop->op_flags = OPf_KIDS;
while (kid && OpHAS_SIBLING(kid))
kid = OpSIBLING(kid);
- if (kid) {
- kid->op_lastsib = 1;
-#ifdef PERL_OP_PARENT
- kid->op_sibling = (OP*)logop;
-#endif
- }
+ if (kid)
+ OpLASTSIB_set(kid, (OP*)logop);
return logop;
}
#ifdef DEBUGGING
/* check that op_last points to the last sibling, and that
- * the last op_sibling field points back to the parent, and
- * that the only ops with KIDS are those which are entitled to
- * them */
+ * the last op_sibling/op_sibparent field points back to the
+ * parent, and that the only ops with KIDS are those which are
+ * entitled to them */
U32 type = o->op_type;
U32 family;
bool has_last;
if (!OpHAS_SIBLING(kid)) {
if (has_last)
assert(kid == cLISTOPo->op_last);
- assert(kid->op_sibling == o);
+ assert(kid->op_sibparent == o);
}
# else
- if (OpHAS_SIBLING(kid)) {
- assert(!kid->op_lastsib);
- }
- else {
- assert(kid->op_lastsib);
- if (has_last)
- assert(kid == cLISTOPo->op_last);
- }
+ if (has_last && !OpHAS_SIBLING(kid))
+ assert(kid == cLISTOPo->op_last);
# endif
}
#endif
case OP_RV2CV:
kid = cUNOPo->op_first;
if (kid->op_type == OP_NULL)
- kid = cUNOPx(kUNOP->op_first->op_sibling)
+ kid = cUNOPx(OpSIBLING(kUNOP->op_first))
->op_first;
o->op_private = OPpLVREF_CV;
if (kid->op_type == OP_GV)
if (last->op_type != (unsigned)type)
return op_append_elem(type, first, last);
- ((LISTOP*)first)->op_last->op_lastsib = 0;
- OpSIBLING_set(((LISTOP*)first)->op_last, ((LISTOP*)last)->op_first);
+ OpMORESIB_set(((LISTOP*)first)->op_last, ((LISTOP*)last)->op_first);
((LISTOP*)first)->op_last = ((LISTOP*)last)->op_last;
- ((LISTOP*)first)->op_last->op_lastsib = 1;
-#ifdef PERL_OP_PARENT
- ((LISTOP*)first)->op_last->op_sibling = first;
-#endif
+ OpLASTSIB_set(((LISTOP*)first)->op_last, first);
first->op_flags |= (last->op_flags & OPf_KIDS);
-
S_op_destroy(aTHX_ last);
return first;
if (o) {
/* manually detach any siblings then add them back later */
rest = OpSIBLING(o);
- OpSIBLING_set(o, NULL);
- o->op_lastsib = 1;
+ OpLASTSIB_set(o, NULL);
}
o = newLISTOP(OP_LIST, 0, o, NULL);
if (rest)
else if (!first && last)
first = last;
else if (first)
- OpSIBLING_set(first, last);
+ OpMORESIB_set(first, last);
listop->op_first = first;
listop->op_last = last;
if (type == OP_LIST) {
OP* const pushop = newOP(OP_PUSHMARK, 0);
- pushop->op_lastsib = 0;
- OpSIBLING_set(pushop, first);
+ OpMORESIB_set(pushop, first);
listop->op_first = pushop;
listop->op_flags |= OPf_KIDS;
if (!last)
listop->op_last = pushop;
}
- if (first)
- first->op_lastsib = 0;
- if (listop->op_last) {
- listop->op_last->op_lastsib = 1;
-#ifdef PERL_OP_PARENT
- listop->op_last->op_sibling = (OP*)listop;
-#endif
- }
+ if (listop->op_last)
+ OpLASTSIB_set(listop->op_last, (OP*)listop);
return CHECKOP(type, listop);
}
unop->op_flags = (U8)(flags | OPf_KIDS);
unop->op_private = (U8)(1 | (flags >> 8));
-#ifdef PERL_OP_PARENT
if (!OpHAS_SIBLING(first)) /* true unless weird syntax error */
- first->op_sibling = (OP*)unop;
-#endif
+ OpLASTSIB_set(first, (OP*)unop);
unop = (UNOP*) CHECKOP(type, unop);
if (unop->op_next)
unop->op_private = (U8)((first ? 1 : 0) | (flags >> 8));
unop->op_aux = aux;
-#ifdef PERL_OP_PARENT
if (first && !OpHAS_SIBLING(first)) /* true unless weird syntax error */
- first->op_sibling = (OP*)unop;
-#endif
+ OpLASTSIB_set(first, (OP*)unop);
unop = (UNOP_AUX*) CHECKOP(type, unop);
methop->op_u.op_first = dynamic_meth;
methop->op_private = (U8)(1 | (flags >> 8));
-#ifdef PERL_OP_PARENT
if (!OpHAS_SIBLING(dynamic_meth))
- dynamic_meth->op_sibling = (OP*)methop;
-#endif
+ OpLASTSIB_set(dynamic_meth, (OP*)methop);
}
else {
assert(const_meth);
}
else {
binop->op_private = (U8)(2 | (flags >> 8));
- OpSIBLING_set(first, last);
- first->op_lastsib = 0;
+ OpMORESIB_set(first, last);
}
-#ifdef PERL_OP_PARENT
if (!OpHAS_SIBLING(last)) /* true unless weird syntax error */
- last->op_sibling = (OP*)binop;
-#endif
+ OpLASTSIB_set(last, (OP*)binop);
binop->op_last = OpSIBLING(binop->op_first);
-#ifdef PERL_OP_PARENT
if (binop->op_last)
- binop->op_last->op_sibling = (OP*)binop;
-#endif
+ OpLASTSIB_set(binop->op_last, (OP*)binop);
binop = (BINOP*)CHECKOP(type, binop);
if (binop->op_next || binop->op_type != (OPCODE)type)
NewOp(1234,tmp,1,LOOP);
Copy(loop,tmp,1,LISTOP);
#ifdef PERL_OP_PARENT
- assert(loop->op_last->op_sibling == (OP*)loop);
- loop->op_last->op_sibling = (OP*)tmp; /*point back to new parent */
+ assert(loop->op_last->op_sibparent == (OP*)loop);
+ OpLASTSIB_set(loop->op_last, (OP*)tmp); /*point back to new parent */
#endif
S_op_destroy(aTHX_ (OP*)loop);
loop = tmp;
{
loop = (LOOP*)PerlMemShared_realloc(loop, sizeof(LOOP));
#ifdef PERL_OP_PARENT
- loop->op_last->op_sibling = (OP *)loop;
+ OpLASTSIB_set(loop->op_last, (OP*)loop);
#endif
}
loop->op_targ = padoff;
| ((kkid->op_private & ~OPpLVAL_INTRO) << 8));
OP *const first = newOP(OP_NULL, 0);
OP *const nullop =
+ newCONDOP(0, first, o, other);
+ /* XXX targlex disabled for now; see ticket #124160
newCONDOP(0, first, S_maybe_targlex(aTHX_ o), other);
+ */
OP *const condop = first->op_next;
OpTYPE_set(condop, OP_ONCE);
break;
case OP_RV2CV: {
OP * const kidparent =
- cUNOPx(cUNOPx(varop)->op_first)->op_first->op_sibling;
+ OpSIBLING(cUNOPx(cUNOPx(varop)->op_first)->op_first);
OP * const kid = cUNOPx(kidparent)->op_first;
o->op_private |= OPpLVREF_CV;
if (kid->op_type == OP_GV) {
unshare_hek(hek);
SvFLAGS(sv) |= was_readonly;
}
- else if (SvPOK(sv) && !SvNIOK(sv) && !SvGMAGICAL(sv)) {
+ else if (SvPOK(sv) && !SvNIOK(sv) && !SvGMAGICAL(sv)
+ && !SvVOK(sv)) {
s = SvPV(sv, len);
if (SvREFCNT(sv) > 1) {
kid->op_sv = newSVpvn_share(
else {
OP * const padop = newOP(OP_PADCV, 0);
padop->op_targ = off;
- cUNOPx(firstkid)->op_first = padop;
-#ifdef PERL_OP_PARENT
- padop->op_sibling = firstkid;
-#endif
+ /* replace the const op with the pad op */
+ op_sibling_splice(firstkid, NULL, 1, padop);
op_free(kid);
}
}
CV *compcv = PL_compcv;
while (PadnameOUTER(name)) {
assert(PARENT_PAD_INDEX(name));
- compcv = CvOUTSIDE(PL_compcv);
+ compcv = CvOUTSIDE(compcv);
name = PadlistNAMESARRAY(CvPADLIST(compcv))
[off = PARENT_PAD_INDEX(name)];
}
? -(SSize_t)len : (SSize_t)len,
0
);
+ if (SvREADONLY(*const_class))
+ SvREADONLY_on(shared);
SvREFCNT_dec(*const_class);
*const_class = shared;
}
assert(OpSIBLING(ns2) == pad2);
assert(OpSIBLING(pad2) == ns3);
+ /* excise and delete ns2 */
+ op_sibling_splice(NULL, pad1, 1, NULL);
+ op_free(ns2);
+
+ /* excise pad1 and pad2 */
+ op_sibling_splice(NULL, o, 2, NULL);
+
/* create new listop, with children consisting of:
* a new pushmark, pad1, pad2. */
- OpSIBLING_set(pad2, NULL);
newop = newLISTOP(OP_LIST, 0, pad1, pad2);
newop->op_flags |= OPf_PARENS;
newop->op_flags = (newop->op_flags & ~OPf_WANT) | OPf_WANT_VOID;
- newpm = cUNOPx(newop)->op_first; /* pushmark */
- /* Kill nextstate2 between padop1/padop2 */
- op_free(ns2);
+ /* insert newop between o and ns3 */
+ op_sibling_splice(NULL, o, 0, newop);
+ /*fixup op_next chain */
+ newpm = cUNOPx(newop)->op_first; /* pushmark */
o ->op_next = newpm;
newpm->op_next = pad1;
pad1 ->op_next = pad2;
pad2 ->op_next = newop; /* listop */
newop->op_next = ns3;
- OpSIBLING_set(o, newop);
- OpSIBLING_set(newop, ns3);
- newop->op_lastsib = 0;
-
- newop->op_flags = (newop->op_flags & ~OPf_WANT) | OPf_WANT_VOID;
-
/* Ensure pushmark has this flag if padops do */
if (pad1->op_flags & OPf_MOD && pad2->op_flags & OPf_MOD) {
- o->op_next->op_flags |= OPf_MOD;
+ newpm->op_flags |= OPf_MOD;
}
break;
}
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
* !op_slabbed.
* op_savefree on savestack via SAVEFREEOP
* op_folded Result/remainder of a constant fold operation.
- * op_lastsib this op is is the last sibling
+ * op_moresib this op is is not the last sibling
* op_spare One spare bit
* op_flags Flags common to all operations. See OPf_* below.
* op_private Flags peculiar to a particular operation (BUT,
typedef PERL_BITFIELD16 Optype;
+/* this field now either points to the next sibling or to the parent,
+ * depending on op_moresib. So rename it from op_sibling to op_sibparent.
+ */
+#ifdef PERL_OP_PARENT
+# define _OP_SIBPARENT_FIELDNAME op_sibparent
+#else
+# define _OP_SIBPARENT_FIELDNAME op_sibling
+#endif
+
#ifdef BASEOP_DEFINITION
#define BASEOP BASEOP_DEFINITION
#else
#define BASEOP \
OP* op_next; \
- OP* op_sibling; \
+ OP* _OP_SIBPARENT_FIELDNAME;\
OP* (*op_ppaddr)(pTHX); \
PADOFFSET op_targ; \
PERL_BITFIELD16 op_type:9; \
PERL_BITFIELD16 op_savefree:1; \
PERL_BITFIELD16 op_static:1; \
PERL_BITFIELD16 op_folded:1; \
- PERL_BITFIELD16 op_lastsib:1; \
+ PERL_BITFIELD16 op_moresib:1; \
PERL_BITFIELD16 op_spare:1; \
U8 op_flags; \
U8 op_private;
=for apidoc Am|bool|OpHAS_SIBLING|OP *o
Returns true if o has a sibling
-=for apidoc Am|bool|OpSIBLING|OP *o
+=for apidoc Am|OP*|OpSIBLING|OP *o
Returns the sibling of o, or NULL if there is no sibling
-=for apidoc Am|bool|OpSIBLING_set|OP *o|OP *sib
-Sets the sibling of o to sib
+=for apidoc Am|void|OpMORESIB_set|OP *o|OP *sib
+Sets the sibling of o to the non-zero value sib. See also C<OpLASTSIB_set>
+and C<OpMAYBESIB_set>. For a higher-level interface, see
+C<op_sibling_splice>.
+
+=for apidoc Am|void|OpLASTSIB_set|OP *o|OP *parent
+Marks o as having no further siblings. On C<PERL_OP_PARENT> builds, marks
+o as having the specified parent. See also C<OpMORESIB_set> and
+C<OpMAYBESIB_set>. For a higher-level interface, see
+C<op_sibling_splice>.
+
+=for apidoc Am|void|OpMAYBESIB_set|OP *o|OP *sib|OP *parent
+Conditionally does C<OpMORESIB_set> or C<OpLASTSIB_set> depending on whether
+sib is non-null. For a higher-level interface, see C<op_sibling_splice>.
=cut
*/
#define OP_TYPE_ISNT_AND_WASNT(o, type) \
( (o) && OP_TYPE_ISNT_AND_WASNT_NN(o, type) )
+
#ifdef PERL_OP_PARENT
-# define OpHAS_SIBLING(o) (!cBOOL((o)->op_lastsib))
-# define OpSIBLING(o) (0 + (o)->op_lastsib ? NULL : (o)->op_sibling)
-# define OpSIBLING_set(o, sib) ((o)->op_sibling = (sib))
+# define OpHAS_SIBLING(o) (cBOOL((o)->op_moresib))
+# define OpSIBLING(o) (0 + (o)->op_moresib ? (o)->op_sibparent : NULL)
+# define OpMORESIB_set(o, sib) ((o)->op_moresib = 1, (o)->op_sibparent = (sib))
+# define OpLASTSIB_set(o, parent) \
+ ((o)->op_moresib = 0, (o)->op_sibparent = (parent))
+# define OpMAYBESIB_set(o, sib, parent) \
+ ((o)->op_sibparent = ((o)->op_moresib = cBOOL(sib)) ? (sib) : (parent))
#else
# define OpHAS_SIBLING(o) (cBOOL((o)->op_sibling))
# define OpSIBLING(o) (0 + (o)->op_sibling)
-# define OpSIBLING_set(o, sib) ((o)->op_sibling = (sib))
+# define OpMORESIB_set(o, sib) ((o)->op_moresib = 1, (o)->op_sibling = (sib))
+# define OpLASTSIB_set(o, parent) \
+ ((o)->op_moresib = 0, (o)->op_sibling = NULL)
+# define OpMAYBESIB_set(o, sib, parent) \
+ ((o)->op_moresib = cBOOL(sib), (o)->op_sibling = (sib))
#endif
+
#if !defined(PERL_CORE) && !defined(PERL_EXT)
+/* for backwards compatibility only */
# define OP_SIBLING(o) OpSIBLING(o)
#endif
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
0x0001121e, /* i_divide */
0x0001123e, /* modulo */
0x0001121e, /* i_modulo */
- 0x0001221b, /* repeat */
+ 0x0001220b, /* repeat */
0x0001123e, /* add */
0x0001121e, /* i_add */
0x0001123e, /* subtract */
0x00011226, /* ne */
0x00011206, /* i_ne */
0x0001122e, /* ncmp */
- 0x0001121e, /* i_ncmp */
+ 0x0001120e, /* i_ncmp */
0x00011206, /* slt */
0x00011206, /* sgt */
0x00011206, /* sle */
0x00011206, /* sge */
0x00011206, /* seq */
0x00011206, /* sne */
- 0x0001121e, /* scmp */
+ 0x0001120e, /* scmp */
0x0001120e, /* bit_and */
0x0001120e, /* bit_xor */
0x0001120e, /* bit_or */
0x0000112e, /* negate */
0x0000110e, /* i_negate */
0x00001106, /* not */
- 0x0000111e, /* complement */
+ 0x0000110e, /* complement */
0x0000111e, /* ncomplement */
0x0000111e, /* scomplement */
0x00000204, /* smartmatch */
0x00009b9e, /* abs */
0x00009b9e, /* length */
0x0991140c, /* substr */
- 0x0011141c, /* vec */
+ 0x0011140c, /* vec */
0x0091141c, /* index */
0x0091141c, /* rindex */
0x0002140f, /* sprintf */
0x00000f44, /* multideref */
0x00091480, /* unpack */
0x0002140f, /* pack */
- 0x00111418, /* split */
+ 0x00111408, /* split */
0x0002140f, /* join */
0x00002401, /* list */
0x00224200, /* lslice */
73, /* subtract */
73, /* i_subtract */
73, /* concat */
- 78, /* stringify */
+ 77, /* stringify */
73, /* left_shift */
73, /* right_shift */
12, /* lt */
12, /* ne */
12, /* i_ne */
12, /* ncmp */
- 73, /* i_ncmp */
+ 12, /* i_ncmp */
12, /* slt */
12, /* sgt */
12, /* sle */
12, /* sge */
12, /* seq */
12, /* sne */
- 73, /* scmp */
+ 12, /* scmp */
12, /* bit_and */
12, /* bit_xor */
12, /* bit_or */
0, /* negate */
0, /* i_negate */
0, /* not */
- 71, /* complement */
+ 0, /* complement */
71, /* ncomplement */
71, /* scomplement */
12, /* smartmatch */
- 78, /* atan2 */
+ 77, /* atan2 */
71, /* sin */
71, /* cos */
- 78, /* rand */
- 78, /* srand */
+ 77, /* rand */
+ 77, /* srand */
71, /* exp */
71, /* log */
71, /* sqrt */
71, /* oct */
71, /* abs */
71, /* length */
- 80, /* substr */
- 83, /* vec */
- 78, /* index */
- 78, /* rindex */
+ 79, /* substr */
+ 82, /* vec */
+ 77, /* index */
+ 77, /* rindex */
49, /* sprintf */
49, /* formline */
71, /* ord */
71, /* chr */
- 78, /* crypt */
+ 77, /* crypt */
0, /* ucfirst */
0, /* lcfirst */
0, /* uc */
0, /* lc */
0, /* quotemeta */
- 86, /* rv2av */
- 92, /* aelemfast */
- 92, /* aelemfast_lex */
- 93, /* aelem */
- 98, /* aslice */
- 101, /* kvaslice */
+ 84, /* rv2av */
+ 90, /* aelemfast */
+ 90, /* aelemfast_lex */
+ 91, /* aelem */
+ 96, /* aslice */
+ 99, /* kvaslice */
0, /* aeach */
0, /* akeys */
0, /* avalues */
0, /* each */
0, /* values */
40, /* keys */
- 102, /* delete */
- 105, /* exists */
- 107, /* rv2hv */
- 93, /* helem */
- 98, /* hslice */
- 101, /* kvhslice */
- 115, /* multideref */
+ 100, /* delete */
+ 103, /* exists */
+ 105, /* rv2hv */
+ 91, /* helem */
+ 96, /* hslice */
+ 99, /* kvhslice */
+ 113, /* multideref */
49, /* unpack */
49, /* pack */
- 122, /* split */
+ 120, /* split */
49, /* join */
- 125, /* list */
+ 122, /* list */
12, /* lslice */
49, /* anonlist */
49, /* anonhash */
49, /* splice */
- 78, /* push */
+ 77, /* push */
0, /* pop */
0, /* shift */
- 78, /* unshift */
- 127, /* sort */
- 134, /* reverse */
- 136, /* grepstart */
- 136, /* grepwhile */
- 136, /* mapstart */
- 136, /* mapwhile */
+ 77, /* unshift */
+ 124, /* sort */
+ 131, /* reverse */
+ 133, /* grepstart */
+ 133, /* grepwhile */
+ 133, /* mapstart */
+ 133, /* mapwhile */
0, /* range */
- 138, /* flip */
- 138, /* flop */
+ 135, /* flip */
+ 135, /* flop */
0, /* and */
0, /* or */
12, /* xor */
0, /* dor */
- 140, /* cond_expr */
+ 137, /* cond_expr */
0, /* andassign */
0, /* orassign */
0, /* dorassign */
0, /* method */
- 142, /* entersub */
- 149, /* leavesub */
- 149, /* leavesublv */
- 151, /* caller */
+ 139, /* entersub */
+ 146, /* leavesub */
+ 146, /* leavesublv */
+ 148, /* caller */
49, /* warn */
49, /* die */
49, /* reset */
-1, /* lineseq */
- 153, /* nextstate */
- 153, /* dbstate */
+ 150, /* nextstate */
+ 150, /* dbstate */
-1, /* unstack */
-1, /* enter */
- 154, /* leave */
+ 151, /* leave */
-1, /* scope */
- 156, /* enteriter */
- 160, /* iter */
+ 153, /* enteriter */
+ 157, /* iter */
-1, /* enterloop */
- 161, /* leaveloop */
+ 158, /* leaveloop */
-1, /* return */
- 163, /* last */
- 163, /* next */
- 163, /* redo */
- 163, /* dump */
- 163, /* goto */
+ 160, /* last */
+ 160, /* next */
+ 160, /* redo */
+ 160, /* dump */
+ 160, /* goto */
49, /* exit */
0, /* method_named */
0, /* method_super */
0, /* leavewhen */
-1, /* break */
-1, /* continue */
- 165, /* open */
+ 162, /* open */
49, /* close */
49, /* pipe_op */
49, /* fileno */
49, /* getc */
49, /* read */
49, /* enterwrite */
- 149, /* leavewrite */
+ 146, /* leavewrite */
-1, /* prtf */
-1, /* print */
-1, /* say */
49, /* truncate */
49, /* fcntl */
49, /* ioctl */
- 78, /* flock */
+ 77, /* flock */
49, /* send */
49, /* recv */
49, /* socket */
0, /* getpeername */
0, /* lstat */
0, /* stat */
- 170, /* ftrread */
- 170, /* ftrwrite */
- 170, /* ftrexec */
- 170, /* fteread */
- 170, /* ftewrite */
- 170, /* fteexec */
- 175, /* ftis */
- 175, /* ftsize */
- 175, /* ftmtime */
- 175, /* ftatime */
- 175, /* ftctime */
- 175, /* ftrowned */
- 175, /* fteowned */
- 175, /* ftzero */
- 175, /* ftsock */
- 175, /* ftchr */
- 175, /* ftblk */
- 175, /* ftfile */
- 175, /* ftdir */
- 175, /* ftpipe */
- 175, /* ftsuid */
- 175, /* ftsgid */
- 175, /* ftsvtx */
- 175, /* ftlink */
- 175, /* fttty */
- 175, /* fttext */
- 175, /* ftbinary */
- 78, /* chdir */
- 78, /* chown */
+ 167, /* ftrread */
+ 167, /* ftrwrite */
+ 167, /* ftrexec */
+ 167, /* fteread */
+ 167, /* ftewrite */
+ 167, /* fteexec */
+ 172, /* ftis */
+ 172, /* ftsize */
+ 172, /* ftmtime */
+ 172, /* ftatime */
+ 172, /* ftctime */
+ 172, /* ftrowned */
+ 172, /* fteowned */
+ 172, /* ftzero */
+ 172, /* ftsock */
+ 172, /* ftchr */
+ 172, /* ftblk */
+ 172, /* ftfile */
+ 172, /* ftdir */
+ 172, /* ftpipe */
+ 172, /* ftsuid */
+ 172, /* ftsgid */
+ 172, /* ftsvtx */
+ 172, /* ftlink */
+ 172, /* fttty */
+ 172, /* fttext */
+ 172, /* ftbinary */
+ 77, /* chdir */
+ 77, /* chown */
71, /* chroot */
- 78, /* unlink */
- 78, /* chmod */
- 78, /* utime */
- 78, /* rename */
- 78, /* link */
- 78, /* symlink */
+ 77, /* unlink */
+ 77, /* chmod */
+ 77, /* utime */
+ 77, /* rename */
+ 77, /* link */
+ 77, /* symlink */
0, /* readlink */
- 78, /* mkdir */
+ 77, /* mkdir */
71, /* rmdir */
49, /* open_dir */
0, /* readdir */
0, /* rewinddir */
0, /* closedir */
-1, /* fork */
- 179, /* wait */
- 78, /* waitpid */
- 78, /* system */
- 78, /* exec */
- 78, /* kill */
- 179, /* getppid */
- 78, /* getpgrp */
- 78, /* setpgrp */
- 78, /* getpriority */
- 78, /* setpriority */
- 179, /* time */
+ 176, /* wait */
+ 77, /* waitpid */
+ 77, /* system */
+ 77, /* exec */
+ 77, /* kill */
+ 176, /* getppid */
+ 77, /* getpgrp */
+ 77, /* setpgrp */
+ 77, /* getpriority */
+ 77, /* setpriority */
+ 176, /* time */
-1, /* tms */
0, /* localtime */
49, /* gmtime */
0, /* alarm */
- 78, /* sleep */
+ 77, /* sleep */
49, /* shmget */
49, /* shmctl */
49, /* shmread */
0, /* require */
0, /* dofile */
-1, /* hintseval */
- 180, /* entereval */
- 149, /* leaveeval */
+ 177, /* entereval */
+ 146, /* leaveeval */
0, /* entertry */
-1, /* leavetry */
0, /* ghbyname */
0, /* reach */
40, /* rkeys */
0, /* rvalues */
- 186, /* coreargs */
+ 183, /* coreargs */
3, /* runcv */
0, /* fc */
-1, /* padcv */
-1, /* introcv */
-1, /* clonecv */
- 190, /* padrange */
- 192, /* refassign */
- 198, /* lvref */
- 204, /* lvrefslice */
- 205, /* lvavref */
+ 187, /* padrange */
+ 189, /* refassign */
+ 195, /* lvref */
+ 201, /* lvrefslice */
+ 202, /* lvavref */
0, /* anonconst */
};
*/
EXTCONST U16 PL_op_private_bitdefs[] = {
- 0x0003, /* scalar, prototype, refgen, srefgen, ref, readline, regcmaybe, regcreset, regcomp, chop, schop, defined, undef, study, preinc, i_preinc, predec, i_predec, postinc, i_postinc, postdec, i_postdec, negate, i_negate, not, ucfirst, lcfirst, uc, lc, quotemeta, aeach, akeys, avalues, each, values, pop, shift, range, and, or, dor, andassign, orassign, dorassign, method, method_named, method_super, method_redir, method_redir_super, entergiven, leavegiven, enterwhen, leavewhen, untie, tied, dbmclose, getsockname, getpeername, lstat, stat, readlink, readdir, telldir, rewinddir, closedir, localtime, alarm, require, dofile, entertry, ghbyname, gnbyname, gpbyname, shostent, snetent, sprotoent, sservent, gpwnam, gpwuid, ggrnam, ggrgid, lock, once, reach, rvalues, fc, anonconst */
+ 0x0003, /* scalar, prototype, refgen, srefgen, ref, readline, regcmaybe, regcreset, regcomp, chop, schop, defined, undef, study, preinc, i_preinc, predec, i_predec, postinc, i_postinc, postdec, i_postdec, negate, i_negate, not, complement, ucfirst, lcfirst, uc, lc, quotemeta, aeach, akeys, avalues, each, values, pop, shift, range, and, or, dor, andassign, orassign, dorassign, method, method_named, method_super, method_redir, method_redir_super, entergiven, leavegiven, enterwhen, leavewhen, untie, tied, dbmclose, getsockname, getpeername, lstat, stat, readlink, readdir, telldir, rewinddir, closedir, localtime, alarm, require, dofile, entertry, ghbyname, gnbyname, gpbyname, shostent, snetent, sprotoent, sservent, gpwnam, gpwuid, ggrnam, ggrgid, lock, once, reach, rvalues, fc, anonconst */
0x29dc, 0x3bd9, /* pushmark */
0x00bd, /* wantarray, runcv */
0x03b8, 0x1570, 0x3c8c, 0x3748, 0x2da5, /* const */
0x29dc, 0x2ef9, /* gvsv */
0x13d5, /* gv */
- 0x0067, /* gelem, lt, i_lt, gt, i_gt, le, i_le, ge, i_ge, eq, i_eq, ne, i_ne, ncmp, slt, sgt, sle, sge, seq, sne, bit_and, bit_xor, bit_or, sbit_and, sbit_xor, sbit_or, smartmatch, lslice, xor */
+ 0x0067, /* gelem, lt, i_lt, gt, i_gt, le, i_le, ge, i_ge, eq, i_eq, ne, i_ne, ncmp, i_ncmp, slt, sgt, sle, sge, seq, sne, scmp, bit_and, bit_xor, bit_or, sbit_and, sbit_xor, sbit_or, smartmatch, lslice, xor */
0x29dc, 0x3bd8, 0x0257, /* padsv */
0x29dc, 0x3bd8, 0x2acc, 0x38c9, /* padav */
0x29dc, 0x3bd8, 0x0534, 0x05d0, 0x2acc, 0x38c9, /* padhv */
0x0c9c, 0x1dd8, 0x0834, 0x3ef0, 0x3a0c, 0x2168, 0x01e4, 0x0141, /* trans, transr */
0x0adc, 0x0458, 0x0067, /* sassign */
0x0758, 0x2acc, 0x0067, /* aassign */
- 0x3ef0, 0x0003, /* chomp, schomp, complement, ncomplement, scomplement, sin, cos, exp, log, sqrt, int, hex, oct, abs, length, ord, chr, chroot, rmdir */
- 0x3ef0, 0x0067, /* pow, multiply, i_multiply, divide, i_divide, modulo, i_modulo, add, i_add, subtract, i_subtract, concat, left_shift, right_shift, i_ncmp, scmp, nbit_and, nbit_xor, nbit_or */
- 0x1058, 0x3ef0, 0x0067, /* repeat */
+ 0x3ef0, 0x0003, /* chomp, schomp, ncomplement, scomplement, sin, cos, exp, log, sqrt, int, hex, oct, abs, length, ord, chr, chroot, rmdir */
+ 0x3ef0, 0x0067, /* pow, multiply, i_multiply, divide, i_divide, modulo, i_modulo, add, i_add, subtract, i_subtract, concat, left_shift, right_shift, nbit_and, nbit_xor, nbit_or */
+ 0x1058, 0x0067, /* repeat */
0x3ef0, 0x012f, /* stringify, atan2, rand, srand, index, rindex, crypt, push, unshift, flock, chdir, chown, unlink, chmod, utime, rename, link, symlink, mkdir, waitpid, system, exec, kill, getpgrp, setpgrp, getpriority, setpriority, sleep */
0x33f0, 0x2acc, 0x00cb, /* substr */
- 0x3ef0, 0x2acc, 0x0067, /* vec */
+ 0x2acc, 0x0067, /* vec */
0x29dc, 0x2ef8, 0x2acc, 0x38c8, 0x3c84, 0x0003, /* rv2av */
0x01ff, /* aelemfast, aelemfast_lex */
0x29dc, 0x28d8, 0x0256, 0x2acc, 0x0067, /* aelem, helem */
0x3d78, 0x0003, /* exists */
0x29dc, 0x2ef8, 0x0534, 0x05d0, 0x2acc, 0x38c8, 0x3c84, 0x0003, /* rv2hv */
0x29dc, 0x28d8, 0x0d14, 0x1670, 0x2acc, 0x3c84, 0x0003, /* multideref */
- 0x223c, 0x2ef8, 0x3ef1, /* split */
+ 0x223c, 0x2ef9, /* split */
0x29dc, 0x1e99, /* list */
0x3af8, 0x3194, 0x0fb0, 0x254c, 0x34e8, 0x2644, 0x2e61, /* sort */
0x254c, 0x0003, /* reverse */
/* I_DIVIDE */ (OPpARG2_MASK|OPpTARGET_MY),
/* MODULO */ (OPpARG2_MASK|OPpTARGET_MY),
/* I_MODULO */ (OPpARG2_MASK|OPpTARGET_MY),
- /* REPEAT */ (OPpARG2_MASK|OPpTARGET_MY|OPpREPEAT_DOLIST),
+ /* REPEAT */ (OPpARG2_MASK|OPpREPEAT_DOLIST),
/* ADD */ (OPpARG2_MASK|OPpTARGET_MY),
/* I_ADD */ (OPpARG2_MASK|OPpTARGET_MY),
/* SUBTRACT */ (OPpARG2_MASK|OPpTARGET_MY),
/* NE */ (OPpARG2_MASK),
/* I_NE */ (OPpARG2_MASK),
/* NCMP */ (OPpARG2_MASK),
- /* I_NCMP */ (OPpARG2_MASK|OPpTARGET_MY),
+ /* I_NCMP */ (OPpARG2_MASK),
/* SLT */ (OPpARG2_MASK),
/* SGT */ (OPpARG2_MASK),
/* SLE */ (OPpARG2_MASK),
/* SGE */ (OPpARG2_MASK),
/* SEQ */ (OPpARG2_MASK),
/* SNE */ (OPpARG2_MASK),
- /* SCMP */ (OPpARG2_MASK|OPpTARGET_MY),
+ /* SCMP */ (OPpARG2_MASK),
/* BIT_AND */ (OPpARG2_MASK),
/* BIT_XOR */ (OPpARG2_MASK),
/* BIT_OR */ (OPpARG2_MASK),
/* NEGATE */ (OPpARG1_MASK),
/* I_NEGATE */ (OPpARG1_MASK),
/* NOT */ (OPpARG1_MASK),
- /* COMPLEMENT */ (OPpARG1_MASK|OPpTARGET_MY),
+ /* COMPLEMENT */ (OPpARG1_MASK),
/* NCOMPLEMENT */ (OPpARG1_MASK|OPpTARGET_MY),
/* SCOMPLEMENT */ (OPpARG1_MASK|OPpTARGET_MY),
/* SMARTMATCH */ (OPpARG2_MASK),
/* ABS */ (OPpARG1_MASK|OPpTARGET_MY),
/* LENGTH */ (OPpARG1_MASK|OPpTARGET_MY),
/* SUBSTR */ (OPpARG3_MASK|OPpMAYBE_LVSUB|OPpSUBSTR_REPL_FIRST),
- /* VEC */ (OPpARG2_MASK|OPpMAYBE_LVSUB|OPpTARGET_MY),
+ /* VEC */ (OPpARG2_MASK|OPpMAYBE_LVSUB),
/* INDEX */ (OPpARG4_MASK|OPpTARGET_MY),
/* RINDEX */ (OPpARG4_MASK|OPpTARGET_MY),
/* SPRINTF */ (OPpARG4_MASK),
/* MULTIDEREF */ (OPpARG1_MASK|OPpHINT_STRICT_REFS|OPpMAYBE_LVSUB|OPpMULTIDEREF_EXISTS|OPpMULTIDEREF_DELETE|OPpLVAL_DEFER|OPpLVAL_INTRO),
/* UNPACK */ (OPpARG4_MASK),
/* PACK */ (OPpARG4_MASK),
- /* SPLIT */ (OPpTARGET_MY|OPpOUR_INTRO|OPpSPLIT_IMPLIM),
+ /* SPLIT */ (OPpOUR_INTRO|OPpSPLIT_IMPLIM),
/* JOIN */ (OPpARG4_MASK),
/* LIST */ (OPpLIST_GUESSED|OPpLVAL_INTRO),
/* LSLICE */ (OPpARG2_MASK),
#endif /* USE_ITHREADS */
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
Perl_pad_findmy_pvn(aTHX_ STR_WITH_LEN(name), flags)
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
};
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
#define PERL_REVISION 5 /* age */
#define PERL_VERSION 21 /* epoch */
-#define PERL_SUBVERSION 10 /* generation */
+#define PERL_SUBVERSION 11 /* generation */
/* The following numbers describe the earliest compatible version of
Perl ("compatibility" here being defined as sufficient binary/API
*/
#define PERL_API_REVISION 5
#define PERL_API_VERSION 21
-#define PERL_API_SUBVERSION 10
+#define PERL_API_SUBVERSION 11
/*
XXX Note: The selection of non-default Configure options, such
as -Duselonglong may invalidate these settings. Currently, Configure
}
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
* argument; the 2nd, is a pointer to the first byte of the UTF-8 encoded
* string, and an end position which it won't try to read past */
# define _CHECK_AND_OUTPUT_WIDE_LOCALE_CP_MSG(cp) \
- Perl_ck_warner(aTHX_ packWARN(WARN_LOCALE), \
- "Wide character (U+%"UVXf") in %s", (UV) cp, OP_DESC(PL_op));
+ STMT_START { \
+ if (! PL_in_utf8_CTYPE_locale && ckWARN(WARN_LOCALE)) { \
+ Perl_warner(aTHX_ packWARN(WARN_LOCALE), \
+ "Wide character (U+%"UVXf") in %s", \
+ (UV) cp, OP_DESC(PL_op)); \
+ } \
+ } STMT_END
# define _CHECK_AND_OUTPUT_WIDE_LOCALE_UTF8_MSG(s, send) \
STMT_START { /* Check if to warn before doing the conversion work */\
- if (ckWARN(WARN_LOCALE)) { \
+ if (! PL_in_utf8_CTYPE_locale && ckWARN(WARN_LOCALE)) { \
UV cp = utf8_to_uvchr_buf((U8 *) s, (U8 *) send, NULL); \
Perl_warner(aTHX_ packWARN(WARN_LOCALE), \
"Wide character (U+%"UVXf") in %s", \
#else /* !USE_LOCALE_NUMERIC */
-#define SET_LC_NUMERIC_STANDARD()
-#define SET_LC_NUMERIC_UNDERLYING()
+#define SET_NUMERIC_STANDARD()
+#define SET_NUMERIC_UNDERLYING()
#define IS_NUMERIC_RADIX(a, b) (0)
#define STORE_LC_NUMERIC_UNDERLYING_SET_STANDARD()
#define STORE_LC_NUMERIC_STANDARD_SET_UNDERLYING()
#endif /* Include guard */
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
};
/*
- * Local Variables:
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
}
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
#endif /* _PERLIO_H */
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
#endif /* _PERLIOL_H */
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
#endif /* PERLIO_IS_STDIO */
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
}
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
* This symbol contains the ~name expanded version of PRIVLIB, to be used
* in programs that are not prepared to deal with ~ expansion at run-time.
*/
-#define PRIVLIB "/sys/lib/perl/5.21.10" /**/
-#define PRIVLIB_EXP "/sys/lib/perl/5.21.10" /**/
+#define PRIVLIB "/sys/lib/perl/5.21.11" /**/
+#define PRIVLIB_EXP "/sys/lib/perl/5.21.11" /**/
/* PTRSIZE:
* This symbol contains the size of a pointer, so that the C preprocessor
* removed. The elements in inc_version_list (inc_version_list.U) can
* be tacked onto this variable to generate a list of directories to search.
*/
-#define SITELIB "/sys/lib/perl/5.21.10/site_perl" /**/
-#define SITELIB_EXP "/sys/lib/perl/5.21.10/site_perl" /**/
-#define SITELIB_STEM "/sys/lib/perl/5.21.10/site_perl" /**/
+#define SITELIB "/sys/lib/perl/5.21.11/site_perl" /**/
+#define SITELIB_EXP "/sys/lib/perl/5.21.11/site_perl" /**/
+#define SITELIB_STEM "/sys/lib/perl/5.21.11/site_perl" /**/
/* Size_t_size:
* This symbol holds the size of a Size_t in bytes.
ansi2knr=''
aphostname='/bin/uname -n'
api_revision='5'
-api_subversion='10'
+api_subversion='11'
api_version='21'
-api_versionstring='5.21.10'
+api_versionstring='5.21.11'
ar='ar'
-archlib='/sys/lib/perl5/5.21.10/386'
-archlibexp='/sys/lib/perl5/5.21.10/386'
+archlib='/sys/lib/perl5/5.21.11/386'
+archlibexp='/sys/lib/perl5/5.21.11/386'
archname64=''
archname='386'
archobjs=''
inc_version_list_init='0'
incpath=''
inews=''
-installarchlib='/sys/lib/perl/5.21.10/386'
+installarchlib='/sys/lib/perl/5.21.11/386'
installbin='/usr/bin'
installman1dir='/sys/man/1pub'
installman3dir='/sys/man/2pub'
installprefix='/usr'
installprefixexp='/usr'
-installprivlib='/sys/lib/perl/5.21.10'
+installprivlib='/sys/lib/perl/5.21.11'
installscript='/usr/bin'
-installsitearch='/sys/lib/perl/5.21.10/site_perl/386'
+installsitearch='/sys/lib/perl/5.21.11/site_perl/386'
installsitebin='/usr/bin'
-installsitelib='/sys/lib/perl/5.21.10/site_perl'
+installsitelib='/sys/lib/perl/5.21.11/site_perl'
installstyle='lib/perl5'
installusrbinperl='undef'
installvendorarch=''
pr=''
prefix='/usr'
prefixexp='/usr'
-privlib='/sys/lib/perl/5.21.10'
-privlibexp='/sys/lib/perl/5.21.10'
+privlib='/sys/lib/perl/5.21.11'
+privlibexp='/sys/lib/perl/5.21.11'
procselfexe=''
prototype='define'
ptrsize='4'
sig_num_init='0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 0'
sig_size='50'
signal_t='void'
-sitearch='/sys/lib/perl/5.21.10/site_perl/386'
+sitearch='/sys/lib/perl/5.21.11/site_perl/386'
sitearchexp='/sys/lib/perl/site_perl/386'
sitebin='/usr/bin'
sitebinexp='/usr/bin'
-sitelib='/sys/lib/perl/5.21.10/site_perl'
-sitelib_stem='/sys/lib/perl/5.21.10/site_perl'
-sitelibexp='/sys/lib/perl/5.21.10/site_perl'
+sitelib='/sys/lib/perl/5.21.11/site_perl'
+sitelib_stem='/sys/lib/perl/5.21.11/site_perl'
+sitelibexp='/sys/lib/perl/5.21.11/site_perl'
siteprefix='/usr'
siteprefixexp='/usr'
sizesize='4'
strerror_r_proto='0'
strings='/sys/include/ape/string.h'
submit=''
-subversion='10'
+subversion='11'
sysman='/sys/man/1pub'
tail=''
tar=''
vendorlibexp=''
vendorprefix=''
vendorprefixexp=''
-version='5.21.10'
-version_patchlevel_string='version 21 subversion 10'
+version='5.21.11'
+version_patchlevel_string='version 21 subversion 11'
versiononly='undef'
vi=''
xlibpth=''
config_argc=0
PERL_REVISION=5
PERL_VERSION=21
-PERL_SUBVERSION=10
+PERL_SUBVERSION=11
PERL_API_REVISION=5
PERL_API_VERSION=21
-PERL_API_SUBVERSION=10
+PERL_API_SUBVERSION=11
PERL_PATCHLEVEL=
PERL_CONFIG_SH=true
/roffitall
# generated
-/perl52110delta.pod
+/perl52111delta.pod
/perlapi.pod
/perlintern.pod
*.html
$initem = 0;
}
-# Local variables:
-# cperl-indent-level: 4
-# indent-tabs-mode: nil
-# End:
-#
# ex: set ts=8 sts=4 sw=4 et:
perlhist Perl history records
perldelta Perl changes since previous version
+ perl52110delta Perl changes in version 5.21.10
perl5219delta Perl changes in version 5.21.9
perl5218delta Perl changes in version 5.21.8
perl5217delta Perl changes in version 5.21.7
--- /dev/null
+=encoding utf8
+
+=head1 NAME
+
+perl52110delta - what is new for perl v5.21.10
+
+=head1 DESCRIPTION
+
+This document describes differences between the 5.21.9 release and the 5.21.10
+release.
+
+If you are upgrading from an earlier release such as 5.21.8, first read
+L<perl5219delta>, which describes differences between 5.21.8 and 5.21.9.
+
+=head1 Incompatible Changes
+
+=head2 C<(?[...])> operators now follow standard Perl precedence
+
+This experimental feature allows set operations in regular expression patterns.
+Prior to this, the intersection operator had the same precedence as the other
+binary operators. Now it has higher precedence. This could lead to different
+outcomes than existing code expects (though the documentation has always noted
+that this change might happen, recommending fully parenthesizing the
+expressions). See L<perlrecharclass/Extended Bracketed Character Classes>.
+
+=head1 Performance Enhancements
+
+=over 4
+
+=item *
+
+The functions C<utf8::native_to_unicode()> and C<utf8::unicode_to_native()>
+(see L<utf8>) are now optimized out on ASCII platforms. There is now not even
+a minimal performance hit in writing code portable between ASCII and EBCDIC
+platforms.
+
+=back
+
+=head1 Modules and Pragmata
+
+=head2 Updated Modules and Pragmata
+
+=over 4
+
+=item *
+
+L<B> has been upgraded from version 1.56 to 1.57.
+
+=item *
+
+L<B::Deparse> has been upgraded from version 1.33 to 1.34.
+
+Deparse C<$#_> as that instead of as C<$#{_}>.
+L<[perl #123947]|https://rt.perl.org/Ticket/Display.html?id=123947>
+
+=item *
+
+L<Carp> has been upgraded from version 1.35 to 1.36.
+
+=item *
+
+L<CPAN> has been upgraded from version 2.05 to 2.10.
+
+=over 4
+
+=item *
+
+Add support for C<Cwd::getdcwd()> and introduce workaround for a misbehaviour
+seen on Strawberry Perl 5.20.1.
+
+=item *
+
+Fix C<chdir()> after building dependencies bug.
+
+=item *
+
+Introduce experimental support for plugins/hooks.
+
+=item *
+
+Integrate the App::Cpan sources.
+
+=item *
+
+Do not check recursion on optional dependencies.
+
+=item *
+
+Sanity check META.yml to contain a hash.
+L<[cpan #95271]|https://rt.cpan.org/Ticket/Display.html?id=95271>
+
+=back
+
+=item *
+
+L<CPAN::Meta> has been upgraded from version 2.143240 to 2.150001.
+
+=item *
+
+L<Data::Dumper> has been upgraded from version 2.157 to 2.158.
+
+=item *
+
+L<DB> has been upgraded from version 1.07 to 1.08.
+
+=item *
+
+L<Devel::PPPort> has been upgraded from version 3.28 to 3.31.
+
+=item *
+
+L<DynaLoader> has been upgraded from version 1.31 to 1.32.
+
+=item *
+
+L<Encode> has been upgraded from version 2.70 to 2.72.
+
+=item *
+
+L<encoding> has been upgraded from version 2.13 to 2.14.
+
+=item *
+
+L<Getopt::Long> has been upgraded from version 2.43 to 2.45.
+
+=item *
+
+L<locale> has been upgraded from version 1.05 to 1.06.
+
+=item *
+
+L<Locale::Codes> has been upgraded from version 3.33 to 3.34.
+
+=item *
+
+L<Module::CoreList> has been upgraded from version 5.20150220 to 5.20150320.
+
+=item *
+
+L<parent> has been upgraded from version 0.228 to 0.232.
+
+No changes to installed files other than the version bump.
+
+=item *
+
+The PathTools modules have been upgraded from version 3.54 to 3.55.
+
+=item *
+
+L<Pod::Functions> has been upgraded from version 1.08 to 1.09.
+
+=item *
+
+L<POSIX> has been upgraded from version 1.51 to 1.52.
+
+=item *
+
+L<re> has been upgraded from version 0.31 to 0.32.
+
+=item *
+
+L<sigtrap> has been upgraded from version 1.07 to 1.08.
+
+=item *
+
+L<Term::Complete> has been upgraded from version 1.402 to 1.403.
+
+=item *
+
+L<Test::Simple> has been reverted from version 1.301001_098 to 1.001014.
+
+=item *
+
+L<Text::Balanced> has been upgraded from version 2.02 to 2.03.
+
+No changes to installed files other than the version bump.
+
+=item *
+
+L<Text::ParseWords> has been upgraded from version 3.29 to 3.30.
+
+=item *
+
+L<threads> has been upgraded from version 1.96_001 to 2.01.
+
+=item *
+
+L<Unicode::Collate> has been upgraded from version 1.11 to 1.12.
+
+=item *
+
+L<utf8> has been upgraded from version 1.14 to 1.15.
+
+=back
+
+=head1 Documentation
+
+=head2 Changes to Existing Documentation
+
+=head3 L<perldata>
+
+=over 4
+
+=item *
+
+Documentation has been added regarding the special floating point values C<Inf>
+and C<NaN>.
+
+=back
+
+=head3 L<perlexperiment>
+
+=over 4
+
+=item *
+
+Removed note about C<\s> matching C<VT> now that it is no longer experimental.
+
+=item *
+
+Added note that C<use re 'strict'> has been introduced experimentally.
+
+=back
+
+=head3 L<perlpolicy>
+
+=over 4
+
+=item *
+
+The documentation of what to expect to see in future maintenance releases has
+been updated. Essentially the same types of changes will be included as before
+but with fewer changes that don't affect the installation or execution of perl.
+
+=back
+
+=head1 Diagnostics
+
+The following additions or changes have been made to diagnostic output,
+including warnings and fatal error messages. For the complete list of
+diagnostic messages, see L<perldiag>.
+
+=head2 New Diagnostics
+
+=head3 New Errors
+
+=over 4
+
+=item *
+
+L<Invalid quantifier in {,} in regex; marked by <-- HERE in mE<sol>%sE<sol>|perldiag/"Invalid quantifier in {,} in regex; marked by <-- HERE in m/%s/">
+
+(F) The pattern looks like a {min,max} quantifier, but the min or max could not
+be parsed as a valid number - either it has leading zeroes, or it represents
+too big a number to cope with. The S<<-- HERE> shows where in the regular
+expression the problem was discovered. See L<perlre>.
+
+=back
+
+=head1 Testing
+
+=over 4
+
+=item *
+
+Tests for performance issues have been added in the file F<t/perf/taint.t>.
+
+=back
+
+=head1 Platform Support
+
+=head2 New Platforms
+
+=over 4
+
+=item z/OS running EBCDIC Code Page 1047
+
+Core perl now works on this EBCDIC platform. Early perls also worked, but,
+even though support wasn't officially withdrawn, recent perls would not compile
+and run well. Perl 5.20 would work, but had many bugs which have now been
+fixed. Many CPAN modules that ship with Perl still fail tests, including
+Pod::Simple. However the version of Pod::Simple currently on CPAN should work;
+it was fixed too late to include in Perl 5.22. Work is under way to fix many
+of the still-broken CPAN modules, which likely will be installed on CPAN when
+completed, so that you may not have to wait until Perl 5.24 to get a working
+version.
+
+=back
+
+=head2 Platform-Specific Notes
+
+=over 4
+
+=item HP-UX
+
+The archname now distinguishes use64bitint from use64bitall.
+
+=back
+
+=head1 Internal Changes
+
+=over 4
+
+=item *
+
+Macros have been created to allow XS code to better manipulate the POSIX locale
+category C<LC_NUMERIC>. See L<perlapi/Locale-related functions and macros>.
+
+=item *
+
+The previous C<atoi> et al replacement function, C<grok_atou>, has now been
+superseded by C<grok_atoUV>. See L<perlclib> for details.
+
+=back
+
+=head1 Selected Bug Fixes
+
+=over 4
+
+=item *
+
+Repeated global pattern matches in scalar context on large tainted strings were
+exponentially slow depending on the current match position in the string.
+L<[perl #123202]|https://rt.perl.org/Ticket/Display.html?id=123202>
+
+=item *
+
+Various crashes due to the parser getting confused by syntax errors have been
+fixed.
+L<[perl #123801]|https://rt.perl.org/Ticket/Display.html?id=123801>
+L<[perl #123802]|https://rt.perl.org/Ticket/Display.html?id=123802>
+L<[perl #123955]|https://rt.perl.org/Ticket/Display.html?id=123955>
+L<[perl #123995]|https://rt.perl.org/Ticket/Display.html?id=123995>
+
+=item *
+
+C<split> in the scope of lexical $_ has been fixed not to fail assertions.
+L<[perl #123763]|https://rt.perl.org/Ticket/Display.html?id=123763>
+
+=item *
+
+C<my $x : attr> syntax inside various list operators no longer fails
+assertions.
+L<[perl #123817]|https://rt.perl.org/Ticket/Display.html?id=123817>
+
+=item *
+
+An @ sign in quotes followed by a non-ASCII digit (which is not a valid
+identifier) would cause the parser to crash, instead of simply trying the @ as
+literal. This has been fixed.
+L<[perl #123963]|https://rt.perl.org/Ticket/Display.html?id=123963>
+
+=item *
+
+C<*bar::=*foo::=*glob_with_hash> has been crashing since Perl 5.14, but no
+longer does.
+L<[perl #123847]|https://rt.perl.org/Ticket/Display.html?id=123847>
+
+=item *
+
+C<foreach> in scalar context was not pushing an item on to the stack, resulting
+in bugs. (C<print 4, scalar do { foreach(@x){} } + 1> would print 5.) It has
+been fixed to return C<undef>.
+L<[perl #124004]|https://rt.perl.org/Ticket/Display.html?id=124004>
+
+=item *
+
+A memory leak introduced in Perl 5.21.6 has been fixed.
+L<[perl #123922]|https://rt.perl.org/Ticket/Display.html?id=123922>
+
+=item *
+
+A regression in the behaviour of the C<readline> built-in function, caused by
+the introduction of the C<< <<>> >> operator, has been fixed.
+L<[perl #123990]|https://rt.perl.org/Ticket/Display.html?id=123990>
+
+=item *
+
+Several cases of data used to store environment variable contents in core C
+code being potentially overwritten before being used have been fixed.
+L<[perl #123748]|https://rt.perl.org/Ticket/Display.html?id=123748>
+
+=back
+
+=head1 Known Problems
+
+=over 4
+
+=item *
+
+A goal is for Perl to be able to be recompiled to work reasonably well on any
+Unicode version. In Perl 5.22, though, the earliest such version is Unicode
+5.1 (current is 7.0).
+
+=item *
+
+EBCDIC platforms
+
+=over 4
+
+=item *
+
+Encode and encoding are mostly broken.
+
+=item *
+
+Many cpan modules that are shipped with core show failing tests.
+
+=item *
+
+C<pack>/C<unpack> with C<"U0"> format may not work properly.
+
+=back
+
+=back
+
+=head1 Acknowledgements
+
+Perl 5.21.10 represents approximately 4 weeks of development since Perl 5.21.9
+and contains approximately 170,000 lines of changes across 860 files from 27
+authors.
+
+Excluding auto-generated files, documentation and release tools, there were
+approximately 170,000 lines of changes to 610 .pm, .t, .c and .h files.
+
+Perl continues to flourish into its third decade thanks to a vibrant community
+of users and developers. The following people are known to have contributed
+the improvements that became Perl 5.21.10:
+
+Chris 'BinGOs' Williams, David Golden, David Mitchell, David Wheeler, Father
+Chrysostomos, H.Merijn Brand, Hugo van der Sanden, James E Keenan, Jarkko
+Hietaniemi, Jasmine Ngan, Jerry D. Hedden, John Goodyear, Karen Etheridge, Karl
+Williamson, Lukas Mai, Matthew Horsfall, Nicholas Clark, Petr Písař, Rafael
+Garcia-Suarez, Reini Urban, Ricardo Signes, Sawyer X, Steffen Müller, Steve
+Hay, Sullivan Beck, Tony Cook, Vincent Pit.
+
+The list above is almost certainly incomplete as it is automatically generated
+from version control history. In particular, it does not include the names of
+the (very much appreciated) contributors who reported issues to the Perl bug
+tracker.
+
+Many of the changes included in this version originated in the CPAN modules
+included in Perl's core. We're grateful to the entire CPAN community for
+helping Perl to flourish.
+
+For a more complete list of all of Perl's historical contributors, please see
+the F<AUTHORS> file in the Perl source distribution.
+
+=head1 Reporting Bugs
+
+If you find what you think is a bug, you might check the articles recently
+posted to the comp.lang.perl.misc newsgroup and the perl bug database at
+https://rt.perl.org/ . There may also be information at http://www.perl.org/ ,
+the Perl Home Page.
+
+If you believe you have an unreported bug, please run the L<perlbug> program
+included with your release. Be sure to trim your bug down to a tiny but
+sufficient test case. Your bug report, along with the output of C<perl -V>,
+will be sent off to perlbug@perl.org to be analysed by the Perl porting team.
+
+If the bug you are reporting has security implications, which make it
+inappropriate to send to a publicly archived mailing list, then please send it
+to perl5-security-report@perl.org. This points to a closed subscription
+unarchived mailing list, which includes all the core committers, who will be
+able to help assess the impact of issues, figure out a resolution, and help
+co-ordinate the release of patches to mitigate or fix the problem across all
+platforms on which Perl is supported. Please only use this address for
+security issues in the Perl core, not for modules independently distributed on
+CPAN.
+
+=head1 SEE ALSO
+
+The F<Changes> file for an explanation of how to view exhaustive details on
+what changed.
+
+The F<INSTALL> file for how to build Perl.
+
+The F<README> file for general stuff.
+
+The F<Artistic> and F<Copying> files for copyright information.
+
+=cut
by Tom Christiansen and Nathan Torkington,
with Foreword by Larry Wall
ISBN 978-0-596-00313-5 [2nd Edition August 2003]
+ ISBN 978-0-596-15888-0 [ebook]
http://oreilly.com/catalog/9780596003135/
=back
by Randal L. Schwartz, Tom Phoenix, and brian d foy
ISBN 978-1-4493-0358-7 [6th edition June 2011]
- http://oreilly.com/catalog/0636920018452
+ ISBN 978-1-4493-0458-4 [ebook]
+ http://www.learning-perl.com/
=back
by Randal L. Schwartz and brian d foy, with Tom Phoenix
foreword by Damian Conway
ISBN 978-1-4493-9309-0 [2nd edition August 2012]
- http://oreilly.com/catalog/0636920012689/
+ ISBN 978-1-4493-0459-1 [ebook]
+ http://www.intermediateperl.com/
=back
by Richard Foley
ISBN 978-0-596-00503-0 [1st edition January 2004]
+ ISBN 978-0-596-55625-9 [ebook]
http://oreilly.com/catalog/9780596005030/
=item I<Regular Expression Pocket Reference>
by Tony Stubblebine
- ISBN 978-0-596-51427-3 [July 2007]
+ ISBN 978-0-596-51427-3 [2nd edition July 2007]
+ ISBN 978-0-596-55782-9 [ebook]
http://oreilly.com/catalog/9780596514273/
=back
=item I<Beginning Perl>
by James Lee
- ISBN 1-59059-391-X [3rd edition April 2010]
+ ISBN 1-59059-391-X [3rd edition April 2010 & ebook]
http://www.apress.com/9781430227939
-=item I<Learning Perl>
+=item I<Learning Perl> (the "Llama Book")
by Randal L. Schwartz, Tom Phoenix, and brian d foy
- ISBN 978-0-596-52010-6 [5th edition June 2008]
- http://oreilly.com/catalog/9780596520106
+ ISBN 978-1-4493-0358-7 [6th edition June 2011]
+ ISBN 978-1-4493-0458-4 [ebook]
+ http://www.learning-perl.com/
=item I<Intermediate Perl> (the "Alpaca Book")
- by Randal L. Schwartz and brian d foy, with Tom Phoenix
+ by Randal L. Schwartz and brian d foy, with Tom Phoenix
foreword by Damian Conway
- ISBN 0-596-10206-2 [1st edition March 2006]
- http://oreilly.com/catalog/9780596102067
+ ISBN 978-1-4493-9309-0 [2nd edition August 2012]
+ ISBN 978-1-4493-0459-1 [ebook]
+ http://www.intermediateperl.com/
=item I<Mastering Perl>
- by brian d foy
- ISBN 978-0-596-10206-7 [1st edition July 2007]
- http://www.oreilly.com/catalog/9780596527242
+ by brian d foy
+ ISBN 9978-1-4493-9311-3 [2st edition January 2014]
+ ISBN 978-1-4493-6487-8 [ebook]
+ http://www.masteringperl.org/
=item I<Effective Perl Programming>
=item I<Writing Perl Modules for CPAN>
by Sam Tregar
- ISBN 1-59059-018-X [1st edition August 2002]
+ ISBN 1-59059-018-X [1st edition August 2002 & ebook]
http://www.apress.com/9781590590188
=item I<The Perl Cookbook>
- by Tom Christiansen and Nathan Torkington
- with foreword by Larry Wall
- ISBN 1-56592-243-3 [2nd edition August 2003]
- http://oreilly.com/catalog/9780596003135
+ by Tom Christiansen and Nathan Torkington,
+ with Foreword by Larry Wall
+ ISBN 978-0-596-00313-5 [2nd Edition August 2003]
+ ISBN 978-0-596-15888-0 [ebook]
+ http://oreilly.com/catalog/9780596003135/
=item I<Automating System Administration with Perl>
by David N. Blank-Edelman
ISBN 978-0-596-00639-6 [2nd edition May 2009]
+ ISBN 978-0-596-80251-6 [ebook]
http://oreilly.com/catalog/9780596006396
=item I<Real World SQL Server Administration with Perl>
by Linchi Shea
- ISBN 1-59059-097-X [1st edition July 2003]
+ ISBN 1-59059-097-X [1st edition July 2003 & ebook]
http://www.apress.com/9781590590973
=back
=item I<Regular Expressions Cookbook>
by Jan Goyvaerts and Steven Levithan
- ISBN 978-0-596-52069-4 [May 2009]
- http://oreilly.com/catalog/9780596520694
+ ISBN 978-1-4493-1943-4 [2nd edition August 2012]
+ ISBN 978-1-4493-2747-7 [ebook]
+ http://shop.oreilly.com/product/0636920023630.do
=item I<Programming the Perl DBI>
by Tim Bunce and Alligator Descartes
ISBN 978-1-56592-699-8 [February 2000]
+ ISBN 978-1-4493-8670-2 [ebook]
http://oreilly.com/catalog/9781565926998
=item I<Perl Best Practices>
by Damian Conway
- ISBN: 978-0-596-00173-5 [1st edition July 2005]
+ ISBN 978-0-596-00173-5 [1st edition July 2005]
+ ISBN 978-0-596-15900-9 [ebook]
http://oreilly.com/catalog/9780596001735
=item I<Higher-Order Perl>
by Mark-Jason Dominus
- ISBN: 1-55860-701-3 [1st edition March 2005]
+ ISBN 1-55860-701-3 [1st edition March 2005]
+ free ebook http://hop.perl.plover.com/book/
http://hop.perl.plover.com/
=item I<Mastering Regular Expressions>
by Jeffrey E. F. Friedl
ISBN 978-0-596-52812-6 [3rd edition August 2006]
+ ISBN 978-0-596-55899-4 [ebook]
http://oreilly.com/catalog/9780596528126
=item I<Network Programming with Perl>
by Darren Chamberlain, Dave Cross, and Andy Wardley
ISBN 978-0-596-00476-7 [December 2003]
+ ISBN 978-1-4493-8647-4 [ebook]
http://oreilly.com/catalog/9780596004767
=item I<Object Oriented Perl>
by Damian Conway
with foreword by Randal L. Schwartz
- ISBN 1-884777-79-1 [1st edition August 1999]
+ ISBN 1-884777-79-1 [1st edition August 1999 & ebook]
http://www.manning.com/conway/
=item I<Data Munging with Perl>
by Dave Cross
- ISBN 1-930110-00-6 [1st edition 2001]
+ ISBN 1-930110-00-6 [1st edition 2001 & ebook]
http://www.manning.com/cross
=item I<Mastering Perl/Tk>
by Steve Lidie and Nancy Walsh
ISBN 978-1-56592-716-2 [1st edition January 2002]
+ ISBN 978-0-596-10344-6 [ebook]
http://oreilly.com/catalog/9781565927162
=item I<Extending and Embedding Perl>
by Tim Jenness and Simon Cozens
- ISBN 1-930110-82-0 [1st edition August 2002]
+ ISBN 1-930110-82-0 [1st edition August 2002 & ebook]
http://www.manning.com/jenness
=item I<Pro Perl Debugging>
by Richard Foley with Andy Lester
- ISBN 1-59059-454-1 [1st edition July 2005]
+ ISBN 1-59059-454-1 [1st edition July 2005 & ebook]
http://www.apress.com/9781590594544
=back
=head1 NAME
-perldelta - what is new for perl v5.21.10
+perldelta - what is new for perl v5.21.11
=head1 DESCRIPTION
-This document describes differences between the 5.21.9 release and the 5.21.10
+This document describes differences between the 5.21.10 release and the 5.21.11
release.
-If you are upgrading from an earlier release such as 5.21.8, first read
-L<perl5219delta>, which describes differences between 5.21.8 and 5.21.9.
+If you are upgrading from an earlier release such as 5.21.9, first read
+L<perl52110delta>, which describes differences between 5.21.9 and 5.21.10.
-=head1 Incompatible Changes
+=head1 Deprecations
-=head2 C<(?[...])> operators now follow standard Perl precedence
+=head2 Making all warnings fatal is discouraged
-This experimental feature allows set operations in regular expression patterns.
-Prior to this, the intersection operator had the same precedence as the other
-binary operators. Now it has higher precedence. This could lead to different
-outcomes than existing code expects (though the documentation has always noted
-that this change might happen, recommending fully parenthesizing the
-expressions). See L<perlrecharclass/Extended Bracketed Character Classes>.
-
-=head1 Performance Enhancements
-
-=over 4
-
-=item *
-
-The functions C<utf8::native_to_unicode()> and C<utf8::unicode_to_native()>
-(see L<utf8>) are now optimized out on ASCII platforms. There is now not even
-a minimal performance hit in writing code portable between ASCII and EBCDIC
-platforms.
-
-=back
+The documentation for L<fatal warnings|warnings/Fatal Warnings> notes that
+C<< use warnings FATAL => 'all' >> is discouraged and provides stronger
+language about the risks of fatal warnings in general.
=head1 Modules and Pragmata
=item *
-L<B> has been upgraded from version 1.56 to 1.57.
+L<attributes> has been upgraded from version 0.26 to 0.27.
=item *
-L<B::Deparse> has been upgraded from version 1.33 to 1.34.
-
-Deparse C<$#_> as that instead of as C<$#{_}>.
-L<[perl #123947]|https://rt.perl.org/Ticket/Display.html?id=123947>
+L<B> has been upgraded from version 1.57 to 1.58.
=item *
-L<Carp> has been upgraded from version 1.35 to 1.36.
+L<B::Deparse> has been upgraded from version 1.34 to 1.35.
-=item *
-
-L<CPAN> has been upgraded from version 2.05 to 2.10.
-
-=over 4
-
-=item *
-
-Add support for C<Cwd::getdcwd()> and introduce workaround for a misbehaviour
-seen on Strawberry Perl 5.20.1.
+C<< <<>> >> is now correctly deparsed.
=item *
-Fix C<chdir()> after building dependencies bug.
+L<Config::Perl::V> has been upgraded from version 0.23 to 0.24.
=item *
-Introduce experimental support for plugins/hooks.
+L<CPAN> has been upgraded from version 2.10 to 2.11.
=item *
-Integrate the App::Cpan sources.
-
-=item *
-
-Do not check recursion on optional dependencies.
-
-=item *
-
-Sanity check META.yml to contain a hash.
-L<[cpan #95271]|https://rt.cpan.org/Ticket/Display.html?id=95271>
-
-=back
+L<Cwd> has been upgraded from version 3.55 to 3.56.
=item *
-L<CPAN::Meta> has been upgraded from version 2.143240 to 2.150001.
+L<ExtUtils::Miniperl> has been upgraded from version 1.04 to 1.05.
=item *
-L<Data::Dumper> has been upgraded from version 2.157 to 2.158.
+L<ExtUtils::ParseXS> has been upgraded from version 3.27 to 3.28.
=item *
-L<DB> has been upgraded from version 1.07 to 1.08.
+L<ExtUtils::Typemaps> has been upgraded from version 3.25 to 3.28.
=item *
-L<Devel::PPPort> has been upgraded from version 3.28 to 3.31.
+L<File::Spec> has been upgraded from version 3.55 to 3.56.
=item *
-L<DynaLoader> has been upgraded from version 1.31 to 1.32.
-
-=item *
+L<if> has been upgraded from version 0.0603 to 0.0604.
-L<Encode> has been upgraded from version 2.70 to 2.72.
+The documentation now notes that this module also works with C<no>.
=item *
-L<encoding> has been upgraded from version 2.13 to 2.14.
+L<IO::Socket::IP> has been upgraded from version 0.36 to 0.37.
=item *
-L<Getopt::Long> has been upgraded from version 2.43 to 2.45.
+L<Module::CoreList> has been upgraded from version 5.20150320 to 5.20150420.
-=item *
-
-L<locale> has been upgraded from version 1.05 to 1.06.
+Updated to cover the latest releases of Perl. Also fixes a fencepost error in
+is_core() and copes with versions that do not match x.yyyzzz.
=item *
-L<Locale::Codes> has been upgraded from version 3.33 to 3.34.
-
-=item *
+L<perl5db.pl> has been upgraded from 1.48 to 1.49.
-L<Module::CoreList> has been upgraded from version 5.20150220 to 5.20150320.
+The debugger would cause an assertion failure.
+L<[perl #124127]|https://rt.perl.org/Ticket/Display.html?id=124127>
=item *
-L<parent> has been upgraded from version 0.228 to 0.232.
-
-No changes to installed files other than the version bump.
+L<PerlIO::mmap> has been upgraded from version 0.013 to 0.014.
=item *
-The PathTools modules have been upgraded from version 3.54 to 3.55.
-
-=item *
+L<utf8> has been upgraded from version 1.15 to 1.16.
-L<Pod::Functions> has been upgraded from version 1.08 to 1.09.
+Minor documentation update only.
=item *
-L<POSIX> has been upgraded from version 1.51 to 1.52.
-
-=item *
+L<warnings> has been upgraded from version 1.31 to 1.32.
-L<re> has been upgraded from version 0.31 to 0.32.
+=back
-=item *
+=head1 Documentation
-L<sigtrap> has been upgraded from version 1.07 to 1.08.
+=head2 Changes to Existing Documentation
-=item *
+=head3 L<perlebcdic>
-L<Term::Complete> has been upgraded from version 1.402 to 1.403.
+=over 4
=item *
-L<Test::Simple> has been reverted from version 1.301001_098 to 1.001014.
+This document has been significantly updated in the light of recent
+improvements to EBCDIC support.
-=item *
+=back
-L<Text::Balanced> has been upgraded from version 2.02 to 2.03.
+=head3 L<perlfunc>
-No changes to installed files other than the version bump.
+=over 4
=item *
-L<Text::ParseWords> has been upgraded from version 3.29 to 3.30.
-
-=item *
+Mention that C<study()> is currently a no-op.
-L<threads> has been upgraded from version 1.96_001 to 2.01.
+=back
-=item *
+=head3 L<perlguts>
-L<Unicode::Collate> has been upgraded from version 1.11 to 1.12.
+=over 4
=item *
-L<utf8> has been upgraded from version 1.14 to 1.15.
+The OOK example has been updated to account for COW changes and a change in the
+storage of the offset.
=back
-=head1 Documentation
-
-=head2 Changes to Existing Documentation
-
-=head3 L<perldata>
+=head3 L<perlhacktips>
=over 4
=item *
-Documentation has been added regarding the special floating point values C<Inf>
-and C<NaN>.
+Documentation has been added illustrating the perils of assuming the contents
+of static memory pointed to by the return values of Perl wrappers for C library
+functions doesn't change.
=back
-=head3 L<perlexperiment>
+=head3 L<perlport>
=over 4
=item *
-Removed note about C<\s> matching C<VT> now that it is no longer experimental.
-
-=item *
-
-Added note that C<use re 'strict'> has been introduced experimentally.
+Out-of-date VMS-specific information has been fixed/simplified.
=back
-=head3 L<perlpolicy>
+=head3 L<perluniintro>
=over 4
=item *
-The documentation of what to expect to see in future maintenance releases has
-been updated. Essentially the same types of changes will be included as before
-but with fewer changes that don't affect the installation or execution of perl.
+Advice for how to make sure your strings and regular expression patterns are
+interpreted as Unicode has been revised to account for the new Perl 5.22 EBCDIC
+handling.
=back
-=head1 Diagnostics
-
-The following additions or changes have been made to diagnostic output,
-including warnings and fatal error messages. For the complete list of
-diagnostic messages, see L<perldiag>.
-
-=head2 New Diagnostics
-
-=head3 New Errors
+=head3 L<perlvms>
=over 4
=item *
-L<Invalid quantifier in {,} in regex; marked by <-- HERE in mE<sol>%sE<sol>|perldiag/"Invalid quantifier in {,} in regex; marked by <-- HERE in m/%s/">
-
-(F) The pattern looks like a {min,max} quantifier, but the min or max could not
-be parsed as a valid number - either it has leading zeroes, or it represents
-too big a number to cope with. The S<<-- HERE> shows where in the regular
-expression the problem was discovered. See L<perlre>.
+Out-of-date and/or incorrect material has been removed.
=back
=item *
-Tests for performance issues have been added in the file F<t/perf/taint.t>.
+F<t/porting/re_context.t> has been added to test that L<utf8> and its
+dependencies only use the subset of the C<$1..$n> capture vars that
+Perl_save_re_context() is hard-coded to localize, because that function has no
+efficient way of determining at runtime what vars to localize.
=back
=head1 Platform Support
-=head2 New Platforms
+=head2 Platform-Specific Notes
=over 4
-=item z/OS running EBCDIC Code Page 1047
+=item Win32
-Core perl now works on this EBCDIC platform. Early perls also worked, but,
-even though support wasn't officially withdrawn, recent perls would not compile
-and run well. Perl 5.20 would work, but had many bugs which have now been
-fixed. Many CPAN modules that ship with Perl still fail tests, including
-Pod::Simple. However the version of Pod::Simple currently on CPAN should work;
-it was fixed too late to include in Perl 5.22. Work is under way to fix many
-of the still-broken CPAN modules, which likely will be installed on CPAN when
-completed, so that you may not have to wait until Perl 5.24 to get a working
-version.
+F<miniperl.exe> is now built with C<-fno-strict-aliasing>, allowing 64-bit
+builds to complete on GCC 4.8.
+L<[perl #123976]|https://rt.perl.org/Ticket/Display.html?id=123976>
+
+C<test-prep> again depends on C<test-prep-gcc> for GCC builds.
+L<[perl #124221]|https://rt.perl.org/Ticket/Display.html?id=124221>
=back
-=head2 Platform-Specific Notes
+=head1 Internal Changes
=over 4
-=item HP-UX
-
-The archname now distinguishes use64bitint from use64bitall.
-
-=back
+=item *
-=head1 Internal Changes
+Perl 5.21.2 introduced a new build option, C<-DPERL_OP_PARENT>, which causes
+the last C<op_sibling> pointer to refer back to the parent rather than being
+C<NULL>, and where instead a new flag indicates the end of the chain. In this
+release, the new implementation has been revised; in particular:
=over 4
=item *
-Macros have been created to allow XS code to better manipulate the POSIX locale
-category C<LC_NUMERIC>. See L<perlapi/Locale-related functions and macros>.
+On C<PERL_OP_PARENT> builds, the C<op_sibling> field has been renamed
+C<op_sibparent> to reflect its new dual purpose. Since the intention is that
+this field should primarily be accessed via macros, this change should be
+transparent for code written to work under C<PERL_OP_PARENT>.
=item *
-The previous C<atoi> et al replacement function, C<grok_atou>, has now been
-superseded by C<grok_atoUV>. See L<perlclib> for details.
+The newly-introduced C<op_lastsib> flag bit has been renamed C<op_moresib> and
+its logic inverted; i.e. it is initialised to zero in a new op, and is changed
+to 1 when an op gains a sibling.
-=back
-
-=head1 Selected Bug Fixes
+=item *
-=over 4
+The function C<Perl_op_parent> is now only available on C<PERL_OP_PARENT>
+builds. Using it on a plain build will be a compile-timer error.
=item *
-Repeated global pattern matches in scalar context on large tainted strings were
-exponentially slow depending on the current match position in the string.
-L<[perl #123202]|https://rt.perl.org/Ticket/Display.html?id=123202>
+Three new macros, C<OpMORESIB_set>, C<OpLASTSIB_set>, C<OpMAYBESIB_set> have
+been added, which are intended to be a low-level portable way to set
+C<op_sibling> / C<op_sibparent> while also updating C<op_moresib>. The first
+sets the sibling pointer to a new sibling, the second makes the op the last
+sibling, and the third conditionally does the first or second action. The
+C<op_sibling_splice()> function is retained as a higher-level interface that
+can also maintain consistency in the parent at the same time (e.g. by updating
+C<op_first> and C<op_last> where appropriate).
=item *
-Various crashes due to the parser getting confused by syntax errors have been
-fixed.
-L<[perl #123801]|https://rt.perl.org/Ticket/Display.html?id=123801>
-L<[perl #123802]|https://rt.perl.org/Ticket/Display.html?id=123802>
-L<[perl #123955]|https://rt.perl.org/Ticket/Display.html?id=123955>
-L<[perl #123995]|https://rt.perl.org/Ticket/Display.html?id=123995>
+The macro C<OpSIBLING_set>, added in Perl 5.21.2, has been removed. It didn't
+manipulate C<op_moresib> and has been superseded by C<OpMORESIB_set> et al.
=item *
-C<split> in the scope of lexical $_ has been fixed not to fail assertions.
-L<[perl #123763]|https://rt.perl.org/Ticket/Display.html?id=123763>
+The C<op_sibling_splice> function now accepts a null C<parent> argument where
+the splicing doesn't affect the first or last ops in the sibling chain, and
+thus where the parent doesn't need to be updated accordingly.
-=item *
+=back
-C<my $x : attr> syntax inside various list operators no longer fails
-assertions.
-L<[perl #123817]|https://rt.perl.org/Ticket/Display.html?id=123817>
+=back
-=item *
+=head1 Selected Bug Fixes
-An @ sign in quotes followed by a non-ASCII digit (which is not a valid
-identifier) would cause the parser to crash, instead of simply trying the @ as
-literal. This has been fixed.
-L<[perl #123963]|https://rt.perl.org/Ticket/Display.html?id=123963>
+=over 4
=item *
-C<*bar::=*foo::=*glob_with_hash> has been crashing since Perl 5.14, but no
-longer does.
-L<[perl #123847]|https://rt.perl.org/Ticket/Display.html?id=123847>
+C<pack("D", $x)> and C<pack("F", $x)> now zero the padding on x86 long double
+builds. GCC 4.8 and later, under some build options, would either overwrite
+the zero-initialized padding, or bypass the initialized buffer entirely. This
+caused F<op/pack.t> to fail.
+L<[perl #123971]|https://rt.perl.org/Ticket/Display.html?id=123971>
=item *
-C<foreach> in scalar context was not pushing an item on to the stack, resulting
-in bugs. (C<print 4, scalar do { foreach(@x){} } + 1> would print 5.) It has
-been fixed to return C<undef>.
-L<[perl #124004]|https://rt.perl.org/Ticket/Display.html?id=124004>
+Extending an array cloned from a parent thread could result in "Modification of
+a read-only value attempted" errors when attempting to modify the new elements.
+L<[perl #124127]|https://rt.perl.org/Ticket/Display.html?id=124127>
=item *
-A memory leak introduced in Perl 5.21.6 has been fixed.
-L<[perl #123922]|https://rt.perl.org/Ticket/Display.html?id=123922>
+An assertion failure and subsequent crash with C<< *x=<y> >> has been fixed.
+L<[perl #123790]|https://rt.perl.org/Ticket/Display.html?id=123790>
=item *
-A regression in the behaviour of the C<readline> built-in function, caused by
-the introduction of the C<< <<>> >> operator, has been fixed.
-L<[perl #123990]|https://rt.perl.org/Ticket/Display.html?id=123990>
+An optimization for state variable initialization introduced in Perl 5.21.6 has
+been reverted because it was found to exacerbate some other existing buggy
+behaviour.
+L<[perl #124160]|https://rt.perl.org/Ticket/Display.html?id=124160>
=item *
-Several cases of data used to store environment variable contents in core C
-code being potentially overwritten before being used have been fixed.
-L<[perl #123748]|https://rt.perl.org/Ticket/Display.html?id=123748>
+The extension of another optimization to cover more ops in Perl 5.21 has also
+been reverted to its Perl 5.20 state as a temporary fix for regression issues
+that it caused.
+L<[perl #123790]|https://rt.perl.org/Ticket/Display.html?id=123790>
-=back
+=item *
-=head1 Known Problems
+New bitwise ops added in Perl 5.21.9 accidentally caused C<$^H |= 0x1c020000>
+to enable all features. This has now been fixed.
-=over 4
+=item *
+
+A possible crashing/looping bug has been fixed.
+L<[perl #124099]|https://rt.perl.org/Ticket/Display.html?id=124099>
=item *
-A goal is for Perl to be able to be recompiled to work reasonably well on any
-Unicode version. In Perl 5.22, though, the earliest such version is Unicode
-5.1 (current is 7.0).
+UTF-8 variable names used in array indexes, unquoted UTF-8 HERE-document
+terminators and UTF-8 function names all now work correctly.
+L<[perl #124113]|https://rt.perl.org/Ticket/Display.html?id=124113>
=item *
-EBCDIC platforms
+Breakage in C<require(VERSION)> (with parentheses), introduced in Perl 5.21.6,
+has been fixed.
+L<[perl #124135]|https://rt.perl.org/Ticket/Display.html?id=124135>
-=over 4
+=item *
+
+Wide char warnings, wrongly raised in UTF-8 locales since Perl 5.21.8, are now
+suppressed.
+L<[perl #123527]|https://rt.perl.org/Ticket/Display.html?id=123527>
=item *
-Encode and encoding are mostly broken.
+A subtle bug introduced in Perl 5.21.4 involving UTF-8 in regular expressions
+and sometimes causing a crash has been fixed. A new test script has been added
+to test this fix; see under L</Testing>.
+L<[perl #124109]|https://rt.perl.org/Ticket/Display.html?id=124109>
=item *
-Many cpan modules that are shipped with core show failing tests.
+A change introduced in Perl 5.21.10 that broke the autovivification CPAN module
+has been reverted.
=item *
-C<pack>/C<unpack> with C<"U0"> format may not work properly.
+A bug whereby C<< 'FOO'->f() >> lost the read-only status of C<FOO>, introduced
+in Perl 5.21.7, has been fixed.
+L<[perl #123619]|https://rt.perl.org/Ticket/Display.html?id=123619>
-=back
+=item *
+
+A regression in Perl 5.21 in the matching of C</[A-Z]/ai> has been fixed.
=back
=head1 Acknowledgements
-Perl 5.21.10 represents approximately 4 weeks of development since Perl 5.21.9
-and contains approximately 170,000 lines of changes across 860 files from 27
+Perl 5.21.11 represents approximately 4 weeks of development since Perl 5.21.10
+and contains approximately 5,800 lines of changes across 240 files from 24
authors.
Excluding auto-generated files, documentation and release tools, there were
-approximately 170,000 lines of changes to 610 .pm, .t, .c and .h files.
+approximately 1,700 lines of changes to 160 .pm, .t, .c and .h files.
Perl continues to flourish into its third decade thanks to a vibrant community
of users and developers. The following people are known to have contributed
-the improvements that became Perl 5.21.10:
+the improvements that became Perl 5.21.11:
-Chris 'BinGOs' Williams, David Golden, David Mitchell, David Wheeler, Father
-Chrysostomos, H.Merijn Brand, Hugo van der Sanden, James E Keenan, Jarkko
-Hietaniemi, Jasmine Ngan, Jerry D. Hedden, John Goodyear, Karen Etheridge, Karl
-Williamson, Lukas Mai, Matthew Horsfall, Nicholas Clark, Petr Písař, Rafael
-Garcia-Suarez, Reini Urban, Ricardo Signes, Sawyer X, Steffen Müller, Steve
-Hay, Sullivan Beck, Tony Cook, Vincent Pit.
+Alex Vandiver, Andreas König, Craig A. Berry, Dagfinn Ilmari Mannsåker, Daniel
+Dragan, David Golden, David Mitchell, Father Chrysostomos, H.Merijn Brand,
+Herbert Breunung, Hugo van der Sanden, James E Keenan, James McCoy, Karl
+Williamson, Matthew Horsfall, Max Maischein, Nicholas Clark, Rafael
+Garcia-Suarez, Randy Stauner, Ricardo Signes, Shirakata Kentaro, Steffen
+Müller, Steve Hay, Tony Cook.
The list above is almost certainly incomplete as it is automatically generated
from version control history. In particular, it does not include the names of
If you find what you think is a bug, you might check the articles recently
posted to the comp.lang.perl.misc newsgroup and the perl bug database at
-https://rt.perl.org/ . There may also be information at http://www.perl.org/ ,
-the Perl Home Page.
+https://rt.perl.org/ . There may also be information at
+http://www.perl.org/ , the Perl Home Page.
If you believe you have an unreported bug, please run the L<perlbug> program
included with your release. Be sure to trim your bug down to a tiny but
encountered an invalid data type.
=item Both or neither range ends should be Unicode in regex; marked by
-<-- HERE in m/%s/
+S<<-- HERE> in m/%s/
(W regexp) (only under C<S<use re 'strict'>> or within C<(?[...])>)
could be defined by a translator installed into C<$^H{charnames}>.
See L<charnames/CUSTOM ALIASES>.
-=item \C is deprecated in regex; marked by <-- HERE in m/%s/
+=item \C is deprecated in regex; marked by S<<-- HERE> in m/%s/
(D deprecated, regexp) The \C character class is deprecated, and will
become a compile-time error in a future release of perl (tentatively
(F) The parser found inconsistencies either while attempting
to define an overloaded constant, or when trying to find the
character name specified in the C<\N{...}> escape. Perhaps you
-forgot to load the corresponding L<overload> pragma?.
+forgot to load the corresponding L<overload> pragma?
=item :const is experimental
most likely cause of this error is that you left out a parenthesis inside
of the C<....> part.
-The <-- HERE shows whereabouts in the regular expression the problem was
+The S<<-- HERE> shows whereabouts in the regular expression the problem was
discovered.
=item %s defines neither package nor VERSION--version check failed
(F) You used a pattern that nested too many EVAL calls without consuming
any text. Restructure the pattern so that text is consumed.
-The <-- HERE shows whereabouts in the regular expression the problem was
+The S<<-- HERE> shows whereabouts in the regular expression the problem was
discovered.
=item Excessively long <> operator
with the B<-D> option with no flags to see the list of acceptable values.
See also L<perlrun/-Dletters>.
-=item Invalid quantifier in {,} in regex; marked by <-- HERE in m/%s/
+=item Invalid quantifier in {,} in regex; marked by S<<-- HERE> in m/%s/
(F) The pattern looks like a {min,max} quantifier, but the min or max
could not be parsed as a valid number - either it has leading zeroes,
(F) Your machine doesn't implement the sockatmark() functionality,
neither as a system call nor an ioctl call (SIOCATMARK).
-=item '%s' is an unknown bound type in regex; marked by <-- HERE in m/%s/
+=item '%s' is an unknown bound type in regex; marked by S<<-- HERE> in m/%s/
(F) You used C<\b{...}> or C<\B{...}> and the C<...> is not known to
Perl. The current valid ones are given in
L<perlrebackslash/\b{}, \b, \B{}, \B>.
-=item "%s" is more clearly written simply as "%s" in regex; marked by <-- HERE in m/%s/
+=item "%s" is more clearly written simply as "%s" in regex; marked by S<<-- HERE> in m/%s/
(W regexp) (only under C<S<use re 'strict'>> or within C<(?[...])>)
no warnings "experimental::autoderef";
-=item POSIX class [:%s:] unknown in regex; marked by S<< <-- HERE in m/%s/ >>
+=item POSIX class [:%s:] unknown in regex; marked by S<<-- HERE> in m/%s/
(F) The class in the character class [: :] syntax is unknown. The S<<-- HERE>
shows whereabouts in the regular expression the problem was discovered.
no warnings "experimental::autoderef";
-=item Quantifier follows nothing in regex; marked by S<< <-- HERE in m/%s/ >>
+=item Quantifier follows nothing in regex; marked by S<<-- HERE> in m/%s/
(F) You started a regular expression with a quantifier. Backslash it if
you meant it literally. The S<<-- HERE> shows whereabouts in the regular
expression the problem was discovered. See L<perlre>.
-=item Quantifier in {,} bigger than %d in regex; marked by S<<-- HERE> in
-m/%s/
+=item Quantifier in {,} bigger than %d in regex; marked by S<<-- HERE> in m/%s/
(F) There is currently a limit to the size of the min and max values of
the {min,max} construct. The S<<-- HERE> shows whereabouts in the regular
by prepending "0" to your numbers.
=item Ranges of ASCII printables should be some subset of "0-9", "A-Z", or
-"a-z" in regex; marked by <-- HERE in m/%s/
+"a-z" in regex; marked by S<<-- HERE> in m/%s/
(W regexp) (only under C<S<use re 'strict'>> or within C<(?[...])>)
must be all digits, or all uppercase letters, or all lowercase letters.
=item Ranges of digits should be from the same group in regex; marked by
-<-- HERE in m/%s/
+S<<-- HERE> in m/%s/
(W regexp) (only under C<S<use re 'strict'>> or within C<(?[...])>)
you wanted to have the character with ordinal 7 inserted into the regular
expression, prepend zeroes to make it three digits long: C<\007>
-The <-- HERE shows whereabouts in the regular expression the problem was
+The S<<-- HERE> shows whereabouts in the regular expression the problem was
discovered.
=item Reference to nonexistent named group in regex; marked by S<<-- HERE>
such as C<(?'NAME'...)> or C<< (?<NAME>...) >>. Check if the name has been
spelled correctly both in the backreference and the declaration.
-The <-- HERE shows whereabouts in the regular expression the problem was
+The S<<-- HERE> shows whereabouts in the regular expression the problem was
discovered.
=item Reference to nonexistent or unclosed group in regex; marked by
are not at least seven sets of closed capturing parentheses in the
expression before where the C<\g{-7}> was located.
-The <-- HERE shows whereabouts in the regular expression the problem was
+The S<<-- HERE> shows whereabouts in the regular expression the problem was
discovered.
=item regexp memory corruption
(R&NAME) true if directly inside named capture
(DEFINE) always false; for defining named subpatterns
-The <-- HERE shows whereabouts in the regular expression the problem was
+The S<<-- HERE> shows whereabouts in the regular expression the problem was
discovered. See L<perlre>.
=item Switch (?(condition)... not terminated in regex; marked by
Check the #! line, or manually feed your script into Perl yourself.
=item Unescaped left brace in regex is deprecated, passed through in regex;
-marked by <-- HERE in m/%s/
+marked by S<<-- HERE> in m/%s/
(D deprecated, regexp) You used a literal C<"{"> character in a regular
expression pattern. You should change to use C<"\{"> instead, because a
(R&NAME) true if directly inside named capture
(DEFINE) always false; for defining named subpatterns
-The <-- HERE shows whereabouts in the regular expression the problem was
+The S<<-- HERE> shows whereabouts in the regular expression the problem was
discovered. See L<perlre>.
=item Unknown Unicode option letter '%c'
if ($string =~ /$pattern/) { ... }
-The <-- HERE shows whereabouts in the regular expression the problem was
+The S<<-- HERE> shows whereabouts in the regular expression the problem was
discovered. See L<perlre>.
=item Useless localization of %s
if ($string =~ /$pattern/o) { ... }
-The <-- HERE shows whereabouts in the regular expression the problem was
+The S<<-- HERE> shows whereabouts in the regular expression the problem was
discovered. See L<perlre>.
=item Useless use of attribute "const"
these circumstances, Perl discards all but the first character
of the returned sequence, which is not likely what you want.
-=item Using /u for '%s' instead of /%s in regex; marked by <-- HERE in m/%s/
+=item Using /u for '%s' instead of /%s in regex; marked by S<<-- HERE> in m/%s/
(W regexp) You used a Unicode boundary (C<\b{...}> or C<\B{...}>) in a
portion of a regular expression where the character set modifiers C</a>
=head1 DESCRIPTION
An exploration of some of the issues facing Perl programmers
-on EBCDIC based computers. We do not cover localization,
-internationalization, or multi-byte character set issues other
-than some discussion of UTF-8 and UTF-EBCDIC.
+on EBCDIC based computers.
-Portions that are still incomplete are marked with XXX.
+Portions of this document that are still incomplete are marked with XXX.
-Perl used to work on EBCDIC machines, but there are now areas of the code where
-it doesn't. If you want to use Perl on an EBCDIC machine, please let us know
+Early Perl versions worked on some EBCDIC machines, but the last known
+version that ran on EBCDIC was v5.8.7, until v5.22, when the Perl core
+again works on z/OS. Theoretically, it could work on OS/400 or Siemens'
+BS2000 (or their successors), but this is untested. In v5.22, not all
+the modules found on CPAN but shipped with core Perl work on z/OS.
+
+If you want to use Perl on a non-z/OS EBCDIC machine, please let us know
by sending mail to perlbug@perl.org
+Writing Perl on an EBCDIC platform is really no different than writing
+on an L</ASCII> one, but with different underlying numbers, as we'll see
+shortly. You'll have to know something about those L</ASCII> platforms
+because the documentation is biased and will frequently use example
+numbers that don't apply to EBCDIC. There are also very few CPAN
+modules that are written for EBCDIC and which don't work on ASCII;
+instead the vast majority of CPAN modules are written for ASCII, and
+some may happen to work on EBCDIC, while a few have been designed to
+portably work on both.
+
+If your code just uses the 52 letters A-Z and a-z, plus SPACE, the
+digits 0-9, and the punctuation characters that Perl uses, plus a few
+controls that are denoted by escape sequences like C<\n> and C<\t>, then
+there's nothing special about using Perl, and your code may very well
+work on an ASCII machine without change.
+
+But if you write code that uses C<\005> to mean a TAB or C<\xC1> to mean
+an "A", or C<\xDF> to mean a "E<yuml>" (small C<"y"> with a diaeresis),
+then your code may well work on your EBCDIC platform, but not on an
+ASCII one. That's fine to do if no one will ever want to run your code
+on an ASCII platform; but the bias in this document will be in writing
+code portable between EBCDIC and ASCII systems. Again, if every
+character you care about is easily enterable from your keyboard, you
+don't have to know anything about ASCII, but many keyboards don't easily
+allow you to directly enter, say, the character C<\xDF>, so you have to
+specify it indirectly, such as by using the C<"\xDF"> escape sequence.
+In those cases it's easiest to know something about the ASCII/Unicode
+character sets. If you know that the small "E<yuml>" is C<U+00FF>, then
+you can instead specify it as C<"\N{U+FF}">, and have the computer
+automatically translate it to C<\xDF> on your platform, and leave it as
+C<\xFF> on ASCII ones. Or you could specify it by name, C<\N{LATIN
+SMALL LETTER Y WITH DIAERESIS> and not have to know the numbers.
+Either way works, but require familiarity with Unicode.
+
=head1 COMMON CHARACTER CODE SETS
=head2 ASCII
-The American Standard Code for Information Interchange (ASCII or US-ASCII) is a
-set of
-integers running from 0 to 127 (decimal) that imply character
-interpretation by the display and other systems of computers.
+The American Standard Code for Information Interchange (ASCII or
+US-ASCII) is a set of
+integers running from 0 to 127 (decimal) that have standardized
+interpretations by the computers which use ASCII. For example, 65 means
+the letter "A".
The range 0..127 can be covered by setting the bits in a 7-bit binary
digit, hence the set is sometimes referred to as "7-bit ASCII".
ASCII was described by the American National Standards Institute
document ANSI X3.4-1986. It was also described by ISO 646:1991
(with localization for currency symbols). The full ASCII set is
-given in the table below as the first 128 elements. Languages that
+given in the table L<below|/recipe 3> as the first 128 elements.
+Languages that
can be written adequately with the characters in ASCII include
English, Hawaiian, Indonesian, Swahili and some Native American
languages.
-There are many character sets that extend the range of integers
-from 0..2**7-1 up to 2**8-1, or 8 bit bytes (octets if you prefer).
-One common one is the ISO 8859-1 character set.
+Most non-EBCDIC character sets are supersets of ASCII. That is the
+integers 0-127 mean what ASCII says they mean. But integers 128 and
+above are specific to the character set.
+
+Many of these fit entirely into 8 bits, using ASCII as 0-127, while
+specifying what 128-255 mean, and not using anything above 255.
+Thus, these are single-byte (or octet if you prefer) character sets.
+One important one (since Unicode is a superset of it) is the ISO 8859-1
+character set.
=head2 ISO 8859
-The ISO 8859-$n are a collection of character code sets from the
-International Organization for Standardization (ISO), each of which
-adds characters to the ASCII set that are typically found in European
+The ISO 8859-I<B<$n>> are a collection of character code sets from the
+International Organization for Standardization (ISO), each of which adds
+characters to the ASCII set that are typically found in various
languages, many of which are based on the Roman, or Latin, alphabet.
+Most are for European languages, but there are also ones for Arabic,
+Greek, Hebrew, and Thai. There are good references on the web about
+all these.
=head2 Latin 1 (ISO 8859-1)
German can use ISO 8859-1 but must do so without German-style
quotation marks. This set is based on Western European extensions
to ASCII and is commonly encountered in world wide web work.
-In IBM character code set identification terminology ISO 8859-1 is
+In IBM character code set identification terminology, ISO 8859-1 is
also known as CCSID 819 (or sometimes 0819 or even 00819).
=head2 EBCDIC
The Extended Binary Coded Decimal Interchange Code refers to a
large collection of single- and multi-byte coded character sets that are
-different from ASCII or ISO 8859-1 and are all slightly different from each
-other; they typically run on host computers. The EBCDIC encodings derive from
-8-bit byte extensions of Hollerith punched card encodings. The layout on the
-cards was such that high bits were set for the upper and lower case alphabet
-characters [a-z] and [A-Z], but there were gaps within each Latin alphabet
-range.
+quite different from ASCII and ISO 8859-1, and are all slightly
+different from each other; they typically run on host computers. The
+EBCDIC encodings derive from 8-bit byte extensions of Hollerith punched
+card encodings, which long predate ASCII. The layout on the
+cards was such that high bits were set for the upper and lower case
+alphabetic
+characters C<[a-z]> and C<[A-Z]>, but there were gaps within each Latin
+alphabet range, visible in the table L<below|/recipe 3>. These gaps can
+cause complications.
Some IBM EBCDIC character sets may be known by character code set
identification numbers (CCSID numbers) or code page numbers.
accordingly to that platform. If the platform uses a character set that is not
one of the three Perl knows about, Perl will either fail to compile, or
mistakenly and silently choose one of the three.
-They are:
+
+=head3 EBCDIC code sets recognized by Perl
=over
characters (i.e. ISO 8859-1) to an EBCDIC set. 0037 is used
in North American English locales on the OS/400 operating system
that runs on AS/400 computers. CCSID 0037 differs from ISO 8859-1
-in 237 places, in other words they agree on only 19 code point values.
+in 237 places; in other words they agree on only 19 code point values.
=item B<1047>
In Unicode terminology a I<code point> is the number assigned to a
character: for example, in EBCDIC the character "A" is usually assigned
-the number 193. In Unicode the character "A" is assigned the number 65.
-This causes a problem with the semantics of the pack/unpack "U", which
-are supposed to pack Unicode code points to characters and back to numbers.
-The problem is: which code points to use for code points less than 256?
-(for 256 and over there's no problem: Unicode code points are used)
-In EBCDIC, the EBCDIC code points are used for the low 256. This
-means that the equivalences
-
- pack("U", ord($character)) eq $character
- unpack("U", $character) == ord $character
-
-will hold. (If Unicode code points were applied consistently over
-all the possible code points, pack("U",ord("A")) would in EBCDIC
-equal I<A with acute> or chr(101), and unpack("U", "A") would equal
-65, or I<non-breaking space>, not 193, or ord "A".)
-
-=head2 Remaining Perl Unicode problems in EBCDIC
-
-=over 4
-
-=item *
-
-The extensions Unicode::Collate and Unicode::Normalized are not
-supported under EBCDIC, likewise for the (now deprecated) encoding pragma.
-
-=back
+the number 193. In Unicode, the character "A" is assigned the number 65.
+All the code points in ASCII and Latin-1 (ISO 8859-1) have the same
+meaning in Unicode. All three of the recognized EBCDIC code sets have
+256 code points, and in each code set, all 256 code points are mapped to
+equivalent Latin1 code points. Obviously, "A" will map to "A", "B" =>
+"B", "%" => "%", etc., for all printable characters in Latin1 and these
+code pages.
+
+It also turns out that EBCDIC has nearly precise equivalents for the
+ASCII/Latin1 C0 controls and the DELETE control. (The C0 controls are
+those whose ASCII code points are 0..0x1F; things like TAB, ACK, BEL,
+etc.) A mapping is set up between these ASCII/EBCDIC controls. There
+isn't such a precise mapping between the C1 controls on ASCII platforms
+and the remaining EBCDIC controls. What has been done is to map these
+controls, mostly arbitrarily, to some otherwise unmatched character in
+the other character set. Most of these are very very rarely used
+nowadays in EBCDIC anyway, and their names have been dropped, without
+much complaint. For example the EO (Eight Ones) EBCDIC control
+(consisting of eight one bits = 0xFF) is mapped to the C1 APC control
+(0x9F), and you can't use the name "EO".
+
+The EBCDIC controls provide three possible line terminator characters,
+CR (0x0D), LF (0x25), and NL (0x15). On ASCII platforms, the symbols
+"NL" and "LF" refer to the same character, but in strict EBCDIC
+terminology they are different ones. The EBCDIC NL is mapped to the C1
+control called "NEL" ("Next Line"; here's a case where the mapping makes
+quite a bit of sense, and hence isn't just arbitrary). On some EBCDIC
+platforms, this NL or NEL is the typical line terminator. This is true
+of z/OS and BS2000. In these platforms, the C compilers will swap the
+LF and NEL code points, so that C<"\n"> is 0x15, and refers to NL. Perl
+does that too; you can see it in the code chart L<below|/recipe 3>.
+This makes things generally "just work" without you even having to be
+aware that there is a swap.
=head2 Unicode and UTF
-UTF stands for C<Unicode Transformation Format>.
+UTF stands for "Unicode Transformation Format".
UTF-8 is an encoding of Unicode into a sequence of 8-bit byte chunks, based on
ASCII and Latin-1.
The length of a sequence required to represent a Unicode code point
depends on the ordinal number of that code point,
with larger numbers requiring more bytes.
UTF-EBCDIC is like UTF-8, but based on EBCDIC.
+They are enough alike that often, casual usage will conflate the two
+terms, and use "UTF-8" to mean both the UTF-8 found on ASCII platforms,
+and the UTF-EBCDIC found on EBCDIC ones.
-You may see the term C<invariant> character or code point.
+You may see the term "invariant" character or code point.
This simply means that the character has the same numeric
-value when encoded as when not.
-(Note that this is a very different concept from L</The 13 variant characters>
-mentioned above.)
-For example, the ordinal value of 'A' is 193 in most EBCDIC code pages,
-and also is 193 when encoded in UTF-EBCDIC.
-All variant code points occupy at least two bytes when encoded.
-In UTF-8, the code points corresponding to the lowest 128
+value and representation when encoded in UTF-8 (or UTF-EBCDIC) as when
+not. (Note that this is a very different concept from L</The 13 variant
+characters> mentioned above. Careful prose will use the term "UTF-8
+invariant" instead of just "invariant", but most often you'll see just
+"invariant".) For example, the ordinal value of "A" is 193 in most
+EBCDIC code pages, and also is 193 when encoded in UTF-EBCDIC. All
+UTF-8 (or UTF-EBCDIC) variant code points occupy at least two bytes when
+encoded in UTF-8 (or UTF-EBCDIC); by definition, the UTF-8 (or
+UTF-EBCDIC) invariant code points are exactly one byte whether encoded
+in UTF-8 (or UTF-EBCDIC), or not. (By now you see why people typically
+just say "UTF-8" when they also mean "UTF-EBCDIC". For the rest of this
+document, we'll mostly be casual about it too.)
+In ASCII UTF-8, the code points corresponding to the lowest 128
ordinal numbers (0 - 127: the ASCII characters) are invariant.
In UTF-EBCDIC, there are 160 invariant characters.
(If you care, the EBCDIC invariants are those characters
which have ASCII equivalents, plus those that correspond to
-the C1 controls (80..9f on ASCII platforms).)
+the C1 controls (128 - 159 on ASCII platforms).)
A string encoded in UTF-EBCDIC may be longer (but never shorter) than
-one encoded in UTF-8.
+one encoded in UTF-8. Perl extends UTF-8 so that it can encode code
+points above the Unicode maximum of U+10FFFF. It extends UTF-EBCDIC as
+well, but due to the inherent limitations in UTF-EBCDIC, the maximum
+code point expressible is U+7FFF_FFFF, even if the word size is more
+than 32 bits.
+
+UTF-EBCDIC is defined by
+L<Unicode Technical Report #16|http://www.unicode.org/reports/tr16>.
+It is defined based on CCSID 1047, not allowing for the differences for
+other code pages. This allows for easy interchange of text between
+computers running different code pages, but makes it unusable, without
+adaptation, for Perl on those other code pages.
+
+The reason for this unusability is that a fundamental assumption of Perl
+is that the characters it cares about for parsing and lexical analysis
+are the same whether or not the text is in UTF-8. For example, Perl
+expects the character C<"["> to have the same representation, no matter
+if the string containing it (or program text) is UTF-8 encoded or not.
+To ensure this, Perl adapts UTF-EBCDIC to the particular code page so
+that all characters it expects to be UTF-8 invariant are in fact UTF-8
+invariant. This means that text generated on a computer running one
+version of Perl's UTF-EBCDIC has to be translated to be intelligible to
+a computer running another.
=head2 Using Encode
-Starting from Perl 5.8 you can use the standard new module Encode
+Starting from Perl 5.8 you can use the standard module Encode
to translate from EBCDIC to Latin-1 code points.
Encode knows about more EBCDIC character sets than Perl can currently
be compiled to run on.
For doing I/O it is suggested that you use the autotranslating features
of PerlIO, see L<perluniintro>.
-Since version 5.8 Perl uses the new PerlIO I/O library. This enables
+Since version 5.8 Perl uses the PerlIO I/O library. This enables
you to use different encodings per IO channel. For example you may use
use Encode;
characters were printed), and
UTF-EBCDIC (in this example identical to normal EBCDIC since only characters
that don't differ between EBCDIC and UTF-EBCDIC were printed). See the
-documentation of Encode::PerlIO for details.
+documentation of L<Encode::PerlIO> for details.
As the PerlIO layer uses raw IO (bytes) internally, all this totally
ignores things like the type of your filesystem (ASCII or EBCDIC).
table names of the Latin 1
extensions to ASCII have been labelled with character names roughly
corresponding to I<The Unicode Standard, Version 6.1> albeit with
-substitutions such as s/LATIN// and s/VULGAR// in all cases, s/CAPITAL
-LETTER// in some cases, and s/SMALL LETTER ([A-Z])/\l$1/ in some other
+substitutions such as C<s/LATIN//> and C<s/VULGAR//> in all cases;
+S<C<s/CAPITAL LETTER//>> in some cases; and
+S<C<s/SMALL LETTER ([A-Z])/\l$1/>> in some other
cases. Controls are listed using their Unicode 6.2 abbreviations.
The differences between the 0037 and 1047 sets are
-flagged with **. The differences between the 1047 and POSIX-BC sets
-are flagged with ##. All ord() numbers listed are decimal. If you
+flagged with C<**>. The differences between the 1047 and POSIX-BC sets
+are flagged with C<##.> All C<ord()> numbers listed are decimal. If you
would rather see this table listing octal values, then run the table
(that is, the pod source text of this document, since this recipe may not
work with a pod2_other_format translation) through:
-e ' map{[$_,substr($_,39,3)]}@l;}' perlebcdic.pod
If you would rather see it in POSIX-BC order then change the number
-39 in the last line to 44, like this:
+34 in the last line to 44, like this:
=over 4
-e ' sort{$a->[1] <=> $b->[1]}' \
-e ' map{[$_,substr($_,44,3)]}@l;}' perlebcdic.pod
+=head2 Table in hex, sorted in 1047 order
-=head1 IDENTIFYING CHARACTER CODE SETS
+Since this document was first written, the convention has become more
+and more to use hexadecimal notation for code points. To do this with
+the recipes and to also sort is a multi-step process, so here, for
+convenience, is the table from above, re-sorted to be in Code Page 1047
+order, and using hex notation.
-To determine the character set you are running under from perl one
-could use the return value of ord() or chr() to test one or more
-character values. For example:
+ ISO
+ 8859-1 POS- CCSID
+ CCSID CCSID CCSID IX- 1047
+ chr 0819 0037 1047 BC UTF-8 UTF-EBCDIC
+ ---------------------------------------------------------------------
+ <NUL> 00 00 00 00 00 00
+ <SOH> 01 01 01 01 01 01
+ <STX> 02 02 02 02 02 02
+ <ETX> 03 03 03 03 03 03
+ <ST> 9C 04 04 04 C2.9C 04
+ <HT> 09 05 05 05 09 05
+ <SSA> 86 06 06 06 C2.86 06
+ <DEL> 7F 07 07 07 7F 07
+ <EPA> 97 08 08 08 C2.97 08
+ <RI> 8D 09 09 09 C2.8D 09
+ <SS2> 8E 0A 0A 0A C2.8E 0A
+ <VT> 0B 0B 0B 0B 0B 0B
+ <FF> 0C 0C 0C 0C 0C 0C
+ <CR> 0D 0D 0D 0D 0D 0D
+ <SO> 0E 0E 0E 0E 0E 0E
+ <SI> 0F 0F 0F 0F 0F 0F
+ <DLE> 10 10 10 10 10 10
+ <DC1> 11 11 11 11 11 11
+ <DC2> 12 12 12 12 12 12
+ <DC3> 13 13 13 13 13 13
+ <OSC> 9D 14 14 14 C2.9D 14
+ <LF> 0A 25 15 15 0A 15 **
+ <BS> 08 16 16 16 08 16
+ <ESA> 87 17 17 17 C2.87 17
+ <CAN> 18 18 18 18 18 18
+ <EOM> 19 19 19 19 19 19
+ <PU2> 92 1A 1A 1A C2.92 1A
+ <SS3> 8F 1B 1B 1B C2.8F 1B
+ <FS> 1C 1C 1C 1C 1C 1C
+ <GS> 1D 1D 1D 1D 1D 1D
+ <RS> 1E 1E 1E 1E 1E 1E
+ <US> 1F 1F 1F 1F 1F 1F
+ <PAD> 80 20 20 20 C2.80 20
+ <HOP> 81 21 21 21 C2.81 21
+ <BPH> 82 22 22 22 C2.82 22
+ <NBH> 83 23 23 23 C2.83 23
+ <IND> 84 24 24 24 C2.84 24
+ <NEL> 85 15 25 25 C2.85 25 **
+ <ETB> 17 26 26 26 17 26
+ <ESC> 1B 27 27 27 1B 27
+ <HTS> 88 28 28 28 C2.88 28
+ <HTJ> 89 29 29 29 C2.89 29
+ <VTS> 8A 2A 2A 2A C2.8A 2A
+ <PLD> 8B 2B 2B 2B C2.8B 2B
+ <PLU> 8C 2C 2C 2C C2.8C 2C
+ <ENQ> 05 2D 2D 2D 05 2D
+ <ACK> 06 2E 2E 2E 06 2E
+ <BEL> 07 2F 2F 2F 07 2F
+ <DCS> 90 30 30 30 C2.90 30
+ <PU1> 91 31 31 31 C2.91 31
+ <SYN> 16 32 32 32 16 32
+ <STS> 93 33 33 33 C2.93 33
+ <CCH> 94 34 34 34 C2.94 34
+ <MW> 95 35 35 35 C2.95 35
+ <SPA> 96 36 36 36 C2.96 36
+ <EOT> 04 37 37 37 04 37
+ <SOS> 98 38 38 38 C2.98 38
+ <SGC> 99 39 39 39 C2.99 39
+ <SCI> 9A 3A 3A 3A C2.9A 3A
+ <CSI> 9B 3B 3B 3B C2.9B 3B
+ <DC4> 14 3C 3C 3C 14 3C
+ <NAK> 15 3D 3D 3D 15 3D
+ <PM> 9E 3E 3E 3E C2.9E 3E
+ <SUB> 1A 3F 3F 3F 1A 3F
+ <SPACE> 20 40 40 40 20 40
+ <NON-BREAKING SPACE> A0 41 41 41 C2.A0 80.41
+ <a WITH CIRCUMFLEX> E2 42 42 42 C3.A2 8B.43
+ <a WITH DIAERESIS> E4 43 43 43 C3.A4 8B.45
+ <a WITH GRAVE> E0 44 44 44 C3.A0 8B.41
+ <a WITH ACUTE> E1 45 45 45 C3.A1 8B.42
+ <a WITH TILDE> E3 46 46 46 C3.A3 8B.44
+ <a WITH RING ABOVE> E5 47 47 47 C3.A5 8B.46
+ <c WITH CEDILLA> E7 48 48 48 C3.A7 8B.48
+ <n WITH TILDE> F1 49 49 49 C3.B1 8B.58
+ <CENT SIGN> A2 4A 4A B0 C2.A2 80.43 ##
+ . 2E 4B 4B 4B 2E 4B
+ < 3C 4C 4C 4C 3C 4C
+ ( 28 4D 4D 4D 28 4D
+ + 2B 4E 4E 4E 2B 4E
+ | 7C 4F 4F 4F 7C 4F
+ & 26 50 50 50 26 50
+ <e WITH ACUTE> E9 51 51 51 C3.A9 8B.4A
+ <e WITH CIRCUMFLEX> EA 52 52 52 C3.AA 8B.51
+ <e WITH DIAERESIS> EB 53 53 53 C3.AB 8B.52
+ <e WITH GRAVE> E8 54 54 54 C3.A8 8B.49
+ <i WITH ACUTE> ED 55 55 55 C3.AD 8B.54
+ <i WITH CIRCUMFLEX> EE 56 56 56 C3.AE 8B.55
+ <i WITH DIAERESIS> EF 57 57 57 C3.AF 8B.56
+ <i WITH GRAVE> EC 58 58 58 C3.AC 8B.53
+ <SMALL LETTER SHARP S> DF 59 59 59 C3.9F 8A.73
+ ! 21 5A 5A 5A 21 5A
+ $ 24 5B 5B 5B 24 5B
+ * 2A 5C 5C 5C 2A 5C
+ ) 29 5D 5D 5D 29 5D
+ ; 3B 5E 5E 5E 3B 5E
+ ^ 5E B0 5F 6A 5E 5F ** ##
+ - 2D 60 60 60 2D 60
+ / 2F 61 61 61 2F 61
+ <A WITH CIRCUMFLEX> C2 62 62 62 C3.82 8A.43
+ <A WITH DIAERESIS> C4 63 63 63 C3.84 8A.45
+ <A WITH GRAVE> C0 64 64 64 C3.80 8A.41
+ <A WITH ACUTE> C1 65 65 65 C3.81 8A.42
+ <A WITH TILDE> C3 66 66 66 C3.83 8A.44
+ <A WITH RING ABOVE> C5 67 67 67 C3.85 8A.46
+ <C WITH CEDILLA> C7 68 68 68 C3.87 8A.48
+ <N WITH TILDE> D1 69 69 69 C3.91 8A.58
+ <BROKEN BAR> A6 6A 6A D0 C2.A6 80.47 ##
+ , 2C 6B 6B 6B 2C 6B
+ % 25 6C 6C 6C 25 6C
+ _ 5F 6D 6D 6D 5F 6D
+ > 3E 6E 6E 6E 3E 6E
+ ? 3F 6F 6F 6F 3F 6F
+ <o WITH STROKE> F8 70 70 70 C3.B8 8B.67
+ <E WITH ACUTE> C9 71 71 71 C3.89 8A.4A
+ <E WITH CIRCUMFLEX> CA 72 72 72 C3.8A 8A.51
+ <E WITH DIAERESIS> CB 73 73 73 C3.8B 8A.52
+ <E WITH GRAVE> C8 74 74 74 C3.88 8A.49
+ <I WITH ACUTE> CD 75 75 75 C3.8D 8A.54
+ <I WITH CIRCUMFLEX> CE 76 76 76 C3.8E 8A.55
+ <I WITH DIAERESIS> CF 77 77 77 C3.8F 8A.56
+ <I WITH GRAVE> CC 78 78 78 C3.8C 8A.53
+ ` 60 79 79 4A 60 79 ##
+ : 3A 7A 7A 7A 3A 7A
+ # 23 7B 7B 7B 23 7B
+ @ 40 7C 7C 7C 40 7C
+ ' 27 7D 7D 7D 27 7D
+ = 3D 7E 7E 7E 3D 7E
+ " 22 7F 7F 7F 22 7F
+ <O WITH STROKE> D8 80 80 80 C3.98 8A.67
+ a 61 81 81 81 61 81
+ b 62 82 82 82 62 82
+ c 63 83 83 83 63 83
+ d 64 84 84 84 64 84
+ e 65 85 85 85 65 85
+ f 66 86 86 86 66 86
+ g 67 87 87 87 67 87
+ h 68 88 88 88 68 88
+ i 69 89 89 89 69 89
+ <LEFT POINTING GUILLEMET> AB 8A 8A 8A C2.AB 80.52
+ <RIGHT POINTING GUILLEMET> BB 8B 8B 8B C2.BB 80.6A
+ <SMALL LETTER eth> F0 8C 8C 8C C3.B0 8B.57
+ <y WITH ACUTE> FD 8D 8D 8D C3.BD 8B.71
+ <SMALL LETTER thorn> FE 8E 8E 8E C3.BE 8B.72
+ <PLUS-OR-MINUS SIGN> B1 8F 8F 8F C2.B1 80.58
+ <DEGREE SIGN> B0 90 90 90 C2.B0 80.57
+ j 6A 91 91 91 6A 91
+ k 6B 92 92 92 6B 92
+ l 6C 93 93 93 6C 93
+ m 6D 94 94 94 6D 94
+ n 6E 95 95 95 6E 95
+ o 6F 96 96 96 6F 96
+ p 70 97 97 97 70 97
+ q 71 98 98 98 71 98
+ r 72 99 99 99 72 99
+ <FEMININE ORDINAL> AA 9A 9A 9A C2.AA 80.51
+ <MASC. ORDINAL INDICATOR> BA 9B 9B 9B C2.BA 80.69
+ <SMALL LIGATURE ae> E6 9C 9C 9C C3.A6 8B.47
+ <CEDILLA> B8 9D 9D 9D C2.B8 80.67
+ <CAPITAL LIGATURE AE> C6 9E 9E 9E C3.86 8A.47
+ <CURRENCY SIGN> A4 9F 9F 9F C2.A4 80.45
+ <MICRO SIGN> B5 A0 A0 A0 C2.B5 80.64
+ ~ 7E A1 A1 FF 7E A1 ##
+ s 73 A2 A2 A2 73 A2
+ t 74 A3 A3 A3 74 A3
+ u 75 A4 A4 A4 75 A4
+ v 76 A5 A5 A5 76 A5
+ w 77 A6 A6 A6 77 A6
+ x 78 A7 A7 A7 78 A7
+ y 79 A8 A8 A8 79 A8
+ z 7A A9 A9 A9 7A A9
+ <INVERTED "!" > A1 AA AA AA C2.A1 80.42
+ <INVERTED QUESTION MARK> BF AB AB AB C2.BF 80.73
+ <CAPITAL LETTER ETH> D0 AC AC AC C3.90 8A.57
+ [ 5B BA AD BB 5B AD ** ##
+ <CAPITAL LETTER THORN> DE AE AE AE C3.9E 8A.72
+ <REGISTERED TRADE MARK> AE AF AF AF C2.AE 80.55
+ <NOT SIGN> AC 5F B0 BA C2.AC 80.53 ** ##
+ <POUND SIGN> A3 B1 B1 B1 C2.A3 80.44
+ <YEN SIGN> A5 B2 B2 B2 C2.A5 80.46
+ <MIDDLE DOT> B7 B3 B3 B3 C2.B7 80.66
+ <COPYRIGHT SIGN> A9 B4 B4 B4 C2.A9 80.4A
+ <SECTION SIGN> A7 B5 B5 B5 C2.A7 80.48
+ <PARAGRAPH SIGN> B6 B6 B6 B6 C2.B6 80.65
+ <FRACTION ONE QUARTER> BC B7 B7 B7 C2.BC 80.70
+ <FRACTION ONE HALF> BD B8 B8 B8 C2.BD 80.71
+ <FRACTION THREE QUARTERS> BE B9 B9 B9 C2.BE 80.72
+ <Y WITH ACUTE> DD AD BA AD C3.9D 8A.71 ** ##
+ <DIAERESIS> A8 BD BB 79 C2.A8 80.49 ** ##
+ <MACRON> AF BC BC A1 C2.AF 80.56 ##
+ ] 5D BB BD BD 5D BD **
+ <ACUTE ACCENT> B4 BE BE BE C2.B4 80.63
+ <MULTIPLICATION SIGN> D7 BF BF BF C3.97 8A.66
+ { 7B C0 C0 FB 7B C0 ##
+ A 41 C1 C1 C1 41 C1
+ B 42 C2 C2 C2 42 C2
+ C 43 C3 C3 C3 43 C3
+ D 44 C4 C4 C4 44 C4
+ E 45 C5 C5 C5 45 C5
+ F 46 C6 C6 C6 46 C6
+ G 47 C7 C7 C7 47 C7
+ H 48 C8 C8 C8 48 C8
+ I 49 C9 C9 C9 49 C9
+ <SOFT HYPHEN> AD CA CA CA C2.AD 80.54
+ <o WITH CIRCUMFLEX> F4 CB CB CB C3.B4 8B.63
+ <o WITH DIAERESIS> F6 CC CC CC C3.B6 8B.65
+ <o WITH GRAVE> F2 CD CD CD C3.B2 8B.59
+ <o WITH ACUTE> F3 CE CE CE C3.B3 8B.62
+ <o WITH TILDE> F5 CF CF CF C3.B5 8B.64
+ } 7D D0 D0 FD 7D D0 ##
+ J 4A D1 D1 D1 4A D1
+ K 4B D2 D2 D2 4B D2
+ L 4C D3 D3 D3 4C D3
+ M 4D D4 D4 D4 4D D4
+ N 4E D5 D5 D5 4E D5
+ O 4F D6 D6 D6 4F D6
+ P 50 D7 D7 D7 50 D7
+ Q 51 D8 D8 D8 51 D8
+ R 52 D9 D9 D9 52 D9
+ <SUPERSCRIPT ONE> B9 DA DA DA C2.B9 80.68
+ <u WITH CIRCUMFLEX> FB DB DB DB C3.BB 8B.6A
+ <u WITH DIAERESIS> FC DC DC DC C3.BC 8B.70
+ <u WITH GRAVE> F9 DD DD C0 C3.B9 8B.68 ##
+ <u WITH ACUTE> FA DE DE DE C3.BA 8B.69
+ <y WITH DIAERESIS> FF DF DF DF C3.BF 8B.73
+ \ 5C E0 E0 BC 5C E0 ##
+ <DIVISION SIGN> F7 E1 E1 E1 C3.B7 8B.66
+ S 53 E2 E2 E2 53 E2
+ T 54 E3 E3 E3 54 E3
+ U 55 E4 E4 E4 55 E4
+ V 56 E5 E5 E5 56 E5
+ W 57 E6 E6 E6 57 E6
+ X 58 E7 E7 E7 58 E7
+ Y 59 E8 E8 E8 59 E8
+ Z 5A E9 E9 E9 5A E9
+ <SUPERSCRIPT TWO> B2 EA EA EA C2.B2 80.59
+ <O WITH CIRCUMFLEX> D4 EB EB EB C3.94 8A.63
+ <O WITH DIAERESIS> D6 EC EC EC C3.96 8A.65
+ <O WITH GRAVE> D2 ED ED ED C3.92 8A.59
+ <O WITH ACUTE> D3 EE EE EE C3.93 8A.62
+ <O WITH TILDE> D5 EF EF EF C3.95 8A.64
+ 0 30 F0 F0 F0 30 F0
+ 1 31 F1 F1 F1 31 F1
+ 2 32 F2 F2 F2 32 F2
+ 3 33 F3 F3 F3 33 F3
+ 4 34 F4 F4 F4 34 F4
+ 5 35 F5 F5 F5 35 F5
+ 6 36 F6 F6 F6 36 F6
+ 7 37 F7 F7 F7 37 F7
+ 8 38 F8 F8 F8 38 F8
+ 9 39 F9 F9 F9 39 F9
+ <SUPERSCRIPT THREE> B3 FA FA FA C2.B3 80.62
+ <U WITH CIRCUMFLEX> DB FB FB DD C3.9B 8A.6A ##
+ <U WITH DIAERESIS> DC FC FC FC C3.9C 8A.70
+ <U WITH GRAVE> D9 FD FD E0 C3.99 8A.68 ##
+ <U WITH ACUTE> DA FE FE FE C3.9A 8A.69
+ <APC> 9F FF FF 5F C2.9F FF ##
- $is_ascii = "A" eq chr(65);
- $is_ebcdic = "A" eq chr(193);
+=head1 IDENTIFYING CHARACTER CODE SETS
-Also, "\t" is a C<HORIZONTAL TABULATION> character so that:
+It is possible to determine which character set you are operating under.
+But first you need to be really really sure you need to do this. Your
+code will be simpler and probably just as portable if you don't have
+to test the character set and do different things, depending. There are
+actually only very few circumstances where it's not easy to write
+straight-line code portable to all character sets. See
+L<perluniintro/Unicode and EBCDIC> for how to portably specify
+characters.
- $is_ascii = ord("\t") == 9;
- $is_ebcdic = ord("\t") == 5;
+But there are some cases where you may want to know which character set
+you are running under. One possible example is doing
+L<sorting|/SORTING> in inner loops where performance is critical.
-To distinguish between EBCDIC code pages try looking at one or more of
-the characters that differ between them. For example:
+To determine if you are running under ASCII or EBCDIC, you can use the
+return value of C<ord()> or C<chr()> to test one or more character
+values. For example:
- $is_ebcdic_37 = "\n" eq chr(37);
- $is_ebcdic_1047 = "\n" eq chr(21);
+ $is_ascii = "A" eq chr(65);
+ $is_ebcdic = "A" eq chr(193);
+ $is_ascii = ord("A") == 65;
+ $is_ebcdic = ord("A") == 193;
-Or better still choose a character that is uniquely encoded in any
-of the code sets, e.g.:
+There's even less need to distinguish between EBCDIC code pages, but to
+do so try looking at one or more of the characters that differ between
+them.
$is_ascii = ord('[') == 91;
$is_ebcdic_37 = ord('[') == 186;
$is_ascii = "\r" ne chr(13); # WRONG
$is_ascii = "\n" ne chr(10); # ILL ADVISED
-Obviously the first of these will fail to distinguish most ASCII platforms
-from either a CCSID 0037, a 1047, or a POSIX-BC EBCDIC platform since "\r" eq
-chr(13) under all of those coded character sets. But note too that
-because "\n" is chr(13) and "\r" is chr(10) on the Macintosh (which is an
-ASCII platform) the second C<$is_ascii> test will lead to trouble there.
+Obviously the first of these will fail to distinguish most ASCII
+platforms from either a CCSID 0037, a 1047, or a POSIX-BC EBCDIC
+platform since S<C<"\r" eq chr(13)>> under all of those coded character
+sets. But note too that because C<"\n"> is C<chr(13)> and C<"\r"> is
+C<chr(10)> on old Macintosh (which is an ASCII platform) the second
+C<$is_ascii> test will lead to trouble there.
To determine whether or not perl was built under an EBCDIC
code page you can use the Config module like so:
These functions take an input numeric code point in one encoding and
return what its equivalent value is in the other.
+See L<utf8>.
+
=head2 tr///
In order to convert a string of characters from one character set to
another a simple list of numbers, such as in the right columns in the
-above table, along with perl's tr/// operator is all that is needed.
+above table, along with Perl's C<tr///> operator is all that is needed.
The data in the table are in ASCII/Latin1 order, hence the EBCDIC columns
provide easy-to-use ASCII/Latin1 to EBCDIC operations that are also easily
reversed.
For example, to convert ASCII/Latin1 to code page 037 take the output of the
-second numbers column from the output of recipe 2 (modified to add '\'
-characters), and use it in tr/// like so:
+second numbers column from the output of recipe 2 (modified to add
+C<"\"> characters), and use it in C<tr///> like so:
$cp_037 =
'\x00\x01\x02\x03\x37\x2D\x2E\x2F\x16\x05\x25\x0B\x0C\x0D\x0E\x0F' .
available from the shell or from the C library. Consult your system's
documentation for information on iconv.
-On OS/390 or z/OS see the iconv(1) manpage. One way to invoke the iconv
+On OS/390 or z/OS see the L<iconv(1)> manpage. One way to invoke the C<iconv>
shell utility from within perl would be to:
# OS/390 or z/OS example
# OS/390 or z/OS example
$ebcdic_data = `echo '$ascii_data'| iconv -f ISO8859-1 -t IBM-1047`
-For other perl-based conversion options see the Convert::* modules on CPAN.
+For other Perl-based conversion options see the C<Convert::*> modules on CPAN.
=head2 C RTL
-The OS/390 and z/OS C run-time libraries provide _atoe() and _etoa() functions.
+The OS/390 and z/OS C run-time libraries provide C<_atoe()> and C<_etoa()> functions.
=head1 OPERATOR DIFFERENCES
@alphabet = ('A'..'Z'); # $#alphabet == 25
The bitwise operators such as & ^ | may return different results
-when operating on string or character data in a perl program running
+when operating on string or character data in a Perl program running
on an EBCDIC platform than when run on an ASCII platform. Here is
an example adapted from the one in L<perlop>:
An interesting property of the 32 C0 control characters
in the ASCII table is that they can "literally" be constructed
-as control characters in perl, e.g. C<(chr(0)> eq C<\c@>)>
+as control characters in Perl, e.g. C<(chr(0)> eq C<\c@>)>
C<(chr(1)> eq C<\cA>)>, and so on. Perl on EBCDIC platforms has been
-ported to take C<\c@> to chr(0) and C<\cA> to chr(1), etc. as well, but the
+ported to take C<\c@> to C<chr(0)> and C<\cA> to C<chr(1)>, etc. as well, but the
characters that result depend on which code page you are
using. The table below uses the standard acronyms for the controls.
The POSIX-BC and 1047 sets are
identical throughout this range and differ from the 0037 set at only
-one spot (21 decimal). Note that the C<LINE FEED> character
+one spot (21 decimal). Note that the line terminator character
may be generated by C<\cJ> on ASCII platforms but by C<\cU> on 1047 or POSIX-BC
platforms and cannot be generated as a C<"\c.letter."> control character on
0037 platforms. Note also that C<\c\> cannot be the final element in a string
C<*> Note: C<\c?> maps to ordinal 127 (C<DEL>) on ASCII platforms, but
since ordinal 127 is a not a control character on EBCDIC machines,
-C<\c?> instead maps to C<APC>, which is 255 in 0037 and 1047, and 95 in
-POSIX-BC.
+C<\c?> instead maps on them to C<APC>, which is 255 in 0037 and 1047,
+and 95 in POSIX-BC.
=head1 FUNCTION DIFFERENCES
=over 8
-=item chr()
+=item C<chr()>
-chr() must be given an EBCDIC code number argument to yield a desired
+C<chr()> must be given an EBCDIC code number argument to yield a desired
character return value on an EBCDIC platform. For example:
$CAPITAL_LETTER_A = chr(193);
-=item ord()
+The largest code point that is representable in UTF-EBCDIC is
+U+7FFF_FFFF. If you do C<chr()> on a larger value, a runtime error
+(similar to division by 0) will happen.
+
+=item C<ord()>
-ord() will return EBCDIC code number values on an EBCDIC platform.
+C<ord()> will return EBCDIC code number values on an EBCDIC platform.
For example:
$the_number_193 = ord("A");
-=item pack()
+=item C<pack()>
-The c and C templates for pack() are dependent upon character set
+
+The C<"c"> and C<"C"> templates for C<pack()> are dependent upon character set
encoding. Examples of usage on EBCDIC include:
$foo = pack("CCCC",193,194,195,196);
$foo = pack("ccxxcc",193,194,195,196);
# $foo eq "AB\0\0CD"
-=item print()
+The C<"U"> template has been ported to mean "Unicode" on all platforms so
+that
+
+ pack("U", 65) eq 'A'
+
+is true on all platforms. If you want native code points for the low
+256, use the C<"W"> template. This means that the equivalences
+
+ pack("W", ord($character)) eq $character
+ unpack("W", $character) == ord $character
+
+will hold.
+
+The largest code point that is representable in UTF-EBCDIC is
+U+7FFF_FFFF. If you try to pack a larger value into a character, a
+runtime error (similar to division by 0) will happen.
+
+=item C<print()>
One must be careful with scalars and strings that are passed to
print that contain ASCII encodings. One common place
for this to occur is in the output of the MIME type header for
-CGI script writing. For example, many perl programming guides
+CGI script writing. For example, many Perl programming guides
recommend something similar to:
print "Content-type:\ttext/html\015\012\015\012";
# this may be wrong on EBCDIC
-Under the IBM OS/390 USS Web Server or WebSphere on z/OS for example
-you should instead write that as:
+You can instead write
print "Content-type:\ttext/html\r\n\r\n"; # OK for DGW et al
+and have it work portably.
+
That is because the translation from EBCDIC to ASCII is done
-by the web server in this case (such code will not be appropriate for
-the Macintosh however). Consult your web server's documentation for
+by the web server in this case. Consult your web server's documentation for
further details.
-=item printf()
+=item C<printf()>
The formats that can convert characters to numbers and vice versa
will be different from their ASCII counterparts when executed
printf("%c%c%c",193,194,195); # prints ABC
-=item sort()
+=item C<sort()>
EBCDIC sort results may differ from ASCII sort results especially for
-mixed case strings. This is discussed in more detail below.
+mixed case strings. This is discussed in more detail L<below|/SORTING>.
-=item sprintf()
+=item C<sprintf()>
-See the discussion of printf() above. An example of the use
+See the discussion of C<L</printf()>> above. An example of the use
of sprintf would be:
$CAPITAL_LETTER_A = sprintf("%c",193);
-=item unpack()
+=item C<unpack()>
-See the discussion of pack() above.
+See the discussion of C<L</pack()>> above.
=back
+Note that it is possible to write portable code for these by specifying
+things in Unicode numbers, and using a conversion function:
+
+ printf("%c",utf8::unicode_to_native(65)); # prints A on all
+ # platforms
+ print utf8::native_to_unicode(ord("A")); # Likewise, prints 65
+
+See L<perluniintro/Unicode and EBCDIC> and L</CONVERSIONS>
+for other options.
+
=head1 REGULAR EXPRESSION DIFFERENCES
-As of perl 5.005_03 the letter range regular expressions such as
-[A-Z] and [a-z] have been especially coded to not pick up gap
-characters. For example, characters such as E<ocirc> C<o WITH CIRCUMFLEX>
-that lie between I and J would not be matched by the
-regular expression range C</[H-K]/>. This works in
-the other direction, too, if either of the range end points is
-explicitly numeric: C<[\x89-\x91]> will match C<\x8e>, even
-though C<\x89> is C<i> and C<\x91 > is C<j>, and C<\x8e>
-is a gap character from the alphabetic viewpoint.
-
-If you do want to match the alphabet gap characters in a single octet
-regular expression try matching the hex or octal code such
-as C</\313/> on EBCDIC or C</\364/> on ASCII platforms to
-have your regular expression match C<o WITH CIRCUMFLEX>.
-
-Another construct to be wary of is the inappropriate use of hex or
+You can write your regular expressions just like someone on an ASCII
+platform would do. But keep in mind that using octal or hex notation to
+specify a particular code point will give you the character that the
+EBCDIC code page natively maps to it. (This is also true of all
+double-quoted strings.) If you want to write portably, just use the
+C<\N{U+...}> notation everywhere where you would have used C<\x{...}>,
+and don't use octal notation at all.
+
+Starting in Perl v5.22, this applies to ranges in bracketed character
+classes. If you say, for example, C<qr/[\N{U+20}-\N{U+7F}]/>, it means
+the characters C<\N{U+20}>, C<\N{U+21}>, ..., C<\N{U+7F}>. This range
+is all the printable characters that the ASCII character set contains.
+
+Prior to v5.22, you couldn't specify any ranges portably, except
+(starting in Perl v5.5.3) all subsets of the C<[A-Z]> and C<[a-z]>
+ranges are specially coded to not pick up gap characters. For example,
+characters such as "E<ocirc>" (C<o WITH CIRCUMFLEX>) that lie between
+"I" and "J" would not be matched by the regular expression range
+C</[H-K]/>. But if either of the range end points is explicitly numeric
+(and neither is specified by C<\N{U+...}>), the gap characters are
+matched:
+
+ /[\x89-\x91]/
+
+will match C<\x8e>, even though C<\x89> is "i" and C<\x91 > is "j",
+and C<\x8e> is a gap character, from the alphabetic viewpoint.
+
+Another construct to be wary of is the inappropriate use of hex (unless
+you use C<\N{U+...}>) or
octal constants in regular expressions. Consider the following
set of subs:
$char =~ /[\240-\377]/;
}
-These are valid only on ASCII platforms, but can be easily rewritten to
-work on any platform as follows:
+These are valid only on ASCII platforms. Starting in Perl v5.22, simply
+changing the octal constants to equivalent C<\N{U+...}> values makes
+them portable:
+
+ sub is_c0 {
+ my $char = substr(shift,0,1);
+ $char =~ /[\N{U+00}-\N{U+1F}]/;
+ }
+
+ sub is_print_ascii {
+ my $char = substr(shift,0,1);
+ $char =~ /[\N{U+20}-\N{U+7E}]/;
+ }
+
+ sub is_delete {
+ my $char = substr(shift,0,1);
+ $char eq "\N{U+7F}";
+ }
+
+ sub is_c1 {
+ my $char = substr(shift,0,1);
+ $char =~ /[\N{U+80}-\N{U+9F}]/;
+ }
+
+ sub is_latin_1 { # But not ASCII; not C1
+ my $char = substr(shift,0,1);
+ $char =~ /[\N{U+A0}-\N{U+FF}]/;
+ }
+
+And here are some alternative portable ways to write them:
sub Is_c0 {
my $char = substr(shift,0,1);
use feature 'unicode_strings';
my $char = substr(shift,0,1);
return ord($char) < 256
- && $char !~ [[:ascii:]]
- && $char !~ [[:cntrl:]];
+ && $char !~ /[[:ascii:]]/
+ && $char !~ /[[:cntrl:]]/;
}
Another way to write C<Is_latin_1()> would be
}
Although that form may run into trouble in network transit (due to the
-presence of 8 bit characters) or on non ISO-Latin character sets.
+presence of 8 bit characters) or on non ISO-Latin character sets. But
+it does allow C<Is_c1> to be rewritten so it works on Perls that don't
+have C<'unicode_strings'> (earlier than v5.14):
+
+ sub Is_latin_1 { # But not ASCII; not C1
+ my $char = substr(shift,0,1);
+ return ord($char) < 256
+ && $char !~ /[[:ascii:]]/
+ && ! Is_latin1($char);
+ }
=head1 SOCKETS
=head1 SORTING
One big difference between ASCII-based character sets and EBCDIC ones
-are the relative positions of upper and lower case letters and the
-letters compared to the digits. If sorted on an ASCII-based platform the
+are the relative positions of the characters when sorted in native
+order. Of most concern are the upper- and lowercase letters, the
+digits, and the underscore (C<"_">). On ASCII platforms the native sort
+order has the digits come before the uppercase letters which come before
+the underscore which comes before the lowercase letters. On EBCDIC, the
+underscore comes first, then the lowercase letters, then the uppercase
+ones, and the digits last. If sorted on an ASCII-based platform, the
two-letter abbreviation for a physician comes before the two letter
abbreviation for drive; that is:
The property of lowercase before uppercase letters in EBCDIC is
even carried to the Latin 1 EBCDIC pages such as 0037 and 1047.
-An example would be that E<Euml> C<E WITH DIAERESIS> (203) comes
-before E<euml> C<e WITH DIAERESIS> (235) on an ASCII platform, but
+An example would be that "E<Euml>" (C<E WITH DIAERESIS>, 203) comes
+before "E<euml>" (C<e WITH DIAERESIS>, 235) on an ASCII platform, but
the latter (83) comes before the former (115) on an EBCDIC platform.
-(Astute readers will note that the uppercase version of E<szlig>
-C<SMALL LETTER SHARP S> is simply "SS" and that the upper case version of
-E<yuml> C<y WITH DIAERESIS> is not in the 0..255 range but it is
-at U+x0178 in Unicode, or C<"\x{178}"> in a Unicode enabled Perl).
+(Astute readers will note that the uppercase version of "E<szlig>"
+C<SMALL LETTER SHARP S> is simply "SS" and that the upper case versions
+of "E<yuml>" (small C<y WITH DIAERESIS>) and "E<micro>" (C<MICRO SIGN>)
+are not in the 0..255 range but are in Unicode, in a Unicode enabled
+Perl).
The sort order will cause differences between results obtained on
ASCII platforms versus EBCDIC platforms. What follows are some suggestions
This is the least computationally expensive strategy. It may require
some user education.
-=head2 MONO CASE then sort data.
+=head2 Use a sort helper function
-In order to minimize the expense of mono casing mixed-case text, try to
-C<tr///> towards the character set case most employed within the data.
-If the data are primarily UPPERCASE non Latin 1 then apply tr/[a-z]/[A-Z]/
-then sort(). If the data are primarily lowercase non Latin 1 then
-apply tr/[A-Z]/[a-z]/ before sorting. If the data are primarily UPPERCASE
-and include Latin-1 characters then apply:
+This is completely general, but the most computationally expensive
+strategy. Choose one or the other character set and transform to that
+for every sort comparision. Here's a complete example that transforms
+to ASCII sort order:
- tr/[a-z]/[A-Z]/;
- tr/[àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ]/[ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ/;
- s/ß/SS/g;
+ sub native_to_uni($) {
+ my $string = shift;
-then sort(). Do note however that such Latin-1 manipulation does not
-address the E<yuml> C<y WITH DIAERESIS> character that will remain at
-code point 255 on ASCII platforms, but 223 on most EBCDIC platforms
-where it will sort to a place less than the EBCDIC numerals. With a
-Unicode-enabled Perl you might try:
+ # Saves time on an ASCII platform
+ return $string if ord 'A' == 65;
- tr/^?/\x{178}/;
+ my $output = "";
+ for my $i (0 .. length($string) - 1) {
+ $output
+ .= chr(utf8::native_to_unicode(ord(substr($string, $i, 1))));
+ }
+
+ # Preserve utf8ness of input onto the output, even if it didn't need
+ # to be utf8
+ utf8::upgrade($output) if utf8::is_utf8($string);
-The strategy of mono casing data before sorting does not preserve the case
-of the data and may not be acceptable for that reason.
+ return $output;
+ }
-=head2 Convert, sort data, then re convert.
+ sub ascii_order { # Sort helper
+ return native_to_uni($a) cmp native_to_uni($b);
+ }
-This is the most expensive proposition that does not employ a network
-connection.
+ sort ascii_order @list;
+
+=head2 MONO CASE then sort data (for non-digits, non-underscore)
+
+If you don't care about where digits and underscore sort to, you can do
+something like this
+
+ sub case_insensitive_order { # Sort helper
+ return lc($a) cmp lc($b)
+ }
+
+ sort case_insensitive_order @list;
+
+If performance is an issue, and you don't care if the output is in the
+same case as the input, Use C<tr///> to transform to the case most
+employed within the data. If the data are primarily UPPERCASE
+non-Latin1, then apply C<tr/[a-z]/[A-Z]/>, and then C<sort()>. If the
+data are primarily lowercase non Latin1 then apply C<tr/[A-Z]/[a-z]/>
+before sorting. If the data are primarily UPPERCASE and include Latin-1
+characters then apply:
+
+ tr/[a-z]/[A-Z]/;
+ tr/[àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ]/[ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ/;
+ s/ß/SS/g;
+
+then C<sort()>. If you have a choice, it's better to lowercase things
+to avoid the problems of the two Latin-1 characters whose uppercase is
+outside Latin-1: "E<yuml>" (small C<y WITH DIAERESIS>) and "E<micro>"
+(C<MICRO SIGN>). If you do need to upppercase, you can; with a
+Unicode-enabled Perl, do:
+
+ tr/ÿ/\x{178}/;
+ tr/µ/\x{39C}/;
=head2 Perform sorting on one type of platform only.
http://www.pvhp.com/%7epvhp/
-where 7E is the hexadecimal ASCII code point for '~'. Here is an example
+where 7E is the hexadecimal ASCII code point for "~". Here is an example
of decoding such a URL in any EBCDIC code page:
$url = 'http://www.pvhp.com/%7Epvhp/';
=head2 uu encoding and decoding
-The C<u> template to pack() or unpack() will render EBCDIC data in EBCDIC
-characters equivalent to their ASCII counterparts. For example, the
-following will print "Yes indeed\n" on either an ASCII or EBCDIC computer:
+The C<u> template to C<pack()> or C<unpack()> will render EBCDIC data in
+EBCDIC characters equivalent to their ASCII counterparts. For example,
+the following will print "Yes indeed\n" on either an ASCII or EBCDIC
+computer:
$all_byte_chrs = '';
for (0..255) { $all_byte_chrs .= chr($_); }
the printable set using:
# This QP encoder works on ASCII only
- $qp_string =~ s/([=\x00-\x1F\x80-\xFF])/sprintf("=%02X",ord($1))/ge;
+ $qp_string =~ s/([=\x00-\x1F\x80-\xFF])/
+ sprintf("=%02X",ord($1))/xge;
-Whereas a QP encoder that works on both ASCII and EBCDIC platforms
-would look somewhat like the following:
+Starting in Perl v5.22, this is trivially changeable to work portably on
+both ASCII and EBCDIC platforms.
+
+ # This QP encoder works on both ASCII and EBCDIC
+ $qp_string =~ s/([=\N{U+00}-\N{U+1F}\N{U+80}-\N{U+FF}])/
+ sprintf("=%02X",ord($1))/xge;
+
+For earlier Perls, a QP encoder that works on both ASCII and EBCDIC
+platforms would look somewhat like the following:
$delete = utf8::unicode_to_native(ord("\x7F"));
$qp_string =~
(although in production code the substitutions might be done
in the EBCDIC branch with the function call and separately in the
-ASCII branch without the expense of the identity map).
+ASCII branch without the expense of the identity map; in Perl v5.22, the
+identity map is optimized out so there is no expense, but the
+alternative above is simpler and is also available in v5.22).
Such QP strings can be decoded with:
=head1 Hashing order and checksums
-To the extent that it is possible to write code that depends on
-hashing order there may be differences between hashes as stored
-on an ASCII-based platform and hashes stored on an EBCDIC-based platform.
-XXX
+Perl deliberately randomizes hash order for security purposes on both
+ASCII and EBCDIC platforms.
+
+EBCDIC checksums will differ for the same file translated into ASCII
+and vice versa.
=head1 I18N AND L10N
Internationalization (I18N) and localization (L10N) are supported at least
in principle even on EBCDIC platforms. The details are system-dependent
-and discussed under the L<perlebcdic/OS ISSUES> section below.
+and discussed under the L<OS ISSUES> section below.
=head1 MULTI-OCTET CHARACTER SETS
-Perl may work with an internal UTF-EBCDIC encoding form for wide characters
-on EBCDIC platforms in a manner analogous to the way that it works with
-the UTF-8 internal encoding form on ASCII based platforms.
+Perl works with UTF-EBCDIC, a multi-byte encoding. In Perls earlier
+than v5.22, there may be various bugs in this regard.
Legacy multi byte EBCDIC code pages XXX.
=over 8
-=item chcp
+=item C<sigaction>
+
+C<SA_SIGINFO> can have segmentation faults.
+
+=item C<chcp>
B<chcp> is supported as a shell utility for displaying and changing
one's code page. See also L<chcp(1)>.
See also the OS390::Stdio module on CPAN.
-=item OS/390, z/OS iconv
+=item C<iconv>
B<iconv> is supported as both a shell utility and a C RTL routine.
-See also the iconv(1) and iconv(3) manual pages.
+See also the L<iconv(1)> and L<iconv(3)> manual pages.
=item locales
-On OS/390 or z/OS see L<locale> for information on locales. The L10N files
-are in F</usr/nls/locale>. $Config{d_setlocale} is 'define' on OS/390
-or z/OS.
+Locales are supported. There may be glitches when a locale is another
+EBCDIC code page which has some of the
+L<code-page variant characters|/The 13 variant characters> in other
+positions.
+
+There aren't currently any real UTF-8 locales, even though some locale
+names contain the string "UTF-8".
+
+See L<perllocale> for information on locales. The L10N files
+are in F</usr/nls/locale>. C<$Config{d_setlocale}> is C<'define'> on
+OS/390 or z/OS.
=back
=head1 BUGS
+=over 4
+
+=item *
+
Not all shells will allow multiple C<-e> string arguments to perl to
-be concatenated together properly as recipes 0, 2, 4, 5, and 6 might
+be concatenated together properly as recipes in this document
+0, 2, 4, 5, and 6 might
seem to imply.
+=item *
+
+There are some bugs in the C<pack>/C<unpack> C<"U0"> template
+
+=item *
+
+There are a significant number of test failures in the CPAN modules
+shipped with Perl v5.22. These are only in modules not primarily
+maintained by Perl 5 porters. Some of these are failures in the tests
+only: they don't realize that it is proper to get different results on
+EBCDIC platforms. And some of the failures are real bugs. If you
+compile and do a C<make test> on Perl, all tests on the C</cpan>
+directory are skipped.
+
+In particular, the extensions L<Unicode::Collate> and
+L<Unicode::Normalize> are not supported under EBCDIC; likewise for the
+(now deprecated) L<encoding> pragma.
+
+L<Encode> partially works.
+
+=back
+
=head1 SEE ALSO
L<perllocale>, L<perlfunc>, L<perlunicode>, L<utf8>.
Joe Smith. Trademarks, registered trademarks, service marks and
registered service marks used in this document are the property of
their respective owners.
+
+Now maintained by Perl5 Porters.
=for Pod::Functions optimize input data for repeated searches
-Takes extra time to study SCALAR (C<$_> if unspecified) in anticipation of
-doing many pattern matches on the string before it is next modified.
+May take extra time to study SCALAR (C<$_> if unspecified) in anticipation
+of doing many pattern matches on the string before it is next modified.
This may or may not save time, depending on the nature and number of
patterns you are searching and the distribution of character
frequencies in the string to be searched; you probably want to compare
run times with and without it to see which is faster. Those loops
that scan for many short constant strings (including the constant
parts of more complex patterns) will benefit most.
+
+Note that since Perl version 5.16 this function has been a no-op, but
+this might change in a future release.
+
(The way C<study> works is this: a linked list of every
character in the string to be searched is made, so we know, for
example, where all the C<'k'> characters are. From each search string,
value (UV), a double (NV), a string (PV), and another scalar (SV).
("PV" stands for "Pointer Value". You might think that it is misnamed
because it is described as pointing only to strings. However, it is
-possible to have it point to other things For example, it could point
+possible to have it point to other things. For example, it could point
to an array of UVs. But,
using it for non-strings requires care, as the underlying assumption of
much of the internals is that PVs are just for strings. Often, for
at C<SvPVX(sv) - SvIV(sv)> in memory and the PV pointer is pointing
into the middle of this allocated storage.
-This is best demonstrated by example:
+This is best demonstrated by example. Normally copy-on-write will prevent
+the substitution from operator from using this hack, but if you can craft a
+string for which copy-on-write is not possible, you can see it in play. In
+the current implementation, the final byte of a string buffer is used as a
+copy-on-write reference count. If the buffer is not big enough, then
+copy-on-write is skipped. First have a look at an empty string:
- % ./perl -Ilib -MDevel::Peek -le '$a="12345"; $a=~s/.//; Dump($a)'
- SV = PVIV(0x8128450) at 0x81340f0
+ % ./perl -Ilib -MDevel::Peek -le '$a=""; $a .= ""; Dump $a'
+ SV = PV(0x7ffb7c008a70) at 0x7ffb7c030390
+ REFCNT = 1
+ FLAGS = (POK,pPOK)
+ PV = 0x7ffb7bc05b50 ""\0
+ CUR = 0
+ LEN = 10
+
+Notice here the LEN is 10. (It may differ on your platform.) Extend the
+length of the string to one less than 10, and do a substitution:
+
+ % ./perl -Ilib -MDevel::Peek -le '$a=""; $a.="123456789"; $a=~s/.//; Dump($a)'
+ SV = PV(0x7ffa04008a70) at 0x7ffa04030390
REFCNT = 1
FLAGS = (POK,OOK,pPOK)
- IV = 1 (OFFSET)
- PV = 0x8135781 ( "1" . ) "2345"\0
- CUR = 4
- LEN = 5
+ OFFSET = 1
+ PV = 0x7ffa03c05b61 ( "\1" . ) "23456789"\0
+ CUR = 8
+ LEN = 9
-Here the number of bytes chopped off (1) is put into IV, and
-C<Devel::Peek::Dump> helpfully reminds us that this is an offset. The
+Here the number of bytes chopped off (1) is shown next as the OFFSET. The
portion of the string between the "real" and the "fake" beginnings is
shown in parentheses, and the values of C<SvCUR> and C<SvLEN> reflect
-the fake beginning, not the real one.
+the fake beginning, not the real one. (The first character of the string
+buffer happens to have changed to "\1" here, not "1", because the current
+implementation stores the offset count in the string buffer. This is
+subject to change.)
Something similar to the offset hack is performed on AVs to enable
efficient shifting and splicing off the beginning of the array; while
op is a C<LISTOP>, which has any number of children. In this case, the
first child is pointed to by C<op_first> and the last child by
C<op_last>. The children in between can be found by iteratively
-following the C<op_sibling> pointer from the first child to the last (but
+following the C<OpSIBLING> pointer from the first child to the last (but
see below).
There are also some other op types: a C<PMOP> holds a regular expression,
Finally, there is a C<LOGOP>, or logic op. Like a C<LISTOP>, this has one
or more children, but it doesn't have an C<op_last> field: so you have to
-follow C<op_first> and then the C<op_sibling> chain itself to find the
+follow C<op_first> and then the C<OpSIBLING> chain itself to find the
last child. Instead it has an C<op_other> field, which is comparable to
the C<op_next> field described below, and represents an alternate
execution path. Operators like C<and>, C<or> and C<?> are C<LOGOP>s. Note
Starting in version 5.21.2, perls built with the experimental
define C<-DPERL_OP_PARENT> add an extra boolean flag for each op,
-C<op_lastsib>. When set, this indicates that this is the last op in an
-C<op_sibling> chain. This frees up the C<op_sibling> field on the last
-sibling to point back to the parent op. The macro C<OpSIBLING(o)> wraps
-this special behaviour, and always returns NULL on the last sibling.
-With this build the C<op_parent(o)> function can be used to find the
-parent of any op. Thus for forward compatibility, you should always use
-the C<OpSIBLING(o)> macro rather than accessing C<op_sibling> directly.
+C<op_moresib>. When not set, this indicates that this is the last op in an
+C<OpSIBLING> chain. This frees up the C<op_sibling> field on the last
+sibling to point back to the parent op. Under this build, that field is
+also renamed C<op_sibparent> to reflect its joint role. The macro
+C<OpSIBLING(o)> wraps this special behaviour, and always returns NULL on
+the last sibling. With this build the C<op_parent(o)> function can be
+used to find the parent of any op. Thus for forward compatibility, you
+should always use the C<OpSIBLING(o)> macro rather than accessing
+C<op_sibling> directly.
Another way to examine the tree is to use a compiler back-end module, such
as L<B::Concise>.
=item *
-In function definitions, name starts in column 0 (return value is on
+In function definitions, name starts in column 0 (return value-type is on
previous line)
=item *
=item * F<t/base>, F<t/comp> and F<t/opbasic>
-Since we don't know if require works, or even subroutines, use ad hoc
+Since we don't know if C<require> works, or even subroutines, use ad hoc
tests for these three. Step carefully to avoid using the feature being
tested. Tests in F<t/opbasic>, for instance, have been placed there
rather than in F<t/op> because they test functionality which
code point. This function returns C<"\xC2\xA0"> on an ASCII platform, and
C<"\x80\x41"> on an EBCDIC 1047 one.
-But easiest is to use C<\N{}> to specify characters, if the side effects
-aren't troublesome. Simply specify all your characters in hex, using
-C<\N{U+ZZ}> instead of C<\xZZ>. C<\N{}> is the Unicode name, and so it
+But easiest is, if the character is specifiable as a literal, like
+C<"A"> or C<"%">, to use that; if not so specificable, you can use use
+C<\N{}> , if the side effects aren't troublesome. Simply specify all
+your characters in hex, using C<\N{U+ZZ}> instead of C<\xZZ>. C<\N{}>
+is the Unicode name, and so it
always gives you the Unicode character. C<\N{U+41}> is the character
whose Unicode code point is C<0x41>, hence is C<'A'> on all platforms.
The side effects are:
=back
+If you are testing locales (see L<perllocale>), there are helper
+functions in F<t/loc_tools.pl> to enable you to see what locales there
+are on the current platform.
+
=head2 Special C<make test> targets
There are various special make targets that can be used to test Perl
This document was originally written by Nathan Torkington, and is
maintained by the perl5-porters mailing list.
-
But in any case, try to keep the features and operating systems
separate.
+=item *
+
+Assuming the contents of static memory pointed to by the return values
+of Perl wrappers for C library functions doesn't change. Many C library
+functions return pointers to static storage that can be overwritten by
+subsequent calls to the same or related functions. Perl has
+light-weight wrappers for some of these functions, and which don't make
+copies of the static memory. A good example is the interface to the
+environment variables that are in effect for the program. Perl has
+C<PerlEnv_getenv> to get values from the environment. But the return is
+a pointer to static memory in the C library. If you are using the value
+to immediately test for something, that's fine, but if you save the
+value and expect it to be unchanged by later processing, you would be
+wrong, but perhaps you wouldn't know it because different C library
+implementations behave differently, and the one on the platform you're
+testing on might work for your situation. But on some platforms, a
+subsequent call to C<PerlEnv_getenv> or related function WILL overwrite
+the memory that your first call points to. This has led to some
+hard-to-debug problems. Do a L<perlapi/savepv> to make a copy, thus
+avoiding these problems. You will have to free the copy when you're
+done to avoid memory leaks. If you don't have control over when it gets
+freed, you'll need to make the copy in a mortal scalar, like so:
+
+ if ((s = PerlEnv_getenv("foo") == NULL) {
+ ... /* handle NULL case */
+ }
+ else {
+ s = SvPVX(sv_2mortal(newSVpv(s, 0)));
+ }
+
+The above example works only if C<"s"> is C<NUL>-terminated; otherwise
+you have to pass its length to C<newSVpv>.
+
=back
=head2 Problematic System Interfaces
(gdb) ptype PL_op
type = struct op {
OP *op_next;
- OP *op_sibling;
+ OP *op_sibparent;
OP *(*op_ppaddr)(void);
PADOFFSET op_targ;
unsigned int op_type : 9;
Matthew H 5.21.8 2015-Jan-20
Sawyer X 5.21.9 2015-Feb-20
Steve 5.21.10 2015-Mar-20
+ Steve 5.21.11 2015-Apr-20
=head2 SELECTED RELEASE SIZES
Unicode, encoded in UTF-8. Starting in v5.20, Perl fully supports
UTF-8 locales, except for sorting and string comparisons. (Use
L<Unicode::Collate> for these.) Perl continues to support the old
-non UTF-8 locales as well.
+non UTF-8 locales as well. There are currently no UTF-8 locales for
+EBCDIC platforms.
(Unicode is also creating C<CLDR>, the "Common Locale Data Repository",
L<http://cldr.unicode.org/> which includes more types of information than
using the C<locale> warning category, whenever such a locale is switched
into.) The UTF-8 locale support is actually a
superset of POSIX locales, because it is really full Unicode behavior
-as if no locale were in effect at all (except for tainting; see
-L</SECURITY>). POSIX locales, even UTF-8 ones,
+as if no C<LC_CTYPE> locale were in effect at all (except for tainting;
+see L</SECURITY>). POSIX locales, even UTF-8 ones,
are lacking certain concepts in Unicode, such as the idea that changing
the case of a character could expand to be more than one character.
Perl in a UTF-8 locale, will give you that expansion. Prior to v5.20,
Starting in v5.22, Perl will by default warn when switching into a
locale that redefines any ASCII printable character (plus C<\t> and
-C<\n>) into a different class than expected. This is unlikely to
-happen on modern locales, but can happen with the ISO 646 and other
+C<\n>) into a different class than expected. This is likely to
+happen on modern locales only on EBCDIC platforms, where, for example,
+a CCSID 0037 locale on a CCSID 1047 machine moves C<"[">, but it can
+happen on ASCII platforms with the ISO 646 and other
7-bit locales that are essentially obsolete. Things may still work,
depending on what features of Perl are used by the program. For
example, in the example from above where C<"|"> becomes a C<\w>, and
instead a "path" (":"-separated list) of I<languages> (not locales).
See the GNU C<gettext> library documentation for more information.
-=item C<LC_CTYPE>.
+=item C<LC_CTYPE>
In the absence of C<LC_ALL>, C<LC_CTYPE> chooses the character type
locale. In the absence of both C<LC_ALL> and C<LC_CTYPE>, C<LANG>
C<LANG> is the "catch-all" locale environment variable. If it is set, it
is used as the last resort after the overall C<LC_ALL> and the
-category-specific C<LC_I<foo>>
+category-specific C<LC_I<foo>>.
=back
=head1 DESCRIPTION
In Perl, the operator determines what operation is performed,
-independent of the type of the operands. For example C<$x + $y>
+independent of the type of the operands. For example S<C<$x + $y>>
is always a numeric addition, and if C<$x> or C<$y> do not contain
numbers, an attempt is made to convert them to numbers first.
This is in contrast to many other dynamic languages, where the
operation is determined by the type of the first argument. It also
means that Perl has two versions of some operators, one for numeric
-and one for string comparison. For example C<$x == $y> compares
-two numbers for equality, and C<$x eq $y> compares two strings.
+and one for string comparison. For example S<C<$x == $y>> compares
+two numbers for equality, and S<C<$x eq $y>> compares two strings.
There are a few exceptions though: C<x> can be either string
repetition or list repetition, depending on the type of the left
they do in mathematics.
I<Operator precedence> means some operators are evaluated before
-others. For example, in C<2 + 4 * 5>, the multiplication has higher
-precedence so C<4 * 5> is evaluated first yielding C<2 + 20 ==
-22> and not C<6 * 5 == 30>.
+others. For example, in S<C<2 + 4 * 5>>, the multiplication has higher
+precedence so S<C<4 * 5>> is evaluated first yielding S<C<2 + 20 ==
+22>> and not S<C<6 * 5 == 30>>.
I<Operator associativity> defines what happens if a sequence of the
same operators is used one after another: whether the evaluator will
-evaluate the left operations first or the right. For example, in C<8
-- 4 - 2>, subtraction is left associative so Perl evaluates the
-expression left to right. C<8 - 4> is evaluated first making the
-expression C<4 - 2 == 2> and not C<8 - 2 == 6>.
+evaluate the left operations first, or the right first. For example, in
+S<C<8 - 4 - 2>>, subtraction is left associative so Perl evaluates the
+expression left to right. S<C<8 - 4>> is evaluated first making the
+expression S<C<4 - 2 == 2>> and not S<C<8 - 2 == 6>>.
Perl operators have the following associativity and precedence,
listed from highest precedence to lowest. Operators borrowed from
operators behaving as functions because you put parentheses around
the arguments. These are all documented in L<perlfunc>.
-If any list operator (print(), etc.) or any unary operator (chdir(), etc.)
+If any list operator (C<print()>, etc.) or any unary operator (C<chdir()>, etc.)
is followed by a left parenthesis as the next token, the operator and
arguments within parentheses are taken to be of highest precedence,
just like a normal function call.
@ary = (1, 3, sort 4, 2);
print @ary; # prints 1324
-the commas on the right of the sort are evaluated before the sort,
+the commas on the right of the C<sort> are evaluated before the C<sort>,
but the commas on the left are evaluated after. In other words,
list operators tend to gobble up all arguments that follow, and
then act like a simple TERM with regard to the preceding expression.
probably doesn't do what you expect at first glance. The parentheses
enclose the argument list for C<print> which is evaluated (printing
-the result of C<$foo & 255>). Then one is added to the return value
+the result of S<C<$foo & 255>>). Then one is added to the return value
of C<print> (usually 1). The result is something like this:
1 + 1, "\n"; # Obviously not what you meant.
See L<Named Unary Operators> for more discussion of this.
-Also parsed as terms are the C<do {}> and C<eval {}> constructs, as
+Also parsed as terms are the S<C<do {}>> and S<C<eval {}>> constructs, as
well as subroutine and method calls, and the anonymous
constructors C<[]> and C<{}>.
=head2 Auto-increment and Auto-decrement
X<increment> X<auto-increment> X<++> X<decrement> X<auto-decrement> X<-->
-"++" and "--" work as in C. That is, if placed before a variable,
+C<"++"> and C<"--"> work as in C. That is, if placed before a variable,
they increment or decrement the variable by one before returning the
value, and if placed after, increment or decrement after returning the
value.
=head2 Exponentiation
X<**> X<exponentiation> X<power>
-Binary "**" is the exponentiation operator. It binds even more
-tightly than unary minus, so -2**4 is -(2**4), not (-2)**4. (This is
-implemented using C's pow(3) function, which actually works on doubles
+Binary C<"**"> is the exponentiation operator. It binds even more
+tightly than unary minus, so C<-2**4> is C<-(2**4)>, not C<(-2)**4>.
+(This is
+implemented using C's C<pow(3)> function, which actually works on doubles
internally.)
Note that certain exponentiation expressions are ill-defined:
=head2 Symbolic Unary Operators
X<unary operator> X<operator, unary>
-Unary "!" performs logical negation, that is, "not". See also C<not> for a lower
+Unary C<"!"> performs logical negation, that is, "not". See also C<not> for a lower
precedence version of this.
X<!>
-Unary "-" performs arithmetic negation if the operand is numeric,
+Unary C<"-"> performs arithmetic negation if the operand is numeric,
including any string that looks like a number. If the operand is
an identifier, a string consisting of a minus sign concatenated
with the identifier is returned. Otherwise, if the string starts
with a plus or minus, a string starting with the opposite sign is
-returned. One effect of these rules is that -bareword is equivalent
-to the string "-bareword". If, however, the string begins with a
-non-alphabetic character (excluding "+" or "-"), Perl will attempt to convert
-the string to a numeric and the arithmetic negation is performed. If the
+returned. One effect of these rules is that C<-bareword> is equivalent
+to the string C<"-bareword">. If, however, the string begins with a
+non-alphabetic character (excluding C<"+"> or C<"-">), Perl will attempt
+to convert
+the string to a numeric, and the arithmetic negation is performed. If the
string cannot be cleanly converted to a numeric, Perl will give the warning
B<Argument "the string" isn't numeric in negation (-) at ...>.
X<-> X<negation, arithmetic>
-Unary "~" performs bitwise negation, that is, 1's complement. For
-example, C<0666 & ~027> is 0640. (See also L<Integer Arithmetic> and
+Unary C<"~"> performs bitwise negation, that is, 1's complement. For
+example, S<C<0666 & ~027>> is 0640. (See also L<Integer Arithmetic> and
L<Bitwise String Operators>.) Note that the width of the result is
-platform-dependent: ~0 is 32 bits wide on a 32-bit platform, but 64
+platform-dependent: C<~0> is 32 bits wide on a 32-bit platform, but 64
bits wide on a 64-bit platform, so if you are expecting a certain bit
-width, remember to use the "&" operator to mask off the excess bits.
+width, remember to use the C<"&"> operator to mask off the excess bits.
X<~> X<negation, binary>
When complementing strings, if all characters have ordinal values under
architecture. So for example, C<~"\x{3B1}"> is C<"\x{FFFF_FC4E}"> on
32-bit machines and C<"\x{FFFF_FFFF_FFFF_FC4E}"> on 64-bit machines.
-If the experimental "bitwise" feature is enabled via C<use feature
-'bitwise'>, then unary "~" always treats its argument as a number, and an
-alternate form of the operator, "~.", always treats its argument as a
+If the experimental "bitwise" feature is enabled via S<C<use feature
+'bitwise'>>, then unary C<"~"> always treats its argument as a number, and an
+alternate form of the operator, C<"~.">, always treats its argument as a
string. So C<~0> and C<~"0"> will both give 2**32-1 on 32-bit platforms,
whereas C<~.0> and C<~."0"> will both yield C<"\xff">. This feature
-produces a warning unless you use C<no warnings 'experimental::bitwise'>.
+produces a warning unless you use S<C<no warnings 'experimental::bitwise'>>.
-Unary "+" has no effect whatsoever, even on strings. It is useful
+Unary C<"+"> has no effect whatsoever, even on strings. It is useful
syntactically for separating a function name from a parenthesized expression
that would otherwise be interpreted as the complete list of function
arguments. (See examples above under L<Terms and List Operators (Leftward)>.)
X<+>
-Unary "\" creates a reference to whatever follows it. See L<perlreftut>
+Unary C<"\"> creates a reference to whatever follows it. See L<perlreftut>
and L<perlref>. Do not confuse this behavior with the behavior of
backslash within a string, although both forms do convey the notion
of protecting the next thing from interpolation.
=head2 Binding Operators
X<binding> X<operator, binding> X<=~> X<!~>
-Binary "=~" binds a scalar expression to a pattern match. Certain operations
-search or modify the string $_ by default. This operator makes that kind
+Binary C<"=~"> binds a scalar expression to a pattern match. Certain operations
+search or modify the string C<$_> by default. This operator makes that kind
of operation work on some other string. The right argument is a search
pattern, substitution, or transliteration. The left argument is what is
supposed to be searched, substituted, or transliterated instead of the default
-$_. When used in scalar context, the return value generally indicates the
-success of the operation. The exceptions are substitution (s///)
-and transliteration (y///) with the C</r> (non-destructive) option,
+C<$_>. When used in scalar context, the return value generally indicates the
+success of the operation. The exceptions are substitution (C<s///>)
+and transliteration (C<y///>) with the C</r> (non-destructive) option,
which cause the B<r>eturn value to be the result of the substitution.
Behavior in list context depends on the particular operator.
See L</"Regexp Quote-Like Operators"> for details and L<perlretut> for
is not ok, as the regex engine will end up trying to compile the
pattern C<\>, which it will consider a syntax error.
-Binary "!~" is just like "=~" except the return value is negated in
+Binary C<"!~"> is just like C<"=~"> except the return value is negated in
the logical sense.
-Binary "!~" with a non-destructive substitution (s///r) or transliteration
-(y///r) is a syntax error.
+Binary C<"!~"> with a non-destructive substitution (C<s///r>) or transliteration
+(C<y///r>) is a syntax error.
=head2 Multiplicative Operators
X<operator, multiplicative>
-Binary "*" multiplies two numbers.
+Binary C<"*"> multiplies two numbers.
X<*>
-Binary "/" divides two numbers.
+Binary C<"/"> divides two numbers.
X</> X<slash>
-Binary "%" is the modulo operator, which computes the division
+Binary C<"%"> is the modulo operator, which computes the division
remainder of its first argument with respect to its second argument.
Given integer
-operands C<$m> and C<$n>: If C<$n> is positive, then C<$m % $n> is
+operands C<$m> and C<$n>: If C<$n> is positive, then S<C<$m % $n>> is
C<$m> minus the largest multiple of C<$n> less than or equal to
-C<$m>. If C<$n> is negative, then C<$m % $n> is C<$m> minus the
+C<$m>. If C<$n> is negative, then S<C<$m % $n>> is C<$m> minus the
smallest multiple of C<$n> that is not less than C<$m> (that is, the
result will be less than or equal to zero). If the operands
C<$m> and C<$n> are floating point values and the absolute value of
-C<$n> (that is C<abs($n)>) is less than C<(UV_MAX + 1)>, only
+C<$n> (that is C<abs($n)>) is less than S<C<(UV_MAX + 1)>>, only
the integer portion of C<$m> and C<$n> will be used in the operation
(Note: here C<UV_MAX> means the maximum of the unsigned integer type).
If the absolute value of the right operand (C<abs($n)>) is greater than
-or equal to C<(UV_MAX + 1)>, "%" computes the floating-point remainder
-C<$r> in the equation C<($r = $m - $i*$n)> where C<$i> is a certain
+or equal to S<C<(UV_MAX + 1)>>, C<"%"> computes the floating-point remainder
+C<$r> in the equation S<C<($r = $m - $i*$n)>> where C<$i> is a certain
integer that makes C<$r> have the same sign as the right operand
C<$n> (B<not> as the left operand C<$m> like C function C<fmod()>)
and the absolute value less than that of C<$n>.
-Note that when C<use integer> is in scope, "%" gives you direct access
+Note that when S<C<use integer>> is in scope, C<"%"> gives you direct access
to the modulo operator as implemented by your C compiler. This
operator is not as well defined for negative operands, but it will
execute faster.
X<%> X<remainder> X<modulo> X<mod>
-Binary "x" is the repetition operator. In scalar context or if the left
+Binary C<"x"> is the repetition operator. In scalar context or if the left
operand is not enclosed in parentheses, it returns a string consisting
of the left operand repeated the number of times specified by the right
operand. In list context, if the left operand is enclosed in
-parentheses or is a list formed by C<qw/STRING/>, it repeats the list.
+parentheses or is a list formed by C<qw/I<STRING>/>, it repeats the list.
If the right operand is zero or negative (raising a warning on
negative), it returns an empty string
or an empty list, depending on the context.
=head2 Additive Operators
X<operator, additive>
-Binary C<+> returns the sum of two numbers.
+Binary C<"+"> returns the sum of two numbers.
X<+>
-Binary C<-> returns the difference of two numbers.
+Binary C<"-"> returns the difference of two numbers.
X<->
-Binary C<.> concatenates two strings.
+Binary C<"."> concatenates two strings.
X<string, concatenation> X<concatenation>
X<cat> X<concat> X<concatenate> X<.>
X<<< >> >>> X<right shift> X<left shift> X<bitwise shift>
X<shl> X<shr> X<shift, right> X<shift, left>
-Binary C<<< << >>> returns the value of its left argument shifted left by the
+Binary C<<< "<<" >>> returns the value of its left argument shifted left by the
number of bits specified by the right argument. Arguments should be
integers. (See also L<Integer Arithmetic>.)
-Binary C<<< >> >>> returns the value of its left argument shifted right by
+Binary C<<< ">>" >>> returns the value of its left argument shifted right by
the number of bits specified by the right argument. Arguments should
be integers. (See also L<Integer Arithmetic>.)
Note that both C<<< << >>> and C<<< >> >>> in Perl are implemented directly using
-C<<< << >>> and C<<< >> >>> in C. If C<use integer> (see L<Integer Arithmetic>) is
+C<<< << >>> and C<<< >> >>> in C. If S<C<use integer>> (see L<Integer Arithmetic>) is
in force then signed C integers are used, else unsigned C integers are
used. Either way, the implementation isn't going to generate results
larger than the size of the integer type Perl was built with (32 bits
The result of overflowing the range of the integers is undefined
because it is undefined also in C. In other words, using 32-bit
-integers, C<< 1 << 32 >> is undefined. Shifting by a negative number
+integers, S<C<< 1 << 32 >>> is undefined. Shifting by a negative number
of bits is also undefined.
If you get tired of being subject to your platform's native integers,
-the C<use bigint> pragma neatly sidesteps the issue altogether:
+the S<C<use bigint>> pragma neatly sidesteps the issue altogether:
print 20 << 20; # 20971520
print 20 << 40; # 5120 on 32-bit machines,
The various named unary operators are treated as functions with one
argument, with optional parentheses.
-If any list operator (print(), etc.) or any unary operator (chdir(), etc.)
+If any list operator (C<print()>, etc.) or any unary operator (C<chdir()>, etc.)
is followed by a left parenthesis as the next token, the operator and
arguments within parentheses are taken to be of highest precedence,
just like a normal function call. For example,
chdir ($foo) || die; # (chdir $foo) || die
chdir +($foo) || die; # (chdir $foo) || die
-but, because * is higher precedence than named operators:
+but, because C<"*"> is higher precedence than named operators:
chdir $foo * 20; # chdir ($foo * 20)
chdir($foo) * 20; # (chdir $foo) * 20
Regarding precedence, the filetest operators, like C<-f>, C<-M>, etc. are
treated like named unary operators, but they don't follow this functional
parenthesis rule. That means, for example, that C<-f($file).".bak"> is
-equivalent to C<-f "$file.bak">.
+equivalent to S<C<-f "$file.bak">>.
X<-X> X<filetest> X<operator, filetest>
See also L<"Terms and List Operators (Leftward)">.
operators in this section and the equality operators in the next
one return C<1> for true and a special version of the defined empty
string, C<"">, which counts as a zero but is exempt from warnings
-about improper numeric conversions, just as C<"0 but true"> is.
+about improper numeric conversions, just as S<C<"0 but true">> is.
-Binary "<" returns true if the left argument is numerically less than
+Binary C<< "<" >> returns true if the left argument is numerically less than
the right argument.
X<< < >>
-Binary ">" returns true if the left argument is numerically greater
+Binary C<< ">" >> returns true if the left argument is numerically greater
than the right argument.
X<< > >>
-Binary "<=" returns true if the left argument is numerically less than
+Binary C<< "<=" >> returns true if the left argument is numerically less than
or equal to the right argument.
X<< <= >>
-Binary ">=" returns true if the left argument is numerically greater
+Binary C<< ">=" >> returns true if the left argument is numerically greater
than or equal to the right argument.
X<< >= >>
-Binary "lt" returns true if the left argument is stringwise less than
+Binary C<"lt"> returns true if the left argument is stringwise less than
the right argument.
X<< lt >>
-Binary "gt" returns true if the left argument is stringwise greater
+Binary C<"gt"> returns true if the left argument is stringwise greater
than the right argument.
X<< gt >>
-Binary "le" returns true if the left argument is stringwise less than
+Binary C<"le"> returns true if the left argument is stringwise less than
or equal to the right argument.
X<< le >>
-Binary "ge" returns true if the left argument is stringwise greater
+Binary C<"ge"> returns true if the left argument is stringwise greater
than or equal to the right argument.
X<< ge >>
=head2 Equality Operators
X<equality> X<equal> X<equals> X<operator, equality>
-Binary "==" returns true if the left argument is numerically equal to
+Binary C<< "==" >> returns true if the left argument is numerically equal to
the right argument.
X<==>
-Binary "!=" returns true if the left argument is numerically not equal
+Binary C<< "!=" >> returns true if the left argument is numerically not equal
to the right argument.
X<!=>
-Binary "<=>" returns -1, 0, or 1 depending on whether the left
+Binary C<< "<=>" >> returns -1, 0, or 1 depending on whether the left
argument is numerically less than, equal to, or greater than the right
-argument. If your platform supports NaNs (not-a-numbers) as numeric
-values, using them with "<=>" returns undef. NaN is not "<", "==", ">",
-"<=" or ">=" anything (even NaN), so those 5 return false. NaN != NaN
-returns true, as does NaN != anything else. If your platform doesn't
-support NaNs then NaN is just a string with numeric value 0.
-X<< <=> >> X<spaceship>
+argument. If your platform supports C<NaN>'s (not-a-numbers) as numeric
+values, using them with C<< "<=>" >> returns undef. C<NaN> is not
+C<< "<" >>, C<< "==" >>, C<< ">" >>, C<< "<=" >> or C<< ">=" >> anything
+(even C<NaN>), so those 5 return false. S<C<< NaN != NaN >>> returns
+true, as does S<C<NaN !=> I<anything else>>. If your platform doesn't
+support C<NaN>'s then C<NaN> is just a string with numeric value 0.
+X<< <=> >>
+X<spaceship>
$ perl -le '$x = "NaN"; print "No NaN support here" if $x == $x'
$ perl -le '$x = "NaN"; print "NaN support here" if $x != $x'
(Note that the L<bigint>, L<bigrat>, and L<bignum> pragmas all
-support "NaN".)
+support C<"NaN">.)
-Binary "eq" returns true if the left argument is stringwise equal to
+Binary C<"eq"> returns true if the left argument is stringwise equal to
the right argument.
X<eq>
-Binary "ne" returns true if the left argument is stringwise not equal
+Binary C<"ne"> returns true if the left argument is stringwise not equal
to the right argument.
X<ne>
-Binary "cmp" returns -1, 0, or 1 depending on whether the left
+Binary C<"cmp"> returns -1, 0, or 1 depending on whether the left
argument is stringwise less than, equal to, or greater than the right
argument.
X<cmp>
-Binary "~~" does a smartmatch between its arguments. Smart matching
+Binary C<"~~"> does a smartmatch between its arguments. Smart matching
is described in the next section.
X<~~>
-"lt", "le", "ge", "gt" and "cmp" use the collation (sort) order specified
-by the current locale if a legacy C<use locale> (but not
-C<use locale ':not_characters'>) is in effect. See
-L<perllocale>. Do not mix these with Unicode, only with legacy binary
-encodings. The standard L<Unicode::Collate> and
-L<Unicode::Collate::Locale> modules offer much more powerful solutions to
-collation issues.
+C<"lt">, C<"le">, C<"ge">, C<"gt"> and C<"cmp"> use the collation (sort)
+order specified by the current C<LC_COLLATE> locale if a S<C<use
+locale>> form that includes collation is in effect. See L<perllocale>.
+Do not mix these with Unicode,
+only use them with legacy 8-bit locale encodings.
+The standard C<L<Unicode::Collate>> and
+C<L<Unicode::Collate::Locale>> modules offer much more powerful
+solutions to collation issues.
For case-insensitive comparisions, look at the L<perlfunc/fc> case-folding
function, available in Perl v5.16 or later:
}
-If you were to set C<$b[3] = 4>, then instead of reporting that "a and b
-are deep copies of each other", it now reports that "b smartmatches in a".
-That because the corresponding position in C<@a> contains an array that
+If you were to set S<C<$b[3] = 4>>, then instead of reporting that "a and b
+are deep copies of each other", it now reports that C<"b smartmatches in a">.
+That's because the corresponding position in C<@a> contains an array that
(eventually) has a 4 in it.
Smartmatching one hash against another reports whether both contain the
does I<not> invoke the overload method with C<I<X>> as an argument.
Instead the above table is consulted as normal, and based on the type of
C<I<X>>, overloading may or may not be invoked. For simple strings or
-numbers, in becomes equivalent to this:
+numbers, "in" becomes equivalent to this:
$object ~~ $number ref($object) == $number
$object ~~ $string ref($object) eq $string
=head2 Bitwise And
X<operator, bitwise, and> X<bitwise and> X<&>
-Binary "&" returns its operands ANDed together bit by bit. Although no
+Binary C<"&"> returns its operands ANDed together bit by bit. Although no
warning is currently raised, the result is not well defined when this operation
is performed on operands that aren't either numbers (see
-L<Integer Arithmetic>) or bitstrings (see L<Bitwise String Operators>).
+L<Integer Arithmetic>) nor bitstrings (see L<Bitwise String Operators>).
-Note that "&" has lower priority than relational operators, so for example
+Note that C<"&"> has lower priority than relational operators, so for example
the parentheses are essential in a test like
print "Even\n" if ($x & 1) == 0;
-If the experimental "bitwise" feature is enabled via C<use feature
-'bitwise'>, then this operator always treats its operand as numbers. This
-feature produces a warning unless you use C<no warnings
-'experimental::bitwise'>.
+If the experimental "bitwise" feature is enabled via S<C<use feature
+'bitwise'>>, then this operator always treats its operand as numbers. This
+feature produces a warning unless you also use C<S<no warnings
+'experimental::bitwise'>>.
=head2 Bitwise Or and Exclusive Or
X<operator, bitwise, or> X<bitwise or> X<|> X<operator, bitwise, xor>
X<bitwise xor> X<^>
-Binary "|" returns its operands ORed together bit by bit.
+Binary C<"|"> returns its operands ORed together bit by bit.
-Binary "^" returns its operands XORed together bit by bit.
+Binary C<"^"> returns its operands XORed together bit by bit.
Although no warning is currently raised, the results are not well
defined when these operations are performed on operands that aren't either
-numbers (see L<Integer Arithmetic>) or bitstrings (see L<Bitwise String
+numbers (see L<Integer Arithmetic>) nor bitstrings (see L<Bitwise String
Operators>).
-Note that "|" and "^" have lower priority than relational operators, so
-for example the brackets are essential in a test like
+Note that C<"|"> and C<"^"> have lower priority than relational operators, so
+for example the parentheses are essential in a test like
print "false\n" if (8 | 2) != 10;
-If the experimental "bitwise" feature is enabled via C<use feature
-'bitwise'>, then this operator always treats its operand as numbers. This
-feature produces a warning unless you use C<no warnings
-'experimental::bitwise'>.
+If the experimental "bitwise" feature is enabled via S<C<use feature
+'bitwise'>>, then this operator always treats its operand as numbers. This
+feature produces a warning unless you also use S<C<no warnings
+'experimental::bitwise'>>.
=head2 C-style Logical And
X<&&> X<logical and> X<operator, logical, and>
-Binary "&&" performs a short-circuit logical AND operation. That is,
+Binary C<"&&"> performs a short-circuit logical AND operation. That is,
if the left operand is false, the right operand is not even evaluated.
Scalar or list context propagates down to the right operand if it
is evaluated.
=head2 C-style Logical Or
X<||> X<operator, logical, or>
-Binary "||" performs a short-circuit logical OR operation. That is,
+Binary C<"||"> performs a short-circuit logical OR operation. That is,
if the left operand is true, the right operand is not even evaluated.
Scalar or list context propagates down to the right operand if it
is evaluated.
X<//> X<operator, logical, defined-or>
Although it has no direct equivalent in C, Perl's C<//> operator is related
-to its C-style or. In fact, it's exactly the same as C<||>, except that it
+to its C-style "or". In fact, it's exactly the same as C<||>, except that it
tests the left hand side's definedness instead of its truth. Thus,
-C<< EXPR1 // EXPR2 >> returns the value of C<< EXPR1 >> if it's defined,
+S<C<< EXPR1 // EXPR2 >>> returns the value of C<< EXPR1 >> if it's defined,
otherwise, the value of C<< EXPR2 >> is returned.
(C<< EXPR1 >> is evaluated in scalar context, C<< EXPR2 >>
in the context of C<< // >> itself). Usually,
-this is the same result as C<< defined(EXPR1) ? EXPR1 : EXPR2 >> (except that
-the ternary-operator form can be used as a lvalue, while C<< EXPR1 // EXPR2 >>
+this is the same result as S<C<< defined(EXPR1) ? EXPR1 : EXPR2 >>> (except that
+the ternary-operator form can be used as a lvalue, while S<C<< EXPR1 // EXPR2 >>>
cannot). This is very useful for
providing default values for variables. If you actually want to test if
-at least one of C<$x> and C<$y> is defined, use C<defined($x // $y)>.
+at least one of C<$x> and C<$y> is defined, use S<C<defined($x // $y)>>.
The C<||>, C<//> and C<&&> operators return the last value evaluated
(unlike C's C<||> and C<&&>, which return 0 or 1). Thus, a reasonably
As alternatives to C<&&> and C<||> when used for
control flow, Perl provides the C<and> and C<or> operators (see below).
-The short-circuit behavior is identical. The precedence of "and"
-and "or" is much lower, however, so that you can safely use them after a
+The short-circuit behavior is identical. The precedence of C<"and">
+and C<"or"> is much lower, however, so that you can safely use them after a
list operator without the need for parentheses:
unlink "alpha", "beta", "gamma"
next LINE;
}
-Using "or" for assignment is unlikely to do what you want; see below.
+Using C<"or"> for assignment is unlikely to do what you want; see below.
=head2 Range Operators
X<operator, range> X<range> X<..> X<...>
-Binary ".." is the range operator, which is really two different
+Binary C<".."> is the range operator, which is really two different
operators depending on the context. In list context, it returns a
list of values counting (up by ones) from the left value to the right
value. If the left value is greater than the right value then it
returns the empty list. The range operator is useful for writing
-C<foreach (1..10)> loops and for doing slice operations on arrays. In
+S<C<foreach (1..10)>> loops and for doing slice operations on arrays. In
the current implementation, no temporary array is created when the
range operator is used as the expression in C<foreach> loops, but older
versions of Perl might burn a lot of memory when you write something
The range operator also works on strings, using the magical
auto-increment, see below.
-In scalar context, ".." returns a boolean value. The operator is
+In scalar context, C<".."> returns a boolean value. The operator is
bistable, like a flip-flop, and emulates the line-range (comma)
-operator of B<sed>, B<awk>, and various editors. Each ".." operator
+operator of B<sed>, B<awk>, and various editors. Each C<".."> operator
maintains its own boolean state, even across calls to a subroutine
that contains it. It is false as long as its left operand is false.
Once the left operand is true, the range operator stays true until the
is evaluated. It can test the right operand and become false on the
same evaluation it became true (as in B<awk>), but it still returns
true once. If you don't want it to test the right operand until the
-next evaluation, as in B<sed>, just use three dots ("...") instead of
-two. In all other regards, "..." behaves just like ".." does.
+next evaluation, as in B<sed>, just use three dots (C<"...">) instead of
+two. In all other regards, C<"..."> behaves just like C<".."> does.
The right operand is not evaluated while the operator is in the
"false" state, and the left operand is not evaluated while the
than || and &&. The value returned is either the empty string for
false, or a sequence number (beginning with 1) for true. The sequence
number is reset for each range encountered. The final sequence number
-in a range has the string "E0" appended to it, which doesn't affect
+in a range has the string C<"E0"> appended to it, which doesn't affect
its numeric value, but gives you something to search for if you want
to exclude the endpoint. You can exclude the beginning point by
waiting for the sequence number to be greater than 1.
-If either operand of scalar ".." is a constant expression,
+If either operand of scalar C<".."> is a constant expression,
that operand is considered true if it is equal (C<==>) to the current
input line number (the C<$.> variable).
-To be pedantic, the comparison is actually C<int(EXPR) == int(EXPR)>,
+To be pedantic, the comparison is actually S<C<int(EXPR) == int(EXPR)>>,
but that is only an issue if you use a floating point expression; when
implicitly using C<$.> as described in the previous paragraph, the
-comparison is C<int(EXPR) == int($.)> which is only an issue when C<$.>
+comparison is S<C<int(EXPR) == int($.)>> which is only an issue when C<$.>
is set to a floating point value and you are not reading from a file.
-Furthermore, C<"span" .. "spat"> or C<2.18 .. 3.14> will not do what
+Furthermore, S<C<"span" .. "spat">> or S<C<2.18 .. 3.14>> will not do what
you want in scalar context because each of the operands are evaluated
using their integer representation.
L<experimental feature|perlrecharclass/Extended Bracketed Character
Classes> C<S</(?[ \p{Greek} & \p{Lower} ])+/>>).
-Because each operand is evaluated in integer form, C<2.18 .. 3.14> will
+Because each operand is evaluated in integer form, S<C<2.18 .. 3.14>> will
return two elements in list context.
@list = (2.18 .. 3.14); # same as @list = (2 .. 3);
=head2 Conditional Operator
X<operator, conditional> X<operator, ternary> X<ternary> X<?:>
-Ternary "?:" is the conditional operator, just as in C. It works much
-like an if-then-else. If the argument before the ? is true, the
-argument before the : is returned, otherwise the argument after the :
-is returned. For example:
+Ternary C<"?:"> is the conditional operator, just as in C. It works much
+like an if-then-else. If the argument before the C<?> is true, the
+argument before the C<:> is returned, otherwise the argument after the
+C<:> is returned. For example:
printf "I have %d dog%s.\n", $n,
($n == 1) ? "" : "s";
X<<< <<= >>> X<&&=> X<-=> X</=> X<|=> X<<< >>= >>> X<||=> X<//=> X<.=>
X<%=> X<^=> X<x=> X<&.=> X<|.=> X<^.=>
-"=" is the ordinary assignment operator.
+C<"="> is the ordinary assignment operator.
Assignment operators work as in C. That is,
$x = $x + 2;
although without duplicating any side effects that dereferencing the lvalue
-might trigger, such as from tie(). Other assignment operators work similarly.
+might trigger, such as from C<tie()>. Other assignment operators work similarly.
The following are recognized:
**= += *= &= &.= <<= &&=
the number of elements produced by the expression on the right hand
side of the assignment.
-The three dotted bitwise assignment operators (C<&.= |.= ^.=>) are new in
+The three dotted bitwise assignment operators (C<&.=> C<|.=> C<^.=>) are new in
Perl 5.22 and experimental. See L</Bitwise String Operators>.
=head2 Comma Operator
X<comma> X<operator, comma> X<,>
-Binary "," is the comma operator. In scalar context it evaluates
+Binary C<","> is the comma operator. In scalar context it evaluates
its left argument, throws that value away, then evaluates its right
argument and returns that value. This is just like C's comma operator.
both its arguments into the list. These arguments are also evaluated
from left to right.
-The C<< => >> operator is a synonym for the comma except that it causes a
+The C<< => >> operator (sometimes pronounced "fat comma") is a synonym
+for the comma except that it causes a
word on its left to be interpreted as a string if it begins with a letter
or underscore and is composed only of letters, digits and underscores.
This includes operands that might otherwise be interpreted as operators,
print time.shift => "bbb";
-That example prints something like "1314363215shiftbbb", because the
+That example prints something like C<"1314363215shiftbbb">, because the
C<< => >> implicitly quotes the C<shift> immediately on its left, ignoring
the fact that C<time.shift> is the entire left operand.
On the right side of a list operator, the comma has very low precedence,
such that it controls all comma-separated expressions found there.
The only operators with lower precedence are the logical operators
-"and", "or", and "not", which may be used to evaluate calls to list
+C<"and">, C<"or">, and C<"not">, which may be used to evaluate calls to list
operators without the need for parentheses:
open HANDLE, "< :utf8", "filename" or die "Can't open: $!\n";
open(HANDLE, "< :utf8", "filename") or die "Can't open: $!\n";
-in which case you might as well just use the more customary "||" operator:
+in which case you might as well just use the more customary C<"||"> operator:
open(HANDLE, "< :utf8", "filename") || die "Can't open: $!\n";
=head2 Logical Not
X<operator, logical, not> X<not>
-Unary "not" returns the logical negation of the expression to its right.
-It's the equivalent of "!" except for the very low precedence.
+Unary C<"not"> returns the logical negation of the expression to its right.
+It's the equivalent of C<"!"> except for the very low precedence.
=head2 Logical And
X<operator, logical, and> X<and>
-Binary "and" returns the logical conjunction of the two surrounding
+Binary C<"and"> returns the logical conjunction of the two surrounding
expressions. It's equivalent to C<&&> except for the very low
precedence. This means that it short-circuits: the right
expression is evaluated only if the left expression is true.
X<operator, logical, exclusive or>
X<or> X<xor>
-Binary "or" returns the logical disjunction of the two surrounding
+Binary C<"or"> returns the logical disjunction of the two surrounding
expressions. It's equivalent to C<||> except for the very low precedence.
This makes it useful for control flow:
$x = $y || $z; # better written this way
However, when it's a list-context assignment and you're trying to use
-C<||> for control flow, you probably need "or" so that the assignment
+C<||> for control flow, you probably need C<"or"> so that the assignment
takes higher precedence.
@info = stat($file) || die; # oops, scalar sense of stat!
Then again, you could always use parentheses.
-Binary C<xor> returns the exclusive-OR of the two surrounding expressions.
+Binary C<"xor"> returns the exclusive-OR of the two surrounding expressions.
It cannot short-circuit (of course).
There is no low precedence operator for defined-OR.
=item unary &
-Address-of operator. (But see the "\" operator for taking a reference.)
+Address-of operator. (But see the C<"\"> operator for taking a reference.)
=item unary *
Dereference-address operator. (Perl's prefix dereferencing
-operators are typed: $, @, %, and &.)
+operators are typed: C<$>, C<@>, C<%>, and C<&>.)
=item (TYPE)
$s = q{ if($x eq "}") ... }; # WRONG
-is a syntax error. The C<Text::Balanced> module (standard as of v5.8,
+is a syntax error. The C<L<Text::Balanced>> module (standard as of v5.8,
and from CPAN before then) is able to do this properly.
There can be whitespace between the operator and the quoting
characters, except when C<#> is being used as the quoting character.
-C<q#foo#> is parsed as the string C<foo>, while C<q #foo#> is the
+C<q#foo#> is parsed as the string C<foo>, while S<C<q #foo#>> is the
operator C<q> followed by a comment. Its argument will be taken
from the next line. This allows you to write:
Only hexadecimal digits are valid following C<\x>. When C<\x> is followed
by fewer than two valid digits, any valid digits will be zero-padded. This
-means that C<\x7> will be interpreted as C<\x07>, and a lone <\x> will be
+means that C<\x7> will be interpreted as C<\x07>, and a lone C<"\x"> will be
interpreted as C<\x00>. Except at the end of a string, having fewer than
two valid digits will result in a warning. Note that although the warning
says the illegal character is ignored, it is only ignored as part of the
=item [4]
-C<\N{U+I<hexadecimal number>}> means the Unicode character whose Unicode code
+S<C<\N{U+I<hexadecimal number>}>> means the Unicode character whose Unicode code
point is I<hexadecimal number>.
=item [5]
\cZ chr(26)
\cz chr(26)
\c[ chr(27)
+ # See below for chr(28)
\c] chr(29)
\c^ chr(30)
\c_ chr(31)
- \c? chr(127) # (on ASCII platforms)
+ \c? chr(127) # (on ASCII platforms; see below for link to
+ # EBCDIC discussion)
In other words, it's the character whose code point has had 64 xor'd with
its uppercase. C<\c?> is DELETE on ASCII platforms because
S<C<ord("?") ^ 64>> is 127, and
-C<\c@> is NULL because the ord of "@" is 64, so xor'ing 64 itself produces 0.
+C<\c@> is NULL because the ord of C<"@"> is 64, so xor'ing 64 itself produces 0.
-Also, C<\c\I<X>> yields C< chr(28) . "I<X>"> for any I<X>, but cannot come at the
+Also, C<\c\I<X>> yields S<C< chr(28) . "I<X>">> for any I<X>, but cannot come at the
end of a string, because the backslash would be parsed as escaping the end
quote.
use C<\o{}> instead, which avoids all these problems. Otherwise, it is best to
use this construct only for ordinals C<\077> and below, remembering to pad to
the left with zeros to make three digits. For larger ordinals, either use
-C<\o{}>, or convert to something else, such as to hex and use C<\x{}>
-instead.
+C<\o{}>, or convert to something else, such as to hex and use C<\N{U+}>
+(which is portable between platforms with different character sets) or
+C<\x{}> instead.
=item [8]
character. For example C<\x{50}> and C<\o{120}> both are the number 80 in
decimal, which is less than 256, so the number is interpreted in the native
character set encoding. In ASCII the character in the 80th position (indexed
-from 0) is the letter "P", and in EBCDIC it is the ampersand symbol "&".
+from 0) is the letter C<"P">, and in EBCDIC it is the ampersand symbol C<"&">.
C<\x{100}> and C<\o{400}> are both 256 in decimal, so the number is interpreted
as a Unicode code point no matter what the native encoding is. The name of the
character in the 256th position (indexed by 0) in Unicode is
C<LATIN CAPITAL LETTER A WITH MACRON>.
There are a couple of exceptions to the above rule. S<C<\N{U+I<hex number>}>> is
-always interpreted as a Unicode code point, so that C<\N{U+0050}> is "P" even
-on EBCDIC platforms. And if L<C<S<use encoding>>|encoding> is in effect, the
+always interpreted as a Unicode code point, so that C<\N{U+0050}> is C<"P"> even
+on EBCDIC platforms. And if C<S<L<use encoding|encoding>>> is in effect, the
number is considered to be in that encoding, and is translated from that into
the platform's native encoding if there is a corresponding native character;
otherwise to Unicode.
B<NOTE>: Unlike C and other languages, Perl has no C<\v> escape sequence for
the vertical tab (VT, which is 11 in both ASCII and EBCDIC), but you may
-use C<\ck> or
-C<\x0b>. (C<\v>
+use C<\N{VT}>, C<\ck>, C<\N{U+0b}>, or C<\x0b>. (C<\v>
does have meaning in regular expression patterns in Perl, see L<perlre>.)
The following escape sequences are available in constructs that interpolate,
say"This \Qquoting \ubusiness \Uhere isn't quite\E done yet,\E is it?";
This quoting\ Business\ HERE\ ISN\'T\ QUITE\ done\ yet\, is it?
-If C<use locale> is in effect (but not C<use locale ':not_characters'>),
-the case map used by C<\l>, C<\L>,
-C<\u>, and C<\U> is taken from the current locale. See L<perllocale>.
-If Unicode (for example, C<\N{}> or code points of 0x100 or
-beyond) is being used, the case map used by C<\l>, C<\L>, C<\u>, and
-C<\U> is as defined by Unicode. That means that case-mapping
-a single character can sometimes produce several characters.
-Under C<use locale>, C<\F> produces the same results as C<\L>
+If a S<C<use locale>> form that includes C<LC_CTYPE> is in effect (see
+L<perllocale>), the case map used by C<\l>, C<\L>, C<\u>, and C<\U> is
+taken from the current locale. If Unicode (for example, C<\N{}> or code
+points of 0x100 or beyond) is being used, the case map used by C<\l>,
+C<\L>, C<\u>, and C<\U> is as defined by Unicode. That means that
+case-mapping a single character can sometimes produce a sequence of
+several characters.
+Under S<C<use locale>>, C<\F> produces the same results as C<\L>
for all locales but a UTF-8 one, where it instead uses the Unicode
definition.
device drivers, C libraries, and Perl all conspire to preserve. Not all
systems read C<"\r"> as ASCII CR and C<"\n"> as ASCII LF. For example,
on the ancient Macs (pre-MacOS X) of yesteryear, these used to be reversed,
-and on systems without line terminator,
+and on systems without a line terminator,
printing C<"\n"> might emit no actual data. In general, use C<"\n"> when
you mean a "newline" for your system, but use the literal ASCII when you
need an exact character. For example, most networking protocols expect
Interpolating an array or slice interpolates the elements in order,
separated by the value of C<$">, so is equivalent to interpolating
-C<join $", @array>. "Punctuation" arrays such as C<@*> are usually
+S<C<join $", @array>>. "Punctuation" arrays such as C<@*> are usually
interpolated only if the name is enclosed in braces C<@{*}>, but the
arrays C<@_>, C<@+>, and C<@-> are interpolated even without braces.
=over 8
-=item qr/STRING/msixpodualn
+=item C<qr/I<STRING>/msixpodualn>
X<qr> X</i> X</m> X</o> X</s> X</x> X</p>
This operator quotes (and possibly compiles) its I<STRING> as a regular
expression. I<STRING> is interpolated the same way as I<PATTERN>
-in C<m/PATTERN/>. If "'" is used as the delimiter, no interpolation
+in C<m/I<PATTERN>/>. If C<"'"> is used as the delimiter, no interpolation
is done. Returns a Perl value which may be used instead of the
-corresponding C</STRING/msixpodualn> expression. The returned value is a
+corresponding C</I<STRING>/msixpodualn> expression. The returned value is a
normalized version of the original pattern. It magically differs from
a string containing the same characters: C<ref(qr/x/)> returns "Regexp";
however, dereferencing it is not well defined (you currently get the
$string =~ $re; # or used standalone
$string =~ /$re/; # or this way
-Since Perl may compile the pattern at the moment of execution of the qr()
-operator, using qr() may have speed advantages in some situations,
-notably if the result of qr() is used standalone:
+Since Perl may compile the pattern at the moment of execution of the C<qr()>
+operator, using C<qr()> may have speed advantages in some situations,
+notably if the result of C<qr()> is used standalone:
sub match {
my $patterns = shift;
}
Precompilation of the pattern into an internal representation at
-the moment of qr() avoids a need to recompile the pattern every
+the moment of C<qr()> avoids the need to recompile the pattern every
time a match C</$pat/> is attempted. (Perl has many other internal
optimizations, but none would be triggered in the above example if
-we did not use qr() operator.)
+we did not use C<qr()> operator.)
Options (specified by the following modifiers) are:
x Use extended regular expressions.
p When matching preserve a copy of the matched string so
that ${^PREMATCH}, ${^MATCH}, ${^POSTMATCH} will be
- defined.
+ defined (ignored starting in v5.20) as these are always
+ defined starting in that relese
o Compile pattern only once.
a ASCII-restrict: Use ASCII for \d, \s, \w; specifying two
- a's further restricts /i matching so that no ASCII
- character will match a non-ASCII one.
- l Use the locale.
+ a's further restricts things to that that no ASCII
+ character will match a non-ASCII one under /i.
+ l Use the current run-time locale's rules.
u Use Unicode rules.
d Use Unicode or native charset, as in 5.12 and earlier.
n Non-capture mode. Don't let () fill in $1, $2, etc...
If a precompiled pattern is embedded in a larger pattern then the effect
-of "msixpluadn" will be propagated appropriately. The effect the "o"
-modifier has is not propagated, being restricted to those patterns
+of C<"msixpluadn"> will be propagated appropriately. The effect that the
+C</o> modifier has is not propagated, being restricted to those patterns
explicitly using it.
The last four modifiers listed above, added in Perl 5.14,
to want to specify explicitly; the other three are selected
automatically by various pragmas.
-See L<perlre> for additional information on valid syntax for STRING, and
+See L<perlre> for additional information on valid syntax for I<STRING>, and
for a detailed look at the semantics of regular expressions. In
particular, all modifiers except the largely obsolete C</o> are further
explained in L<perlre/Modifiers>. C</o> is described in the next section.
-=item m/PATTERN/msixpodualngc
+=item C<m/I<PATTERN>/msixpodualngc>
X<m> X<operator, match>
X<regexp, options> X<regexp> X<regex, options> X<regex>
X</m> X</s> X</i> X</x> X</p> X</o> X</g> X</c>
-=item /PATTERN/msixpodualngc
+=item C</I<PATTERN>/msixpodualngc>
Searches a string for a pattern match, and in scalar context returns
true if it succeeds, false if it fails. If no string is specified
-via the C<=~> or C<!~> operator, the $_ string is searched. (The
+via the C<=~> or C<!~> operator, the C<$_> string is searched. (The
string specified with C<=~> need not be an lvalue--it may be the
result of an expression evaluation, but remember the C<=~> binds
rather tightly.) See also L<perlre>.
c Do not reset search position on a failed match when /g is
in effect.
-If "/" is the delimiter then the initial C<m> is optional. With the C<m>
+If C<"/"> is the delimiter then the initial C<m> is optional. With the C<m>
you can use any pair of non-whitespace (ASCII) characters
as delimiters. This is particularly useful for matching path names
-that contain "/", to avoid LTS (leaning toothpick syndrome). If "?" is
+that contain C<"/">, to avoid LTS (leaning toothpick syndrome). If C<"?"> is
the delimiter, then a match-only-once rule applies,
-described in C<m?PATTERN?> below. If "'" (single quote) is the delimiter,
-no interpolation is performed on the PATTERN.
-When using a character valid in an identifier, whitespace is required
+described in C<m?I<PATTERN>?> below. If C<"'"> (single quote) is the delimiter,
+no interpolation is performed on the I<PATTERN>.
+When using a delimiter character valid in an identifier, whitespace is required
after the C<m>.
-PATTERN may contain variables, which will be interpolated
+I<PATTERN> may contain variables, which will be interpolated
every time the pattern search is evaluated, except
for when the delimiter is a single quote. (Note that C<$(>, C<$)>, and
C<$|> are not interpolated because they look like end-of-string tests.)
The bottom line is that using C</o> is almost never a good idea.
-=item The empty pattern //
+=item The empty pattern C<//>
-If the PATTERN evaluates to the empty string, the last
+If the I<PATTERN> evaluates to the empty string, the last
I<successfully> matched regular expression is used instead. In this
case, only the C<g> and C<c> flags on the empty pattern are honored;
the other flags are taken from the original pattern. If no match has
Note that it's possible to confuse Perl into thinking C<//> (the empty
regex) is really C<//> (the defined-or operator). Perl is usually pretty
good about this, but some pathological cases might trigger this, such as
-C<$x///> (is that C<($x) / (//)> or C<$x // />?) and C<print $fh //>
-(C<print $fh(//> or C<print($fh //>?). In all of these examples, Perl
+C<$x///> (is that S<C<($x) / (//)>> or S<C<$x // />>?) and S<C<print $fh //>>
+(S<C<print $fh(//>> or S<C<print($fh //>>?). In all of these examples, Perl
will assume you meant defined-or. If you meant the empty regex, just
use parentheses or spaces to disambiguate, or even prefix the empty
regex with an C<m> (so C<//> becomes C<m//>).
if (($F1, $F2, $Etc) = ($foo =~ /^(\S+)\s+(\S+)\s*(.*)/))
-This last example splits $foo into the first two words and the
-remainder of the line, and assigns those three fields to $F1, $F2, and
-$Etc. The conditional is true if any variables were assigned; that is,
+This last example splits C<$foo> into the first two words and the
+remainder of the line, and assigns those three fields to C<$F1>, C<$F2>, and
+C<$Etc>. The conditional is true if any variables were assigned; that is,
if the pattern matched.
The C</g> modifier specifies global pattern matching--that is,
by adding the C</c> modifier (for example, C<m//gc>). Modifying the target
string also resets the search position.
-=item \G assertion
+=item C<\G I<assertion>>
You can intermix C<m//g> matches with C<m/\G.../g>, where C<\G> is a
zero-width assertion that matches the exact position where the
lowercase line-noise lowercase lowercase line-noise lowercase
lowercase line-noise MiXeD line-noise. That's all!
-=item m?PATTERN?msixpodualngc
+=item C<m?I<PATTERN>?msixpodualngc>
X<?> X<operator, match-once>
-=item ?PATTERN?msixpodualngc
+=item C<?I<PATTERN>?msixpodualngc>
-This is just like the C<m/PATTERN/> search, except that it matches
-only once between calls to the reset() operator. This is a useful
+This is just like the C<m/I<PATTERN>/> search, except that it matches
+only once between calls to the C<reset()> operator. This is a useful
optimization when you want to see only the first occurrence of
something in each file of a set of files, for instance. Only C<m??>
patterns local to the current package are reset.
The match-once behavior is controlled by the match delimiter being
C<?>; with any other delimiter this is the normal C<m//> operator.
-In the past, the leading C<m> in C<m?PATTERN?> was optional, but omitting it
+In the past, the leading C<m> in C<m?I<PATTERN>?> was optional, but omitting it
would produce a deprecation warning. As of v5.22.0, omitting it produces a
syntax error. If you encounter this construct in older code, you can just add
C<m>.
-=item s/PATTERN/REPLACEMENT/msixpodualngcer
+=item C<s/I<PATTERN>/I<REPLACEMENT>/msixpodualngcer>
X<substitute> X<substitution> X<replace> X<regexp, replace>
X<regexp, substitute> X</m> X</s> X</i> X</x> X</p> X</o> X</g> X</c> X</e> X</r>
scalar lvalue.
If the delimiter chosen is a single quote, no interpolation is
-done on either the PATTERN or the REPLACEMENT. Otherwise, if the
-PATTERN contains a $ that looks like a variable rather than an
+done on either the I<PATTERN> or the I<REPLACEMENT>. Otherwise, if the
+I<PATTERN> contains a C<$> that looks like a variable rather than an
end-of-string test, the variable will be interpolated into the pattern
at run-time. If you want the pattern compiled only once the first time
the variable is interpolated, use the C</o> option. If the pattern
evaluates to the empty string, the last successfully executed regular
expression is used instead. See L<perlre> for further explanation on these.
-Options are as with m// with the addition of the following replacement
+Options are as with C<m//> with the addition of the following replacement
specific options:
e Evaluate the right side as an expression.
are used, no interpretation is done on the replacement string (the C</e>
modifier overrides this, however). Note that Perl treats backticks
as normal delimiters; the replacement text is not evaluated as a command.
-If the PATTERN is delimited by bracketing quotes, the REPLACEMENT has
+If the I<PATTERN> is delimited by bracketing quotes, the I<REPLACEMENT> has
its own pair of quotes, which may or may not be bracketing quotes, for example,
C<s(foo)(bar)> or C<< s<foo>/bar/ >>. A C</e> will cause the
replacement portion to be treated as a full-fledged Perl expression
s/([^ ]*) *([^ ]*)/$2 $1/; # reverse 1st two fields
-Note the use of $ instead of \ in the last example. Unlike
-B<sed>, we use the \<I<digit>> form in only the left hand side.
+Note the use of C<$> instead of C<\> in the last example. Unlike
+B<sed>, we use the \<I<digit>> form only in the left hand side.
Anywhere else it's $<I<digit>>.
Occasionally, you can't use just a C</g> to get all the changes
=over 4
-=item q/STRING/
+=item C<q/I<STRING>/>
X<q> X<quote, single> X<'> X<''>
-=item 'STRING'
+=item C<'I<STRING>'>
A single-quoted, literal string. A backslash represents a backslash
unless followed by the delimiter or another backslash, in which case
$bar = q('This is it.');
$baz = '\n'; # a two-character string
-=item qq/STRING/
+=item C<qq/I<STRING>/>
X<qq> X<quote, double> X<"> X<"">
-=item "STRING"
+=item "I<STRING>"
A double-quoted, interpolated string.
if /\b(tcl|java|python)\b/i; # :-)
$baz = "\n"; # a one-character string
-=item qx/STRING/
+=item C<qx/I<STRING>/>
X<qx> X<`> X<``> X<backtick>
-=item `STRING`
+=item C<`I<STRING>`>
A string which is (possibly) interpolated and then executed as a
system command with F</bin/sh> or its equivalent. Shell wildcards,
pipes, and redirections will be honored. The collected standard
output of the command is returned; standard error is unaffected. In
scalar context, it comes back as a single (potentially multi-line)
-string, or undef if the command failed. In list context, returns a
-list of lines (however you've defined lines with $/ or
-$INPUT_RECORD_SEPARATOR), or an empty list if the command failed.
+string, or C<undef> if the command failed. In list context, returns a
+list of lines (however you've defined lines with C<$/> or
+C<$INPUT_RECORD_SEPARATOR>), or an empty list if the command failed.
Because backticks do not affect standard error, use shell file descriptor
syntax (assuming the shell supports this) if you care to address this.
interpreter on your system. On most platforms, you will have to protect
shell metacharacters if you want them treated literally. This is in
practice difficult to do, as it's unclear how to escape which characters.
-See L<perlsec> for a clean and safe example of a manual fork() and exec()
+See L<perlsec> for a clean and safe example of a manual C<fork()> and C<exec()>
to emulate backticks safely.
On some platforms (notably DOS-like ones), the shell may not be
Perl will attempt to flush all files opened for
output before starting the child process, but this may not be supported
on some platforms (see L<perlport>). To be safe, you may need to set
-C<$|> ($AUTOFLUSH in English) or call the C<autoflush()> method of
-C<IO::Handle> on any open handles.
+C<$|> (C<$AUTOFLUSH> in C<L<English>>) or call the C<autoflush()> method of
+C<L<IO::Handle>> on any open handles.
Beware that some command shells may place restrictions on the length
of the command line. You must ensure your strings don't exceed this
See L</"I/O Operators"> for more discussion.
-=item qw/STRING/
+=item C<qw/I<STRING>/>
X<qw> X<quote, list> X<quote, words>
-Evaluates to a list of the words extracted out of STRING, using embedded
+Evaluates to a list of the words extracted out of I<STRING>, using embedded
whitespace as the word delimiters. It can be understood as being roughly
equivalent to:
use POSIX qw( setlocale localeconv )
@EXPORT = qw( foo bar baz );
-A common mistake is to try to separate the words with comma or to
+A common mistake is to try to separate the words with commas or to
put comments into a multi-line C<qw>-string. For this reason, the
-C<use warnings> pragma and the B<-w> switch (that is, the C<$^W> variable)
-produces warnings if the STRING contains the "," or the "#" character.
+S<C<use warnings>> pragma and the B<-w> switch (that is, the C<$^W> variable)
+produces warnings if the I<STRING> contains the C<","> or the C<"#"> character.
-=item tr/SEARCHLIST/REPLACEMENTLIST/cdsr
+=item C<tr/I<SEARCHLIST>/I<REPLACEMENTLIST>/cdsr>
X<tr> X<y> X<transliterate> X</c> X</d> X</s>
-=item y/SEARCHLIST/REPLACEMENTLIST/cdsr
+=item C<y/I<SEARCHLIST>/I<REPLACEMENTLIST>/cdsr>
Transliterates all occurrences of the characters found in the search list
with the corresponding character in the replacement list. It returns
the number of characters replaced or deleted. If no string is
-specified via the C<=~> or C<!~> operator, the $_ string is transliterated.
+specified via the C<=~> or C<!~> operator, the C<$_> string is transliterated.
If the C</r> (non-destructive) option is present, a new copy of the string
is made and its characters transliterated, and this copy is returned no
A character range may be specified with a hyphen, so C<tr/A-J/0-9/>
does the same replacement as C<tr/ACEGIBDFHJ/0246813579/>.
For B<sed> devotees, C<y> is provided as a synonym for C<tr>. If the
-SEARCHLIST is delimited by bracketing quotes, the REPLACEMENTLIST has
+I<SEARCHLIST> is delimited by bracketing quotes, the I<REPLACEMENTLIST> has
its own pair of quotes, which may or may not be bracketing quotes;
for example, C<tr[aeiouy][yuoiea]> or C<tr(+\-*/)/ABCD/>.
+Characters may be literals or any of the escape sequences accepted in
+double-quoted strings. But there is no interpolation, so C<"$"> and
+C<"@"> are treated as literals. A hyphen at the beginning or end, or
+preceded by a backslash is considered a literal. Escape sequence
+details are in L<the table near the beginning of this section|/Quote and
+Quote-like Operators>. It is a bug in Perl v5.22 that something like
+
+ tr/\N{U+20}-\N{U+7E}foobar//
+
+does not treat that range as fully Unicode.
+
Note that C<tr> does B<not> do regular expression character classes such as
-C<\d> or C<\pL>. The C<tr> operator is not equivalent to the tr(1)
+C<\d> or C<\pL>. The C<tr> operator is not equivalent to the C<L<tr(1)>>
utility. If you want to map strings between lower/upper cases, see
L<perlfunc/lc> and L<perlfunc/uc>, and in general consider using the C<s>
operator if you need regular expressions. The C<\U>, C<\u>, C<\L>, and
r Return the modified string and leave the original string
untouched.
-If the C</c> modifier is specified, the SEARCHLIST character set
+If the C</c> modifier is specified, the I<SEARCHLIST> character set
is complemented. If the C</d> modifier is specified, any characters
-specified by SEARCHLIST not found in REPLACEMENTLIST are deleted.
+specified by I<SEARCHLIST> not found in I<REPLACEMENTLIST> are deleted.
(Note that this is slightly more flexible than the behavior of some
-B<tr> programs, which delete anything they find in the SEARCHLIST,
+B<tr> programs, which delete anything they find in the I<SEARCHLIST>,
period.) If the C</s> modifier is specified, sequences of characters
that were transliterated to the same character are squashed down
to a single instance of the character.
-If the C</d> modifier is used, the REPLACEMENTLIST is always interpreted
-exactly as specified. Otherwise, if the REPLACEMENTLIST is shorter
-than the SEARCHLIST, the final character is replicated till it is long
-enough. If the REPLACEMENTLIST is empty, the SEARCHLIST is replicated.
+If the C</d> modifier is used, the I<REPLACEMENTLIST> is always interpreted
+exactly as specified. Otherwise, if the I<REPLACEMENTLIST> is shorter
+than the I<SEARCHLIST>, the final character is replicated till it is long
+enough. If the I<REPLACEMENTLIST> is empty, the I<SEARCHLIST> is replicated.
This latter is useful for counting characters in a class or for
squashing character sequences in a class.
will transliterate any A to X.
Because the transliteration table is built at compile time, neither
-the SEARCHLIST nor the REPLACEMENTLIST are subjected to double quote
+the I<SEARCHLIST> nor the I<REPLACEMENTLIST> are subjected to double quote
interpolation. That means that if you want to use variables, you
-must use an eval():
+must use an C<eval()>:
eval "tr/$oldlist/$newlist/";
die $@ if $@;
eval "tr/$oldlist/$newlist/, 1" or die $@;
-=item <<EOF
+=item C<< <<I<EOF> >>
X<here-doc> X<heredoc> X<here-document> X<<< << >>>
A line-oriented form of quoting is based on the shell "here-document"
=item Finding the end
-The first pass is finding the end of the quoted construct, where
-the information about the delimiters is used in parsing.
-During this search, text between the starting and ending delimiters
-is copied to a safe location. The text copied gets delimiter-independent.
+The first pass is finding the end of the quoted construct. This results
+in saving to a safe location a copy of the text (between the starting
+and ending delimiters), normalized as necessary to avoid needing to know
+what the original delimiters were.
If the construct is a here-doc, the ending delimiter is a line
that has a terminating string as the content. Therefore C<<<EOF> is
(that is C<(>, C<[>, C<{>, or C<< < >>), the ending delimiter is the
corresponding closing punctuation (that is C<)>, C<]>, C<}>, or C<< > >>).
If the starting delimiter is an unpaired character like C</> or a closing
-punctuation, the ending delimiter is same as the starting delimiter.
+punctuation, the ending delimiter is the same as the starting delimiter.
Therefore a C</> terminates a C<qq//> construct, while a C<]> terminates
both C<qq[]> and C<qq]]> constructs.
and C<\\> are skipped. For example, while searching for terminating C</>,
combinations of C<\\> and C<\/> are skipped. If the delimiters are
bracketing, nested pairs are also skipped. For example, while searching
-for closing C<]> paired with the opening C<[>, combinations of C<\\>, C<\]>,
+for a closing C<]> paired with the opening C<[>, combinations of C<\\>, C<\]>,
and C<\[> are all skipped, and nested C<[> and C<]> are skipped as well.
However, when backslashes are used as the delimiters (like C<qq\\> and
C<tr\\\>), nothing is skipped.
If the left part is delimited by bracketing punctuation (that is C<()>,
C<[]>, C<{}>, or C<< <> >>), the right part needs another pair of
delimiters such as C<s(){}> and C<tr[]//>. In these cases, whitespace
-and comments are allowed between the two parts, though the comment must follow
+and comments are allowed between the two parts, although the comment must follow
at least one whitespace character; otherwise a character expected as the
start of the comment may be regarded as the starting delimiter of the right part.
=item C<''>, C<q//>, C<tr'''>, C<y'''>, the replacement of C<s'''>
The only interpolation is removal of C<\> from pairs of C<\\>.
-Therefore C<-> in C<tr'''> and C<y'''> is treated literally
+Therefore C<"-"> in C<tr'''> and C<y'''> is treated literally
as a hyphen and no character range is available.
C<\1> in the replacement of C<s'''> does not work as C<$1>.
case and quoting such as C<\Q>, C<\U>, and C<\E> are not recognized.
The other escape sequences such as C<\200> and C<\t> and backslashed
characters such as C<\\> and C<\-> are converted to appropriate literals.
-The character C<-> is treated specially and therefore C<\-> is treated
-as a literal C<->.
+The character C<"-"> is treated specially and therefore C<\-> is treated
+as a literal C<"-">.
=item C<"">, C<``>, C<qq//>, C<qx//>, C<< <file*glob> >>, C<<<"EOF">
C<\Q>, C<\U>, C<\u>, C<\L>, C<\l>, C<\F> (possibly paired with C<\E>) are
converted to corresponding Perl constructs. Thus, C<"$foo\Qbaz$bar">
-is converted to C<$foo . (quotemeta("baz" . $bar))> internally.
+is converted to S<C<$foo . (quotemeta("baz" . $bar))>> internally.
The other escape sequences such as C<\200> and C<\t> and backslashed
characters such as C<\\> and C<\-> are replaced with appropriate
expansions.
may be closer to the conjectural I<intention> of the writer of C<"\Q\t\E">.
Interpolated scalars and arrays are converted internally to the C<join> and
-C<.> catenation operations. Thus, C<"$foo XXX '@arr'"> becomes:
+C<"."> catenation operations. Thus, S<C<"$foo XXX '@arr'">> becomes:
$foo . " XXX '" . (join $", @arr) . "'";
All operations above are performed simultaneously, left to right.
-Because the result of C<"\Q STRING \E"> has all metacharacters
+Because the result of S<C<"\Q I<STRING> \E">> has all metacharacters
quoted, there is no way to insert a literal C<$> or C<@> inside a
-C<\Q\E> pair. If protected by C<\>, C<$> will be quoted to became
+C<\Q\E> pair. If protected by C<\>, C<$> will be quoted to become
C<"\\\$">; if not, it is interpreted as the start of an interpolated
scalar.
Note also that the interpolation code needs to make a decision on
where the interpolated scalar ends. For instance, whether
-C<< "a $x -> {c}" >> really means:
+S<C<< "a $x -> {c}" >>> really means:
"a " . $x . " -> {c}";
It is at this step that C<\1> is begrudgingly converted to C<$1> in
the replacement text of C<s///>, in order to correct the incorrigible
I<sed> hackers who haven't picked up the saner idiom yet. A warning
-is emitted if the C<use warnings> pragma or the B<-w> command-line flag
+is emitted if the S<C<use warnings>> pragma or the B<-w> command-line flag
(that is, the C<$^W> variable) was set.
=item C<RE> in C<?RE?>, C</RE/>, C<m/RE/>, C<s/RE/foo/>,
back to the perl parser, in a similar way that an interpolated array
subscript expression such as C<"foo$array[1+f("[xyz")]bar"> would be.
-Moreover, inside C<(?{BLOCK})>, C<(?# comment )>, and
-a C<#>-comment in a C<//x>-regular expression, no processing is
+Moreover, inside C<(?{BLOCK})>, S<C<(?# comment )>>, and
+a C<#>-comment in a C</x>-regular expression, no processing is
performed whatsoever. This is the first step at which the presence
-of the C<//x> modifier is relevant.
+of the C</x> modifier is relevant.
Interpolation in patterns has several quirks: C<$|>, C<$(>, C<$)>, C<@+>
and C<@-> are not interpolated, and constructs C<$var[SOMETHING]> are
In the RE above, which is intentionally obfuscated for illustration, the
delimiter is C<m>, the modifier is C<mx>, and after delimiter-removal the
-RE is the same as for C<m/ ^ a \s* b /mx>. There's more than one
+RE is the same as for S<C<m/ ^ a \s* b /mx>>. There's more than one
reason you're encouraged to restrict your delimiters to non-alphanumeric,
non-whitespace choices.
Whatever happens in the RE engine might be better discussed in L<perlre>,
but for the sake of continuity, we shall do so here.
-This is another step where the presence of the C<//x> modifier is
+This is another step where the presence of the C</x> modifier is
relevant. The RE engine scans the string from left to right and
-converts it to a finite automaton.
+converts it into a finite automaton.
Backslashed characters are either replaced with corresponding
literal strings (as with C<\{>), or else they generate special nodes
RE engine (such as C<|>) generate corresponding nodes or groups of
nodes. C<(?#...)> comments are ignored. All the rest is either
converted to literal strings to match, or else is ignored (as is
-whitespace and C<#>-style comments if C<//x> is present).
+whitespace and C<#>-style comments if C</x> is present).
Parsing of the bracketed character class construct, C<[...]>, is
rather different than the rule used for the rest of the pattern.
It is possible to inspect both the string given to RE engine and the
resulting finite automaton. See the arguments C<debug>/C<debugcolor>
-in the C<use L<re>> pragma, as well as Perl's B<-Dr> command-line
+in the S<C<use L<re>>> pragma, as well as Perl's B<-Dr> command-line
switch documented in L<perlrun/"Command Switches">.
=item Optimization of regular expressions
there is one situation where an automatic assignment happens. If
and only if the input symbol is the only thing inside the conditional
of a C<while> statement (even if disguised as a C<for(;;)> loop),
-the value is automatically assigned to the global variable $_,
+the value is automatically assigned to the global variable C<$_>,
destroying whatever was there previously. (This may seem like an
odd thing to you, but you'll use the construct in almost every Perl
-script you write.) The $_ variable is not implicitly localized.
-You'll have to put a C<local $_;> before the loop if you want that
+script you write.) The C<$_> variable is not implicitly localized.
+You'll have to put a S<C<local $_;>> before the loop if you want that
to happen.
The following lines are equivalent:
is automatic or explicit) is then tested to see whether it is
defined. The defined test avoids problems where the line has a string
value that would be treated as false by Perl; for example a "" or
-a "0" with no trailing newline. If you really mean for such values
+a C<"0"> with no trailing newline. If you really mean for such values
to terminate the loop, they should be tested for explicitly:
while (($_ = <STDIN>) ne '0') { ... }
while (<STDIN>) { last unless $_; ... }
-In other boolean contexts, C<< <FILEHANDLE> >> without an
+In other boolean contexts, C<< <I<FILEHANDLE>> >> without an
explicit C<defined> test or comparison elicits a warning if the
-C<use warnings> pragma or the B<-w>
+S<C<use warnings>> pragma or the B<-w>
command-line switch (the C<$^W> variable) is in effect.
The filehandles STDIN, STDOUT, and STDERR are predefined. (The
filehandles C<stdin>, C<stdout>, and C<stderr> will also work except
in packages, where they would be interpreted as local identifiers
rather than global.) Additional filehandles may be created with
-the open() function, amongst others. See L<perlopentut> and
+the C<open()> function, amongst others. See L<perlopentut> and
L<perlfunc/open> for details on this.
X<stdin> X<stdout> X<sterr>
-If a <FILEHANDLE> is used in a context that is looking for
+If a C<< <I<FILEHANDLE>> >> is used in a context that is looking for
a list, a list comprising all input lines is returned, one line per
list element. It's easy to grow to a rather large data space this
way, so use with care.
-<FILEHANDLE> may also be spelled C<readline(*FILEHANDLE)>.
+C<< <I<FILEHANDLE>> >> may also be spelled C<readline(*I<FILEHANDLE>)>.
See L<perlfunc/readline>.
-The null filehandle <> is special: it can be used to emulate the
+The null filehandle C<< <> >> is special: it can be used to emulate the
behavior of B<sed> and B<awk>, and any other Unix filter program
that takes a list of filenames, doing the same to each line
-of input from all of them. Input from <> comes either from
+of input from all of them. Input from C<< <> >> comes either from
standard input, or from each file listed on the command line. Here's
-how it works: the first time <> is evaluated, the @ARGV array is
-checked, and if it is empty, C<$ARGV[0]> is set to "-", which when opened
-gives you standard input. The @ARGV array is then processed as a list
+how it works: the first time C<< <> >> is evaluated, the C<@ARGV> array is
+checked, and if it is empty, C<$ARGV[0]> is set to C<"-">, which when opened
+gives you standard input. The C<@ARGV> array is then processed as a list
of filenames. The loop
while (<>) {
}
except that it isn't so cumbersome to say, and will actually work.
-It really does shift the @ARGV array and put the current filename
-into the $ARGV variable. It also uses filehandle I<ARGV>
-internally. <> is just a synonym for <ARGV>, which
+It really does shift the C<@ARGV> array and put the current filename
+into the C<$ARGV> variable. It also uses filehandle I<ARGV>
+internally. C<< <> >> is just a synonym for C<< <ARGV> >>, which
is magical. (The pseudo code above doesn't work because it treats
-<ARGV> as non-magical.)
+C<< <ARGV> >> as non-magical.)
Since the null filehandle uses the two argument form of L<perlfunc/open>
it interprets special characters, so if you have a script like this:
print;
}
-and call it with C<perl dangerous.pl 'rm -rfv *|'>, it actually opens a
+and call it with S<C<perl dangerous.pl 'rm -rfv *|'>>, it actually opens a
pipe, executes the C<rm> command and reads C<rm>'s output from that pipe.
If you want all items in C<@ARGV> to be interpreted as file names, you
can use the module C<ARGV::readonly> from CPAN, or use the double bracket:
Using double angle brackets inside of a while causes the open to use the
three argument form (with the second argument being C<< < >>), so all
-arguments in ARGV are treated as literal filenames (including "-").
-(Note that for convenience, if you use C<< <<>> >> and if @ARGV is
+arguments in C<ARGV> are treated as literal filenames (including C<"-">).
+(Note that for convenience, if you use C<< <<>> >> and if C<@ARGV> is
empty, it will still read from the standard input.)
-You can modify @ARGV before the first <> as long as the array ends up
+You can modify C<@ARGV> before the first C<< <> >> as long as the array ends up
containing the list of filenames you really want. Line numbers (C<$.>)
continue as though the input were one big happy file. See the example
in L<perlfunc/eof> for how to reset line numbers on each file.
-If you want to set @ARGV to your own list of files, go right ahead.
-This sets @ARGV to all plain text files if no @ARGV was given:
+If you want to set C<@ARGV> to your own list of files, go right ahead.
+This sets C<@ARGV> to all plain text files if no C<@ARGV> was given:
@ARGV = grep { -f && -T } glob('*') unless @ARGV;
@ARGV = map { /\.(gz|Z)$/ ? "gzip -dc < $_ |" : $_ } @ARGV;
If you want to pass switches into your script, you can use one of the
-Getopts modules or put a loop on the front like this:
+C<Getopts> modules or put a loop on the front like this:
while ($_ = $ARGV[0], /^-/) {
shift;
# ... # code for each line
}
-The <> symbol will return C<undef> for end-of-file only once.
+The C<< <> >> symbol will return C<undef> for end-of-file only once.
If you call it again after this, it will assume you are processing another
-@ARGV list, and if you haven't set @ARGV, will read input from STDIN.
+C<@ARGV> list, and if you haven't set C<@ARGV>, will read input from STDIN.
If what the angle brackets contain is a simple scalar variable (for example,
-<$foo>), then that variable contains the name of the
+C<$foo>), then that variable contains the name of the
filehandle to input from, or its typeglob, or a reference to the
same. For example:
reference, it is interpreted as a filename pattern to be globbed, and
either a list of filenames or the next filename in the list is returned,
depending on context. This distinction is determined on syntactic
-grounds alone. That means C<< <$x> >> is always a readline() from
-an indirect handle, but C<< <$hash{key}> >> is always a glob().
-That's because $x is a simple scalar variable, but C<$hash{key}> is
+grounds alone. That means C<< <$x> >> is always a C<readline()> from
+an indirect handle, but C<< <$hash{key}> >> is always a C<glob()>.
+That's because C<$x> is a simple scalar variable, but C<$hash{key}> is
not--it's a hash element. Even C<< <$x > >> (note the extra space)
is treated as C<glob("$x ")>, not C<readline($x)>.
}
except that the globbing is actually done internally using the standard
-C<File::Glob> extension. Of course, the shortest way to do the above is:
+C<L<File::Glob>> extension. Of course, the shortest way to do the above is:
chmod 0644, <*.c>;
returning false.
If you're trying to do variable interpolation, it's definitely better
-to use the glob() function, because the older notation can cause people
+to use the C<glob()> function, because the older notation can cause people
to become confused with the indirect filehandle notation.
@files = glob("$dir/*.[ch]");
$biz = "$foo" ^ "$bar"; # both ops explicitly stringy
This somewhat unpredictable behavior can be avoided with the experimental
-"bitwise" feature, new in Perl 5.22. You can enable it via C<use feature
-'bitwise'>. By default, it will warn unless the "experimental::bitwise"
-warnings category has been disabled. (C<use experimental 'bitwise'> will
+"bitwise" feature, new in Perl 5.22. You can enable it via S<C<use feature
+'bitwise'>>. By default, it will warn unless the C<"experimental::bitwise">
+warnings category has been disabled. (S<C<use experimental 'bitwise'>> will
enable the feature and disable the warning.) Under this feature, the four
standard bitwise operators (C<~ | & ^>) are always numeric. Adding a dot
after each operator (C<~. |. &. ^.>) forces it to treat its operands as
which lasts until the end of that BLOCK. Note that this doesn't
mean everything is an integer, merely that Perl will use integer
operations for arithmetic, comparison, and bitwise operators. For
-example, even under C<use integer>, if you take the C<sqrt(2)>, you'll
+example, even under S<C<use integer>>, if you take the C<sqrt(2)>, you'll
still get C<1.4142135623731> or so.
-Used on numbers, the bitwise operators ("&", "|", "^", "~", "<<",
-and ">>") always produce integral results. (But see also
-L<Bitwise String Operators>.) However, C<use integer> still has meaning for
+Used on numbers, the bitwise operators (C<&> C<|> C<^> C<~> C<< << >>
+C<< >> >>) always produce integral results. (But see also
+L<Bitwise String Operators>.) However, S<C<use integer>> still has meaning for
them. By default, their results are interpreted as unsigned integers, but
-if C<use integer> is in effect, their results are interpreted
+if S<C<use integer>> is in effect, their results are interpreted
as signed integers. For example, C<~0> usually evaluates to a large
-integral value. However, C<use integer; ~0> is C<-1> on two's-complement
+integral value. However, S<C<use integer; ~0>> is C<-1> on two's-complement
machines.
=head2 Floating-point Arithmetic
X<floating-point> X<floating point> X<float> X<real>
-While C<use integer> provides integer-only arithmetic, there is no
+While S<C<use integer>> provides integer-only arithmetic, there is no
analogous mechanism to provide automatic rounding or truncation to a
certain number of decimal places. For rounding to a certain number
-of digits, sprintf() or printf() is usually the easiest route.
+of digits, C<sprintf()> or C<printf()> is usually the easiest route.
See L<perlfaq4>.
Floating-point numbers are only approximations to what a mathematician
}
The POSIX module (part of the standard perl distribution) implements
-ceil(), floor(), and other mathematical and trigonometric functions.
-The Math::Complex module (part of the standard perl distribution)
+C<ceil()>, C<floor()>, and other mathematical and trigonometric functions.
+The C<L<Math::Complex>> module (part of the standard perl distribution)
defines mathematical functions that work on both the reals and the
-imaginary numbers. Math::Complex not as efficient as POSIX, but
+imaginary numbers. C<Math::Complex> is not as efficient as POSIX, but
POSIX can't work with complex numbers.
Rounding in financial applications can have serious implications, and
=head2 Bigger Numbers
X<number, arbitrary precision>
-The standard C<Math::BigInt>, C<Math::BigRat>, and C<Math::BigFloat> modules,
+The standard C<L<Math::BigInt>>, C<L<Math::BigRat>>, and
+C<L<Math::BigFloat>> modules,
along with the C<bignum>, C<bigint>, and C<bigrat> pragmas, provide
variable-precision arithmetic and overloaded operators, although
they're currently pretty slow. At the cost of some space and
x/y is 9/44
x*y is 1/11
-Several modules let you calculate with (bound only by memory and CPU time)
-unlimited or fixed precision. There
+Several modules let you calculate with unlimited or fixed precision
+(bound only by memory and CPU time). There
are also some non-standard modules that
provide faster implementations via external C libraries.
etc.).
Pod content is contained in B<Pod blocks>. A Pod block starts with a
-line that matches <m/\A=[a-zA-Z]/>, and continues up to the next line
+line that matches C<m/\A=[a-zA-Z]/>, and continues up to the next line
that matches C<m/\A=cut/> or up to the end of the file if there is
no C<m/\A=cut/> line.
B<< $foo->bar(); >>
With this syntax, the whitespace character(s) after the "CE<lt><<"
-and before the ">>" (or whatever letter) are I<not> renderable. They
+and before the ">>>" (or whatever letter) are I<not> renderable. They
do not signify whitespace, are merely part of the formatting codes
themselves. That is, these are all synonymous:
file begins with the two literal byte values 0xFE 0xFF, this is
the BOM for big-endian UTF-16. If the file begins with the two
literal byte value 0xFF 0xFE, this is the BOM for little-endian
-UTF-16. If the file begins with the three literal byte values
+UTF-16. On an ASCII platform, if the file begins with the three literal
+byte values
0xEF 0xBB 0xBF, this is the BOM for UTF-8.
+A mechanism portable to EBCDIC platforms is to:
+
+ my $utf8_bom = "\x{FEFF}";
+ utf8::encode($utf8_bom);
=for comment
use bytes; print map sprintf(" 0x%02X", ord $_), split '', "\x{feff}";
=item *
-A naive but often sufficient heuristic for testing the first highbit
+A naive, but often sufficient heuristic on ASCII platforms, for testing
+the first highbit
byte-sequence in a BOM-less file (whether in code or in Pod!), to see
whether that sequence is valid as UTF-8 (RFC 2279) is to check whether
that the first byte in the sequence is in the range 0xC2 - 0xFD
0x80 - 0xBF. If so, the parser may conclude that this file is in
UTF-8, and all highbit sequences in the file should be assumed to
be UTF-8. Otherwise the parser should treat the file as being
-in CP-1252. (A better check is to pass a copy of the sequence to
+in CP-1252. (A better check, and which works on EBCDIC platforms as
+well, is to pass a copy of the sequence to
L<utf8::decode()|utf8> which performs a full validity check on the
sequence and returns TRUE if it is valid UTF-8, FALSE otherwise. This
function is always pre-loaded, is fast because it is written in C, and
=item *
-This document's requirements and suggestions about encodings
-do not apply to Pod processors running on non-ASCII platforms,
-notably EBCDIC platforms.
-
-=item *
-
Pod processors must treat a "=for [label] [content...]" paragraph as
meaning the same thing as a "=begin [label]" paragraph, content, and
an "=end [label]" paragraph. (The parser may conflate these two
When referring to characters by using a EE<lt>n> numeric code, numbers
in the range 32-126 refer to those well known US-ASCII characters (also
defined there by Unicode, with the same meaning), which all Pod
-formatters must render faithfully. Numbers in the ranges 0-31 and
-127-159 should not be used (neither as literals, nor as EE<lt>number>
-codes), except for the literal byte-sequences for newline (13, 13 10, or
-10), and tab (9).
+formatters must render faithfully. Characters whose EE<lt>E<gt> numbers
+are in the ranges 0-31 and 127-159 should not be used (neither as
+literals,
+nor as EE<lt>number> codes), except for the literal byte-sequences for
+newline (ASCII 13, ASCII 13 10, or ASCII 10), and tab (ASCII 9).
Numbers in the range 160-255 refer to Latin-1 characters (also
defined there by Unicode, with the same meaning). Numbers above
=item *
-Note that in all cases of "EE<lt>whatever>", I<whatever> (whether
+Note that in all cases of "EE<lt>whateverE<gt>", I<whatever> (whether
an htmlname, or a number in any base) must consist only of
alphanumeric characters -- that is, I<whatever> must watch
-C<m/\A\w+\z/>. So "EE<lt> 0 1 2 3 >" is invalid, because
+C<m/\A\w+\z/>. So S<"EE<lt> 0 1 2 3 E<gt>"> is invalid, because
it contains spaces, which aren't alphanumeric characters. This
presumably does not I<need> special treatment by a Pod processor;
-" 0 1 2 3 " doesn't look like a number in any base, so it would
+S<" 0 1 2 3 "> doesn't look like a number in any base, so it would
presumably be looked up in the table of HTML-like names. Since
-there isn't (and cannot be) an HTML-like entity called " 0 1 2 3 ",
+there isn't (and cannot be) an HTML-like entity called S<" 0 1 2 3 ">,
this will be treated as an error. However, Pod processors may
-treat "EE<lt> 0 1 2 3 >" or "EE<lt>e-acute>" as I<syntactically>
+treat S<"EE<lt> 0 1 2 3 E<gt>"> or "EE<lt>e-acute>" as I<syntactically>
invalid, potentially earning a different error message than the
error message (or warning, or event) generated by a merely unknown
(but theoretically valid) htmlname, as in "EE<lt>qacute>"
=item First:
-The link-text. If there is none, this must be undef. (E.g., in
+The link-text. If there is none, this must be C<undef>. (E.g., in
"LE<lt>Perl Functions|perlfunc>", the link-text is "Perl Functions".
In "LE<lt>Time::HiRes>" and even "LE<lt>|Time::HiRes>", there is no
link text. Note that link text may contain formatting.)
=item Third:
-The name or URL, or undef if none. (E.g., in "LE<lt>Perl
+The name or URL, or C<undef> if none. (E.g., in "LE<lt>Perl
Functions|perlfunc>", the name (also sometimes called the page)
-is "perlfunc". In "LE<lt>/CAVEATS>", the name is undef.)
+is "perlfunc". In "LE<lt>/CAVEATS>", the name is C<undef>.)
=item Fourth:
-The section (AKA "item" in older perlpods), or undef if none. E.g.,
+The section (AKA "item" in older perlpods), or C<undef> if none. E.g.,
in "LE<lt>Getopt::Std/DESCRIPTIONE<gt>", "DESCRIPTION" is the section. (Note
that this is not the same as a manpage section like the "5" in "man 5
crontab". "Section Foo" in the Pod sense means the part of the text
=item *
-We "officially" support the two most recent stable release series. 5.14.x
-and earlier are now out of support. As of the release of 5.20.0, we will
-"officially" end support for Perl 5.16.x, other than providing security
+We "officially" support the two most recent stable release series. 5.16.x
+and earlier are now out of support. As of the release of 5.22.0, we will
+"officially" end support for Perl 5.18.x, other than providing security
updates as described below.
=item *
particular task. Thus, when you begin attacking a problem, it is
important to consider under which part of the tradeoff curve you
want to operate. Specifically, you must decide whether it is
-important that the task that you are coding have the full generality
+important that the task that you are coding has the full generality
of being portable, or whether to just get the job done right now.
This is the hardest choice to be made. The rest is easy, because
Perl provides many choices, whichever way you want to approach your
The material below is separated into three main sections: main issues of
portability (L<"ISSUES">), platform-specific issues (L<"PLATFORMS">), and
-built-in perl functions that behave differently on various ports
+built-in Perl functions that behave differently on various ports
(L<"FUNCTION IMPLEMENTATIONS">).
This information should not be considered complete; it includes possibly
In most operating systems, lines in files are terminated by newlines.
Just what is used as a newline may vary from OS to OS. Unix
traditionally uses C<\012>, one type of DOSish I/O uses C<\015\012>,
-and S<Mac OS> uses C<\015>.
+S<Mac OS> uses C<\015>, and z/OS uses C<\025>.
Perl uses C<\n> to represent the "logical" newline, where what is
logical may depend on the platform in use. In MacPerl, C<\n> always
reading or writing. Unix does the same thing on ttys in canonical
mode. C<\015\012> is commonly referred to as CRLF.
-To trim trailing newlines from text lines use chomp(). With default
-settings that function looks for a trailing C<\n> character and thus
+To trim trailing newlines from text lines use C<chomp()>. With default
+settings that function looks for a trailing C<\n> character and thus
trims in a portable way.
When dealing with binary files (or text files in binary mode) be sure
to explicitly set $/ to the appropriate value for your file format
-before using chomp().
+before using C<chomp()>.
Because of the "text" mode translation, DOSish perls have limitations
in using C<seek> and C<tell> on a file accessed in "text" mode.
others), and you are usually free to use C<seek> and C<tell> even
in "text" mode. Using C<seek> or C<tell> or other file operations
may be non-portable. If you use C<binmode> on a file, however, you
-can usually C<seek> and C<tell> with arbitrary values in safety.
+can usually C<seek> and C<tell> with arbitrary values safely.
-A common misconception in socket programming is that C<\n> eq C<\012>
+A common misconception in socket programming is that S<C<\n eq \012>>
everywhere. When using protocols such as common Internet protocols,
C<\012> and C<\015> are called for specifically, and the values of
the logical C<\n> and C<\r> (carriage return) are not reliable.
However, using C<\015\012> (or C<\cM\cJ>, or C<\x0D\x0A>) can be tedious
and unsightly, as well as confusing to those maintaining the code. As
-such, the Socket module supplies the Right Thing for those who want it.
+such, the C<Socket> module supplies the Right Thing for those who want it.
use Socket qw(:DEFAULT :crlf);
print SOCKET "Hi there, client!$CRLF" # RIGHT
separator C<$/> is C<\n>, but robust socket code will recognize as
either C<\012> or C<\015\012> as end of line:
- while (<SOCKET>) {
+ while (<SOCKET>) { # NOT ADVISABLE!
# ...
}
usually either "live" via network connection, or by storing the
numbers to secondary storage such as a disk file or tape.
-Conflicting storage orders make utter mess out of the numbers. If a
+Conflicting storage orders make an utter mess out of the numbers. If a
little-endian host (Intel, VAX) stores 0x12345678 (305419896 in
decimal), a big-endian host (Motorola, Sparc, PA) reads it as
0x78563412 (2018915346 in decimal). Alpha and MIPS can be either:
connections use the C<pack> and C<unpack> formats C<n> and C<N>, the
"network" orders. These are guaranteed to be portable.
-As of perl 5.10.0, you can also use the C<E<gt>> and C<E<lt>> modifiers
+As of Perl 5.10.0, you can also use the C<E<gt>> and C<E<lt>> modifiers
to force big- or little-endian byte-order. This is useful if you want
to store signed integers or 64-bit integers, for example.
One can circumnavigate both these problems in two ways. Either
transfer and store numbers always in text format, instead of raw
-binary, or else consider using modules like Data::Dumper and Storable
-(included as of perl 5.8). Keeping all data as text significantly
+binary, or else consider using modules like C<Data::Dumper> and
+C<Storable>
+(included as of Perl 5.8). Keeping all data as text significantly
simplifies matters.
-The v-strings are portable only up to v2147483647 (0x7FFFFFFF), that's
+The v-strings are portable only up to v2147483647 (0x7FFF_FFFF), that's
how far EBCDIC, or more precisely UTF-EBCDIC will go.
=head2 Files and Filesystems
Don't assume Unix filesystem access semantics: that read, write,
and execute are all the permissions there are, and even if they exist,
-that their semantics (for example what do r, w, and x mean on
+that their semantics (for example what do C<"r">, C<"w">, and C<"x"> mean on
a directory) are the Unix ones. The various Unix/POSIX compatibility
-layers usually try to make interfaces like chmod() work, but sometimes
+layers usually try to make interfaces like C<chmod()> work, but sometimes
there simply is no good mapping.
If all this is intimidating, have no (well, maybe only a little)
-fear. There are modules that can help. The File::Spec modules
+fear. There are modules that can help. The C<File::Spec> modules
provide methods to do the Right Thing on whatever platform happens
to be running the program.
# on Mac OS Classic, ':temp:file.txt'
# on VMS, '[.temp]file.txt'
-File::Spec is available in the standard distribution as of version
-5.004_05. File::Spec::Functions is only in File::Spec 0.7 and later,
-and some versions of perl come with version 0.6. If File::Spec
+C<File::Spec> is available in the standard distribution as of version
+5.004_05. C<File::Spec::Functions> is only in C<File::Spec> 0.7 and later,
+and some versions of Perl come with version 0.6. If C<File::Spec>
is not updated to 0.7 or later, you must use the object-oriented
-interface from File::Spec (or upgrade File::Spec).
+interface from C<File::Spec> (or upgrade C<File::Spec>).
In general, production code should not have file paths hardcoded.
Making them user-supplied or read from a configuration file is
This is especially noticeable in scripts like Makefiles and test suites,
which often assume C</> as a path separator for subdirectories.
-Also of use is File::Basename from the standard distribution, which
+Also of use is C<File::Basename> from the standard distribution, which
splits a pathname into pieces (base filename, full path to directory,
and file suffix).
F</etc/sendmail.conf>, F</etc/resolv.conf>, or even F</tmp/>. For
example, F</etc/passwd> may exist but not contain the encrypted
passwords, because the system is using some form of enhanced security.
-Or it may not contain all the accounts, because the system is using NIS.
+Or it may not contain all the accounts, because the system is using NIS.
If code does need to rely on such a file, include a description of the
file and its format in the code's documentation, then make it easy for
the user to override the default location of the file.
keep them to the 8.3 convention, for maximum portability, onerous a
burden though this may appear.
-Likewise, when using the AutoSplit module, try to keep your functions to
+Likewise, when using the C<AutoSplit> module, try to keep your functions to
8.3 naming and case-insensitive conventions; or, at the least,
make it so the resulting files have a unique (case-insensitively)
first 8 characters.
Don't assume C<< > >> won't be the first character of a filename.
Always use C<< < >> explicitly to open a file for reading, or even
-better, use the three-arg version of open, unless you want the user to
+better, use the three-arg version of C<open>, unless you want the user to
be able to specify a pipe open.
open my $fh, '<', $existing_file) or die $!;
Don't assume that in pathnames you can collapse two leading slashes
C<//> into one: some networking and clustering filesystems have special
-semantics for that. Let the operating system to sort it out.
+semantics for that. Let the operating system sort it out.
The I<portable filename characters> as defined by ANSI C are
0 1 2 3 4 5 6 7 8 9
. _ -
-and the "-" shouldn't be the first character. If you want to be
+and the C<"-"> shouldn't be the first character. If you want to be
hypercorrect, stay case-insensitive and within the 8.3 naming
convention (all the files and directories have to be unique within one
directory if their names are lowercased and truncated to eight
Don't assume that a single C<unlink> completely gets rid of the file:
some filesystems (most notably the ones in VMS) have versioned
-filesystems, and unlink() removes only the most recent one (it doesn't
+filesystems, and C<unlink()> removes only the most recent one (it doesn't
remove all the versions because by default the native tools on those
platforms remove just the most recent version, too). The portable
idiom to remove all the versions of a file is
Don't count on a specific environment variable existing in C<%ENV>.
Don't count on C<%ENV> entries being case-sensitive, or even
-case-preserving. Don't try to clear %ENV by saying C<%ENV = ();>, or,
+case-preserving. Don't try to clear C<%ENV> by saying C<%ENV = ();>, or,
if you really have to, make it conditional on C<$^O ne 'VMS'> since in
VMS the C<%ENV> table is much more than a per-process key-value string
table.
-On VMS, some entries in the %ENV hash are dynamically created when
+On VMS, some entries in the C<%ENV> hash are dynamically created when
their key is used on a read if they did not previously exist. The
-values for C<$ENV{HOME}>, C<$ENV{TERM}>, C<$ENV{HOME}>, and C<$ENV{USER}>,
+values for C<$ENV{HOME}>, C<$ENV{TERM}>, C<$ENV{PATH}>, and C<$ENV{USER}>,
are known to be dynamically generated. The specific names that are
dynamically generated may vary with the version of the C library on VMS,
-and more may exist than is documented.
+and more may exist than are documented.
-On VMS by default, changes to the %ENV hash are persistent after the process
-exits. This can cause unintended issues.
+On VMS by default, changes to the %ENV hash persist after perl exits.
+Subsequent invocations of perl in the same process can inadvertently
+inherit environment settings that were meant to be temporary.
Don't count on signals or C<%SIG> for anything.
directories.
Don't count on specific values of C<$!>, neither numeric nor
-especially the strings values. Users may switch their locales causing
+especially the string values. Users may switch their locales causing
error messages to be translated into their languages. If you can
trust a POSIXish environment, you can portably use the symbols defined
-by the Errno module, like ENOENT. And don't trust on the values of C<$!>
+by the C<Errno> module, like C<ENOENT>. And don't trust on the values of C<$!>
at all except immediately after a failed system call.
=head2 Command names versus file pathnames
corresponding file. Second, some operating systems (e.g., Cygwin,
DJGPP, OS/2, and VOS) have required suffixes for executable files;
these suffixes are generally permitted on the command name but are not
-required. Thus, a command like "perl" might exist in a file named
-"perl", "perl.exe", or "perl.pm", depending on the operating system.
-The variable "_exe" in the Config module holds the executable suffix,
-if any. Third, the VMS port carefully sets up $^X and
-$Config{perlpath} so that no further processing is required. This is
+required. Thus, a command like F<"perl"> might exist in a file named
+F<"perl">, F<"perl.exe">, or F<"perl.pm">, depending on the operating system.
+The variable C<"_exe"> in the C<Config> module holds the executable suffix,
+if any. Third, the VMS port carefully sets up C<$^X> and
+C<$Config{perlpath}> so that no further processing is required. This is
just as well, because the matching regular expression used below would
then have to deal with a possible trailing version number in the VMS
file name.
-To convert $^X to a file pathname, taking account of the requirements
+To convert C<$^X> to a file pathname, taking account of the requirements
of the various operating system possibilities, say:
use Config;
if ($^O ne 'VMS')
{$thisperl .= $Config{_exe} unless $thisperl =~ m/$Config{_exe}$/i;}
-To convert $Config{perlpath} to a file pathname, say:
+To convert C<$Config{perlpath}> to a file pathname, say:
use Config;
my $thisperl = $Config{perlpath};
Don't assume a particular network device name.
-Don't assume a particular set of ioctl()s will work.
+Don't assume a particular set of C<ioctl()>s will work.
Don't assume that you can ping hosts and get replies.
Don't assume that any particular port (service) will respond.
-Don't assume that Sys::Hostname (or any other API or command) returns
+Don't assume that C<Sys::Hostname> (or any other API or command) returns
either a fully qualified hostname or a non-qualified hostname: it all
depends on how the system had been configured. Also remember that for
things such as DHCP and NAT, the hostname you get back might not be
In general, don't directly access the system in code meant to be
portable. That means, no C<system>, C<exec>, C<fork>, C<pipe>,
C<``>, C<qx//>, C<open> with a C<|>, nor any of the other things
-that makes being a perl hacker worth being.
+that makes being a Perl hacker worth being.
Commands that launch external processes are generally supported on
most platforms (though many of them do not support any type of
available. But it is not fine for many non-Unix systems, and even
some Unix systems that may not have sendmail installed. If a portable
solution is needed, see the various distributions on CPAN that deal
-with it. Mail::Mailer and Mail::Send in the MailTools distribution are
-commonly used, and provide several mailing methods, including mail,
-sendmail, and direct SMTP (via Net::SMTP) if a mail transfer agent is
-not available. Mail::Sendmail is a standalone module that provides
+with it. C<Mail::Mailer> and C<Mail::Send> in the C<MailTools> distribution are
+commonly used, and provide several mailing methods, including C<mail>,
+C<sendmail>, and direct SMTP (via C<Net::SMTP>) if a mail transfer agent is
+not available. C<Mail::Sendmail> is a standalone module that provides
simple, platform-independent mailing.
The Unix System V IPC (C<msg*(), sem*(), shm*()>) is not available
both forms just pack the four bytes into network order. That this
would be equal to the C language C<in_addr> struct (which is what the
socket code internally uses) is not guaranteed. To be portable use
-the routines of the Socket extension, such as C<inet_aton()>,
+the routines of the C<Socket> extension, such as C<inet_aton()>,
C<inet_ntoa()>, and C<sockaddr_in()>.
The rule of thumb for portable code is: Do it all in portable Perl, or
use a module (that may internally implement it with platform-specific
-code, but expose a common interface).
+code, but exposes a common interface).
=head2 External Subroutines (XS)
=head2 Standard Modules
In general, the standard modules work across platforms. Notable
-exceptions are the CPAN module (which currently makes connections to external
+exceptions are the C<CPAN> module (which currently makes connections to external
programs that may not be available), platform-specific modules (like
-ExtUtils::MM_VMS), and DBM modules.
+C<ExtUtils::MM_VMS>), and DBM modules.
There is no one DBM module available on all platforms.
-SDBM_File and the others are generally available on all Unix and DOSish
-ports, but not in MacPerl, where only NBDM_File and DB_File are
+C<SDBM_File> and the others are generally available on all Unix and DOSish
+ports, but not in MacPerl, where only C<NDBM_File> and C<DB_File> are
available.
The good news is that at least some DBM module should be available, and
-AnyDBM_File will use whichever module it can find. Of course, then
+C<AnyDBM_File> will use whichever module it can find. Of course, then
the code needs to be fairly strict, dropping to the greatest common
factor (e.g., not exceeding 1K for each record), so that it will
work with any DBM module. See L<AnyDBM_File> for more details.
Please do use the ISO 8601 instead of making us guess what
date 02/03/04 might be. ISO 8601 even sorts nicely as-is.
A text representation (like "1987-12-18") can be easily converted
-into an OS-specific value using a module like Date::Parse.
+into an OS-specific value using a module like C<Date::Parse>.
An array of values, such as those returned by C<localtime>, can be
-converted to an OS-specific representation using Time::Local.
+converted to an OS-specific representation using C<Time::Local>.
When calculating specific times, such as for tests in time or date modules,
it may be appropriate to calculate an offset for the epoch.
Do not use explicit code point ranges (like C<\xHH-\xHH)>. However,
starting in Perl v5.22, regular expression pattern bracketed character
class ranges specified like C<qr/[\N{U+HH}-\N{U+HH}]/> are portable.
-You can portably use, for example, symbolic character classes like
-C<[:print:]>.
+You can portably use symbolic character classes like C<[:print:]>.
Do not assume that the alphabetic characters are encoded contiguously
(in the numeric sense). There may be gaps. Special coding in Perl,
however, guarantees that all subsets of C<qr/[A-Z]/>, C<qr/[a-z]/>, and
-C<qr/[0-9]/> behave as expected.
+C<qr/[0-9]/> behave as expected. C<tr///> behaves the same for these
+ranges. In patterns, any ranges specified with end points using the
+C<\N{...}> notations ensures character set portability, but it is a bug
+in Perl v5.22, that this isn't true of C<tr///>.
Do not assume anything about the ordering of the characters.
The lowercase letters may come before or after the uppercase letters;
the lowercase and uppercase may be interlaced so that both "a" and "A"
come before "b"; the accented and other international characters may
be interlaced so that E<auml> comes before "b".
+L<Unicode::Collate> can be used to sort this all out.
=head2 Internationalisation
The last two constructs may appear unintuitive to most people. The
first repeatedly grows a string, whereas the second allocates a
large chunk of memory in one go. On some systems, the second is
-more efficient that the first.
+more efficient than the first.
=head2 Security
Don't assume the Unix filesystem access semantics: the operating
system or the filesystem may be using some ACL systems, which are
-richer languages than the usual rwx. Even if the rwx exist,
+richer languages than the usual C<rwx>. Even if the C<rwx> exist,
their semantics might be different.
-(From security viewpoint testing for permissions before attempting to
+(From the security viewpoint, testing for permissions before attempting to
do something is silly anyway: if one tries this, there is potential
for race conditions. Someone or something might change the
permissions between the permissions check and the actual operation.
Just try the operation.)
Don't assume the Unix user and group semantics: especially, don't
-expect the C<< $< >> and C<< $> >> (or the C<$(> and C<$)>) to work
+expect C<< $< >> and C<< $> >> (or C<$(> and C<$)>) to work
for switching identities (or memberships).
Don't assume set-uid and set-gid semantics. (And even if you do,
For those times when it is necessary to have platform-specific code,
consider keeping the platform-specific code in one place, making porting
-to other platforms easier. Use the Config module and the special
+to other platforms easier. Use the C<Config> module and the special
variable C<$^O> to differentiate platforms, as described in
L<"PLATFORMS">.
assume certain things about the filesystem and paths. Be careful not
to depend on a specific output style for errors, such as when checking
C<$!> after a failed system call. Using C<$!> for anything else than
-displaying it as output is doubtful (though see the Errno module for
+displaying it as output is doubtful (though see the C<Errno> module for
testing reasonably portably for error value). Some platforms expect
a certain output format, and Perl on those platforms may have been
adjusted accordingly. Most specifically, don't anchor a regex when
The various MSWin32 Perl's can distinguish the OS they are running on
via the value of the fifth element of the list returned from
-Win32::GetOSVersion(). For example:
+C<Win32::GetOSVersion()>. For example:
if ($^O eq 'MSWin32') {
my @os_version_info = Win32::GetOSVersion();
print +('3.1','95','NT')[$os_version_info[4]],"\n";
}
-There are also Win32::IsWinNT() and Win32::IsWin95(), try C<perldoc Win32>,
+There are also C<Win32::IsWinNT()> and C<Win32::IsWin95()>; try C<perldoc Win32>,
and as of libwin32 0.19 (not part of the core Perl distribution)
-Win32::GetOSName(). The very portable POSIX::uname() will work too:
+C<Win32::GetOSName()>. The very portable C<POSIX::uname()> will work too:
c:\> perl -MPOSIX -we "print join '|', uname"
Windows NT|moonru|5.0|Build 2195 (Service Pack 2)|x86
=head2 VMS
-Perl on VMS is discussed in L<perlvms> in the perl distribution.
+Perl on VMS is discussed in L<perlvms> in the Perl distribution.
The official name of VMS as of this writing is OpenVMS.
-Perl on VMS can accept either VMS- or Unix-style file
-specifications as in either of the following:
-
- $ perl -ne "print if /perl_setup/i" SYS$LOGIN:LOGIN.COM
- $ perl -ne "print if /perl_setup/i" /sys$login/login.com
-
-but not a mixture of both as in:
-
- $ perl -ne "print if /perl_setup/i" sys$login:/login.com
- Can't open sys$login:/login.com: file specification syntax error
-
Interacting with Perl from the Digital Command Language (DCL) shell
often requires a different set of quotation marks than Unix shells do.
For example:
$ perl -e "print ""Hello, world.\n"""
Hello, world.
-There are several ways to wrap your perl scripts in DCL F<.COM> files, if
+There are several ways to wrap your Perl scripts in DCL F<.COM> files, if
you are so inclined. For example:
$ write sys$output "Hello from DCL!"
$ endif
Do take care with C<$ ASSIGN/nolog/user SYS$COMMAND: SYS$INPUT> if your
-perl-in-DCL script expects to do things like C<< $read = <STDIN>; >>.
-
-The VMS operating system has two filesystems, known as ODS-2 and ODS-5.
-
-For ODS-2, filenames are in the format "name.extension;version". The
-maximum length for filenames is 39 characters, and the maximum length for
-extensions is also 39 characters. Version is a number from 1 to
-32767. Valid characters are C</[A-Z0-9$_-]/>.
-
-The ODS-2 filesystem is case-insensitive and does not preserve case.
-Perl simulates this by converting all filenames to lowercase internally.
-
-For ODS-5, filenames may have almost any character in them and can include
-Unicode characters. Characters that could be misinterpreted by the DCL
-shell or file parsing utilities need to be prefixed with the C<^>
-character, or replaced with hexadecimal characters prefixed with the
-C<^> character. Such prefixing is only needed with the pathnames are
-in VMS format in applications. Programs that can accept the Unix format
-of pathnames do not need the escape characters. The maximum length for
-filenames is 255 characters. The ODS-5 file system can handle both
-a case preserved and a case sensitive mode.
-
-ODS-5 is only available on the OpenVMS for 64 bit platforms.
-
-Support for the extended file specifications is being done as optional
-settings to preserve backward compatibility with Perl scripts that
-assume the previous VMS limitations.
-
-In general routines on VMS that get a Unix format file specification
-should return it in a Unix format, and when they get a VMS format
-specification they should return a VMS format unless they are documented
-to do a conversion.
-
-For routines that generate return a file specification, VMS allows setting
-if the C library which Perl is built on if it will be returned in VMS
-format or in Unix format.
-
-With the ODS-2 file system, there is not much difference in syntax of
-filenames without paths for VMS or Unix. With the extended character
-set available with ODS-5 there can be a significant difference.
-
-Because of this, existing Perl scripts written for VMS were sometimes
-treating VMS and Unix filenames interchangeably. Without the extended
-character set enabled, this behavior will mostly be maintained for
-backwards compatibility.
-
-When extended characters are enabled with ODS-5, the handling of
-Unix formatted file specifications is to that of a Unix system.
-
-VMS file specifications without extensions have a trailing dot. An
-equivalent Unix file specification should not show the trailing dot.
+Perl-in-DCL script expects to do things like C<< $read = <STDIN>; >>.
-The result of all of this, is that for VMS, for portable scripts, you
-can not depend on Perl to present the filenames in lowercase, to be
-case sensitive, and that the filenames could be returned in either
-Unix or VMS format.
+The VMS operating system has two filesystems, designated by their
+on-disk structure (ODS) level: ODS-2 and its successor ODS-5. The
+initial port of Perl to VMS pre-dates ODS-5, but all current testing and
+development assumes ODS-5 and its capabilities, including case
+preservation, extended characters in filespecs, and names up to 8192
+bytes long.
-And if a routine returns a file specification, unless it is intended to
-convert it, it should return it in the same format as it found it.
-
-C<readdir> by default has traditionally returned lowercased filenames.
-When the ODS-5 support is enabled, it will return the exact case of the
-filename on the disk.
-
-Files without extensions have a trailing period on them, so doing a
-C<readdir> in the default mode with a file named F<A.;5> will
-return F<a.> when VMS is (though that file could be opened with
-C<open(FH, 'A')>).
-
-With support for extended file specifications and if C<opendir> was
-given a Unix format directory, a file named F<A.;5> will return F<a>
-and optionally in the exact case on the disk. When C<opendir> is given
-a VMS format directory, then C<readdir> should return F<a.>, and
-again with the optionally the exact case.
-
-RMS had an eight level limit on directory depths from any rooted logical
-(allowing 16 levels overall) prior to VMS 7.2, and even with versions of
-VMS on VAX up through 7.3. Hence C<PERL_ROOT:[LIB.2.3.4.5.6.7.8]> is a
-valid directory specification but C<PERL_ROOT:[LIB.2.3.4.5.6.7.8.9]> is
-not. F<Makefile.PL> authors might have to take this into account, but at
-least they can refer to the former as C</PERL_ROOT/lib/2/3/4/5/6/7/8/>.
+Perl on VMS can accept either VMS- or Unix-style file
+specifications as in either of the following:
-Pumpkings and module integrators can easily see whether files with too many
-directory levels have snuck into the core by running the following in the
-top-level source directory:
+ $ perl -ne "print if /perl_setup/i" SYS$LOGIN:LOGIN.COM
+ $ perl -ne "print if /perl_setup/i" /sys$login/login.com
- $ perl -ne "$_=~s/\s+.*//; print if scalar(split /\//) > 8;" < MANIFEST
+but not a mixture of both as in:
+ $ perl -ne "print if /perl_setup/i" sys$login:/login.com
+ Can't open sys$login:/login.com: file specification syntax error
-The VMS::Filespec module, which gets installed as part of the build
-process on VMS, is a pure Perl module that can easily be installed on
-non-VMS platforms and can be helpful for conversions to and from RMS
-native formats. It is also now the only way that you should check to
-see if VMS is in a case sensitive mode.
+In general, the easiest path to portability is always to specify
+filenames in Unix format unless they will need to be processed by native
+commands or utilities. Because of this latter consideration, the
+File::Spec module by default returns native format specifications
+regardless of input format. This default may be reversed so that
+filenames are always reported in Unix format by specifying the
+C<DECC$FILENAME_UNIX_REPORT> feature logical in the environment.
+
+The file type, or extension, is always present in a VMS-format file
+specification even if it's zero-length. This means that, by default,
+C<readdir> will return a trailing dot on a file with no extension, so
+where you would see C<"a"> on Unix you'll see C<"a."> on VMS. However,
+the trailing dot may be suppressed by enabling the
+C<DECC$READDIR_DROPDOTNOTYPE> feature in the environment (see the CRTL
+documentation on feature logical names).
What C<\n> represents depends on the type of file opened. It usually
represents C<\012> but it could also be C<\015>, C<\012>, C<\015\012>,
C<\000>, C<\040>, or nothing depending on the file organization and
-record format. The VMS::Stdio module provides access to the
-special fopen() requirements of files with unusual attributes on VMS.
-
-TCP/IP stacks are optional on VMS, so socket routines might not be
-implemented. UDP sockets may not be supported.
-
-The TCP/IP library support for all current versions of VMS is dynamically
-loaded if present, so even if the routines are configured, they may
-return a status indicating that they are not implemented.
+record format. The C<VMS::Stdio> module provides access to the
+special C<fopen()> requirements of files with unusual attributes on VMS.
The value of C<$^O> on OpenVMS is "VMS". To determine the architecture
-that you are running on without resorting to loading all of C<%Config>
-you can examine the content of the C<@INC> array like so:
-
- if (grep(/VMS_AXP/, @INC)) {
- print "I'm on Alpha!\n";
-
- } elsif (grep(/VMS_VAX/, @INC)) {
- print "I'm on VAX!\n";
-
- } elsif (grep(/VMS_IA64/, @INC)) {
- print "I'm on IA64!\n";
-
- } else {
- print "I'm not so sure about where $^O is...\n";
- }
-
-In general, the significant differences should only be if Perl is running
-on VMS_VAX or one of the 64 bit OpenVMS platforms.
+that you are running on refer to C<$Config{'archname'}>.
On VMS, perl determines the UTC offset from the C<SYS$TIMEZONE_DIFFERENTIAL>
logical name. Although the VMS epoch began at 17-NOV-1858 00:00:00.00,
vmsperl on the web, L<http://www.sidhe.org/vmsperl/index.html>
+=item *
+
+VMS Software Inc. web site, L<http://www.vmssoftware.com>
+
=back
=head2 VOS
Perl on VOS (also known as OpenVOS) is discussed in F<README.vos>
-in the perl distribution (installed as L<perlvos>). Perl on VOS
+in the Perl distribution (installed as L<perlvos>). Perl on VOS
can accept either VOS- or Unix-style file specifications as in
either of the following:
The value of C<$^O> on VOS is "vos". To determine the
architecture that you are running on without resorting to loading
-all of C<%Config> you can examine the content of the @INC array
+all of C<%Config> you can examine the content of the C<@INC> array
like so:
if ($^O =~ /vos/) {
Character Code Set ID 0037 for OS/400 and either 1047 or POSIX-BC for S/390
systems). On the mainframe perl currently works under the "Unix system
services for OS/390" (formerly known as OpenEdition), VM/ESA OpenEdition, or
-the BS200 POSIX-BC system (BS2000 is supported in perl 5.6 and greater).
+the BS200 POSIX-BC system (BS2000 is supported in Perl 5.6 and greater).
See L<perlos390> for details. Note that for OS/400 there is also a port of
Perl 5.8.1/5.10.0 or later to the PASE which is ASCII-based (as opposed to
ILE which is EBCDIC-based), see L<perlos400>.
As of R2.5 of USS for OS/390 and Version 2.3 of VM/ESA these Unix
sub-systems do not support the C<#!> shebang trick for script invocation.
-Hence, on OS/390 and VM/ESA perl scripts can be executed with a header
+Hence, on OS/390 and VM/ESA Perl scripts can be executed with a header
similar to the following simple script:
: # use perl
S/390 systems.
On the AS/400, if PERL5 is in your library list, you may need
-to wrap your perl scripts in a CL procedure to invoke them like so:
+to wrap your Perl scripts in a CL procedure to invoke them like so:
BEGIN
CALL PGM(PERL5/PERL) PARM('/QOpenSys/hello.pl')
ENDPGM
-This will invoke the perl script F<hello.pl> in the root of the
+This will invoke the Perl script F<hello.pl> in the root of the
QOpenSys file system. On the AS/400 calls to C<system> or backticks
must use CL syntax.
On these platforms, bear in mind that the EBCDIC character set may have
-an effect on what happens with some perl functions (such as C<chr>,
+an effect on what happens with some Perl functions (such as C<chr>,
C<pack>, C<print>, C<printf>, C<ord>, C<sort>, C<sprintf>, C<unpack>), as
well as bit-fiddling with ASCII constants using operators like C<^>, C<&>
and C<|>, not to mention dealing with socket interfaces to ASCII computers
Fortunately, most web servers for the mainframe will correctly
translate the C<\n> in the following statement to its ASCII equivalent
-(C<\r> is the same under both Unix and OS/390):
+(C<\r> is the same under both Unix and z/OS):
print "Content-type: text/html\r\n\r\n";
=item *
-L<perlos390>, F<README.os390>, F<perlbs2000>, L<perlebcdic>.
+L<perlos390>, L<perlos400>, F<perlbs2000>, L<perlebcdic>.
=item *
Be aware, moreover, that even among Unix-ish systems there are variations.
For many functions, you can also query C<%Config>, exported by
-default from the Config module. For example, to check whether the
+default from the C<Config> module. For example, to check whether the
platform has the C<lstat> call, check C<$Config{d_lstat}>. See
L<Config> for a full description of available variables.
The actual permissions set depend on the value of the C<CYGWIN>
in the SYSTEM environment settings. (Cygwin)
-Setting the exec bit on some locations (generally /sdcard) will return true
+Setting the exec bit on some locations (generally F</sdcard>) will return true
but not actually set the bit. (Android)
=item chown
=item exec
C<exec LIST> without the use of indirect object syntax (C<exec PROGRAM LIST>)
-may fall back to trying the shell if the first spawn() fails. (Win32)
+may fall back to trying the shell if the first C<spawn()> fails. (Win32)
Does not automatically flush output handles on some platforms.
(SunOS, Solaris, HP-UX)
=item exit
-Emulates Unix exit() (which considers C<exit 1> to indicate an error) by
-mapping the C<1> to SS$_ABORT (C<44>). This behavior may be overridden
-with the pragma C<use vmsish 'exit'>. As with the CRTL's exit()
-function, C<exit 0> is also mapped to an exit status of SS$_NORMAL
-(C<1>); this mapping cannot be overridden. Any other argument to exit()
+Emulates Unix C<exit()> (which considers C<exit 1> to indicate an error) by
+mapping the C<1> to C<SS$_ABORT> (C<44>). This behavior may be overridden
+with the pragma C<use vmsish 'exit'>. As with the CRTL's C<exit()>
+function, C<exit 0> is also mapped to an exit status of C<SS$_NORMAL>
+(C<1>); this mapping cannot be overridden. Any other argument to
+C<exit()>
is used directly as Perl's exit status. On VMS, unless the future
POSIX_EXIT mode is enabled, the exit code should always be a valid
VMS exit code and not a generic number. When the POSIX_EXIT mode is
=item glob
-This operator is implemented via the File::Glob extension on most
+This operator is implemented via the C<File::Glob> extension on most
platforms. See L<File::Glob> for portability information.
=item gmtime
-In theory, gmtime() is reliable from -2**63 to 2**63-1. However,
+In theory, C<gmtime()> is reliable from -2**63 to 2**63-1. However,
because work arounds in the implementation use floating point numbers,
it will become inaccurate as the time gets larger. This is a bug and
will be fixed in the future.
Not implemented. (VMS)
-Available only for socket handles, and it does what the ioctlsocket() call
+Available only for socket handles, and it does what the C<ioctlsocket()> call
in the Winsock API does. (Win32)
Available only for socket handles. (S<RISC OS>)
C<kill()> doesn't have the semantics of C<raise()>, i.e. it doesn't send
a signal to the identified process like it does on Unix platforms.
-Instead C<kill($sig, $pid)> terminates the process identified by $pid,
+Instead C<kill($sig, $pid)> terminates the process identified by C<$pid>,
and makes it exit immediately with exit status $sig. As in Unix, if
$sig is 0 and the specified process exists, it returns true without
actually terminating it. (Win32)
-C<kill(-9, $pid)> will terminate the process specified by $pid and
+C<kill(-9, $pid)> will terminate the process specified by C<$pid> and
recursively all child processes owned by it. This is different from
the Unix semantics, where the signal will be delivered to all
processes in the same process group as the process specified by
=item rewinddir
-Will not cause readdir() to re-read the directory stream. The entries
-already read before the rewinddir() call will just be returned again
+Will not cause C<readdir()> to re-read the directory stream. The entries
+already read before the C<rewinddir()> call will just be returned again
from a cache buffer. (Win32)
=item select
=item sleep
Emulated using synchronization functions such that it can be
-interrupted by alarm(), and limited to a maximum of 4294967 seconds,
+interrupted by C<alarm()>, and limited to a maximum of 4294967 seconds,
approximately 49 days. (Win32)
=item sockatmark
dev, rdev, blksize, and blocks are not available. inode is not
meaningful and will differ between stat calls on the same file. (os2)
-some versions of cygwin when doing a stat("foo") and if not finding it
-may then attempt to stat("foo.exe") (Cygwin)
+some versions of cygwin when doing a C<stat("foo")> and if not finding it
+may then attempt to C<stat("foo.exe")> (Cygwin)
-On Win32 stat() needs to open the file to determine the link count
+On Win32 C<stat()> needs to open the file to determine the link count
and update attributes that may have been changed through hard links.
-Setting ${^WIN32_SLOPPY_STAT} to a true value speeds up stat() by
+Setting C<${^WIN32_SLOPPY_STAT}> to a true value speeds up C<stat()> by
not performing this operation. (Win32)
=item symlink
C<$ENV{PERL5SHELL}>. C<system(1, @args)> spawns an external
process and immediately returns its process designator, without
waiting for it to terminate. Return value may be used subsequently
-in C<wait> or C<waitpid>. Failure to spawn() a subprocess is indicated
-by setting $? to "255 << 8". C<$?> is set in a way compatible with
-Unix (i.e. the exitstatus of the subprocess is obtained by "$? >> 8",
+in C<wait> or C<waitpid>. Failure to C<spawn()> a subprocess is indicated
+by setting C<$?> to S<C<"255 << 8">>. C<$?> is set in a way compatible with
+Unix (i.e. the exitstatus of the subprocess is obtained by S<C<"$? >> 8">>,
as described in the documentation). (Win32)
There is no shell to process metacharacters, and the native standard is
of a child Unix program will exists. Mileage B<will> vary. (S<RISC OS>)
C<system LIST> without the use of indirect object syntax (C<system PROGRAM LIST>)
-may fall back to trying the shell if the first spawn() fails. (Win32)
+may fall back to trying the shell if the first C<spawn()> fails. (Win32)
Does not automatically flush output handles on some platforms.
(SunOS, Solaris, HP-UX)
"cumulative" times will be bogus. On anything other than Windows NT
or Windows 2000, "system" time will be bogus, and "user" time is
-actually the time returned by the clock() function in the C runtime
+actually the time returned by the C<clock()> function in the C runtime
library. (Win32)
Not useful. (S<RISC OS>)
Only the modification time is updated. (VMS, S<RISC OS>)
May not behave as expected. Behavior depends on the C runtime
-library's implementation of utime(), and the filesystem being
+library's implementation of C<utime()>, and the filesystem being
used. The FAT filesystem typically does not support an "access
time" field, and it may limit timestamps to a granularity of
two seconds. (Win32)
\a Alarm or bell.
\A Beginning of string. Not in [].
\b{}, \b Boundary. (\b is a backspace in []).
- \B{}, \B Not a boundary.
+ \B{}, \B Not a boundary. Not in [].
\cX Control-X.
\C Single octet, even under UTF-8. Not in [].
(Deprecated)
'ss' =~ /\A[\0-\x{ff}]\z/ui # Doesn't match
'ss' =~ /\A[\0-\N{LATIN SMALL LETTER SHARP S}]\z/ui # No match
'ss' =~ /\A[\xDF-\xDF]\z/ui # Matches on ASCII platforms, since
- # \XDF is LATIN SMALL LETTER SHARP S,
+ # \xDF is LATIN SMALL LETTER SHARP S,
# and the range is just a single
# element
number for every character" idea breaks down a bit: instead, there is
"at least one number for every character". The same character could
be represented differently in several legacy encodings. The
-converse is not also true: some code points do not have an assigned
+converse is not true: some code points do not have an assigned
character. Firstly, there are unallocated code points within
otherwise used blocks. Secondly, there are special Unicode control
characters that do not represent true characters.
When Unicode was first conceived, it was thought that all the world's
characters could be represented using a 16-bit word; that is a maximum of
-C<0x10000> (or 65536) characters from C<0x0000> to C<0xFFFF> would be
-needed. This soon proved to be false, and since Unicode 2.0 (July
+C<0x10000> (or 65,536) characters would be needed, from C<0x0000> to
+C<0xFFFF>. This soon proved to be wrong, and since Unicode 2.0 (July
1996), Unicode has been defined all the way up to 21 bits (C<0x10FFFF>),
and Unicode 3.1 (March 2001) defined the first characters above C<0xFFFF>.
The first C<0x10000> characters are called the I<Plane 0>, or the
The Unicode code points are just abstract numbers. To input and
output these abstract numbers, the numbers must be I<encoded> or
I<serialised> somehow. Unicode defines several I<character encoding
-forms>, of which I<UTF-8> is perhaps the most popular. UTF-8 is a
-variable length encoding that encodes Unicode characters as 1 to 6
+forms>, of which I<UTF-8> is the most popular. UTF-8 is a
+variable length encoding that encodes Unicode characters as 1 to 4
bytes. Other encodings
include UTF-16 and UTF-32 and their big- and little-endian variants
(UTF-8 is byte-order independent). The ISO/IEC 10646 defines the UCS-2
regular expressions still do not work with Unicode in 5.6.1.
Perl v5.14.0 is the first release where Unicode support is
(almost) seamlessly integrable without some gotchas (the exception being
-some differences in L<quotemeta|perlfunc/quotemeta>, which is fixed
+some differences in L<quotemeta|perlfunc/quotemeta>, and that is fixed
starting in Perl 5.16.0). To enable this
seamless support, you should C<use feature 'unicode_strings'> (which is
automatically selected if you C<use 5.012> or higher). See L<feature>.
=head2 Unicode and EBCDIC
-Perl 5.8.0 also supports Unicode on EBCDIC platforms. There,
-Unicode support is somewhat more complex to implement since
-additional conversions are needed at every step.
-
-Later Perl releases have added code that will not work on EBCDIC platforms, and
-no one has complained, so the divergence has continued. If you want to run
-Perl on an EBCDIC platform, send email to perlbug@perl.org
+Perl 5.8.0 added support for Unicode on EBCDIC platforms. This support
+was allowed to lapse in later releases, but was revived in 5.22.
+Unicode support is somewhat more complex to implement since additional
+conversions are needed. See L<perlebcdic> for more information.
On EBCDIC platforms, the internal Unicode encoding form is UTF-EBCDIC
instead of UTF-8. The difference is that as UTF-8 is "ASCII-safe" in
that ASCII characters encode to UTF-8 as-is, while UTF-EBCDIC is
-"EBCDIC-safe".
+"EBCDIC-safe", in that all the basic characters (which includes all
+those that have ASCII equivalents (like C<"A">, C<"0">, C<"%">, I<etc.>)
+are the same in both EBCDIC and UTF-EBCDIC. Often, documentation
+will use the term "UTF-8" to mean UTF-EBCDIC as well. This is the case
+in this document.
=head2 Creating Unicode
-To create Unicode characters in literals for code points above C<0xFF>,
-use the C<\x{...}> notation in double-quoted strings:
+This section applies fully to Perls starting with v5.22. Various
+caveats for earlier releases are in the L</Earlier releases caveats>
+subsection below.
- my $smiley = "\x{263a}";
+To create Unicode characters in literals,
+use the C<\N{...}> notation in double-quoted strings:
-Similarly, it can be used in regular expression literals
+ my $smiley_from_name = "\N{WHITE SMILING FACE}";
+ my $smiley_from_code_point = "\N{U+263a}";
- $smiley =~ /\x{263a}/;
+Similarly, they can be used in regular expression literals
-At run-time you can use C<chr()>:
+ $smiley =~ /\N{WHITE SMILING FACE}/;
+ $smiley =~ /\N{U+263a}/;
- my $hebrew_alef = chr(0x05d0);
+At run-time you can use:
-See L</"Further Resources"> for how to find all these numeric codes.
+ use charnames ();
+ my $hebrew_alef_from_name
+ = charnames::string_vianame("HEBREW LETTER ALEF");
+ my $hebrew_alef_from_code_point = charnames::string_vianame("U+05D0");
Naturally, C<ord()> will do the reverse: it turns a character into
a code point.
-Note that C<\x..> (no C<{}> and only two hexadecimal digits), C<\x{...}>,
-and C<chr(...)> for arguments less than C<0x100> (decimal 256)
-generate an eight-bit character for backward compatibility with older
-Perls. For arguments of C<0x100> or more, Unicode characters are
-always produced. If you want to force the production of Unicode
-characters regardless of the numeric value, use C<pack("U", ...)>
-instead of C<\x..>, C<\x{...}>, or C<chr()>.
+There are other runtime options as well. You can use C<pack()>:
+
+ my $hebrew_alef_from_code_point = pack("U", 0x05d0);
+
+Or you can use C<chr()>, though it is less convenient in the general
+case:
+
+ $hebrew_alef_from_code_point = chr(utf8::unicode_to_native(0x05d0));
+ utf8::upgrade($hebrew_alef_from_code_point);
+
+The C<utf8::unicode_to_native()> and C<utf8::upgrade()> aren't needed if
+the argument is above 0xFF, so the above could have been written as
+
+ $hebrew_alef_from_code_point = chr(0x05d0);
-You can invoke characters
-by name in double-quoted strings:
+since 0x5d0 is above 255.
- my $arabic_alef = "\N{ARABIC LETTER ALEF}";
+C<\x{}> and C<\o{}> can also be used to specify code points at compile
+time in double-quotish strings, but, for backward compatibility with
+older Perls, the same rules apply as with C<chr()> for code points less
+than 256.
-And, as mentioned above, you can also C<pack()> numbers into Unicode
-characters:
+C<utf8::unicode_to_native()> is used so that the Perl code is portable
+to EBCDIC platforms. You can omit it if you're I<really> sure no one
+will ever want to use your code on a non-ASCII platform. Starting in
+Perl v5.22, calls to it on ASCII platforms are optimized out, so there's
+no performance penalty at all in adding it. Or you can simply use the
+other constructs that don't require it.
- my $georgian_an = pack("U", 0x10a0);
+See L</"Further Resources"> for how to find all these names and numeric
+codes.
-Note that both C<\x{...}> and C<\N{...}> are compile-time string
-constants: you cannot use variables in them. if you want similar
-run-time functionality, use C<chr()> and C<charnames::string_vianame()>.
+=head3 Earlier releases caveats
-If you want to force the result to Unicode characters, use the special
-C<"U0"> prefix. It consumes no arguments but causes the following bytes
-to be interpreted as the UTF-8 encoding of Unicode characters:
+On EBCDIC platforms, prior to v5.22, using C<\N{U+...}> doesn't work
+properly.
- my $chars = pack("U0W*", 0x80, 0x42);
+Prior to v5.16, using C<\N{...}> with a character name (as opposed to a
+C<U+...> code point) required a S<C<use charnames :full>>.
-Likewise, you can stop such UTF-8 interpretation by using the special
-C<"C0"> prefix.
+Prior to v5.14, there were some bugs in C<\N{...}> with a character name
+(as opposed to a C<U+...> code point).
+
+C<charnames::string_vianame()> was introduced in v5.14. Prior to that,
+C<charnames::vianame()> should work, but only if the argument is of the
+form C<"U+...">. Your best bet there for runtime Unicode by character
+name is probably:
+
+ use charnames ();
+ my $hebrew_alef_from_name
+ = pack("U", charnames::vianame("HEBREW LETTER ALEF"));
=head2 Handling Unicode
which is ready to be printed.
+(C<\\x{}> is used here instead of C<\\N{}>, since it's most likely that
+you want to see what the native values are.)
+
=head2 Special Cases
=over 4
character classes that are Unicode-aware. There are dozens of them, see
L<perluniprops>.
-You can use Unicode code points as the end points of character ranges, and the
-range will include all Unicode code points that lie between those end points.
+Starting in v5.22, you can use Unicode code points as the end points of
+character ranges, and the range will include all Unicode code points
+that lie between those end points, inclusive.
+
+ qr/ [\N{U+03]-\N{U+20}] /x
+
+includes the code points
+C<\N{U+03}>, C<\N{U+04}>, ..., C<\N{U+20}>.
=item *
=head1 AUTHOR, COPYRIGHT, AND LICENSE
-Copyright 2001-2011 Jarkko Hietaniemi E<lt>jhi@iki.fiE<gt>
+Copyright 2001-2011 Jarkko Hietaniemi E<lt>jhi@iki.fiE<gt>.
+Now maintained by Perl 5 Porters.
This document may be distributed under the same terms as Perl itself.
Directions for building and installing Perl 5 can be found in
the file F<README.vms> in the main source directory of the
-Perl distribution..
+Perl distribution.
=head1 Organization of Perl Images
=head2 Core Images
-During the installation process, three Perl images are produced.
+During the build process, three Perl images are produced.
F<Miniperl.Exe> is an executable image which contains all of
the basic functionality of Perl, but cannot take advantage of
-Perl extensions. It is used to generate several files needed
-to build the complete Perl and various extensions. Once you've
-finished installing Perl, you can delete this image.
-
-Most of the complete Perl resides in the shareable image
-F<PerlShr.Exe>, which provides a core to which the Perl executable
-image and all Perl extensions are linked. You should place this
-image in F<Sys$Share>, or define the logical name F<PerlShr> to
-translate to the full file specification of this image. It should
-be world readable. (Remember that if a user has execute only access
-to F<PerlShr>, VMS will treat it as if it were a privileged shareable
-image, and will therefore require all downstream shareable images to be
-INSTALLed, etc.)
-
+Perl XS extensions and has a hard-wired list of library locations
+for loading pure-Perl modules. It is used extensively to build and
+test Perl and various extensions, but is not installed.
+
+Most of the complete Perl resides in the shareable image F<PerlShr.Exe>,
+which provides a core to which the Perl executable image and all Perl
+extensions are linked. It is generally located via the logical name
+F<PERLSHR>. While it's possible to put the image in F<SYS$SHARE> to
+make it loadable, that's not recommended. And while you may wish to
+INSTALL the image for performance reasons, you should not install it
+with privileges; if you do, the result will not be what you expect as
+image privileges are disabled during Perl start-up.
Finally, F<Perl.Exe> is an executable image containing the main
entry point for Perl, as well as some initialization code. It
$ mmk test ! Run test code, if supplied
$ mmk install ! Install into public Perl tree
-I<N.B.> The procedure by which extensions are built and
-tested creates several levels (at least 4) under the
-directory in which the extension's source files live.
-For this reason if you are running a version of VMS prior
-to V7.1 you shouldn't nest the source directory
-too deeply in your directory structure lest you exceed RMS'
-maximum of 8 levels of subdirectory in a filespec. (You
-can use rooted logical names to get another 8 levels of
-nesting, if you can't place the files near the top of
-the physical directory structure.)
-
VMS support for this process in the current release of Perl
-is sufficient to handle most extensions. However, it does
-not yet recognize extra libraries required to build shareable
-images which are part of an extension, so these must be added
-to the linker options file for the extension by hand. For
-instance, if the F<PGPLOT> extension to Perl requires the
-F<PGPLOTSHR.EXE> shareable image in order to properly link
-the Perl extension, then the line C<PGPLOTSHR/Share> must
-be added to the linker options file F<PGPLOT.Opt> produced
-during the build process for the Perl extension.
-
-By default, the shareable image for an extension is placed in
-the F<[.lib.site_perl.auto>I<Arch>.I<Extname>F<]> directory of the
-installed Perl directory tree (where I<Arch> is F<VMS_VAX> or
-F<VMS_AXP>, and I<Extname> is the name of the extension, with
-each C<::> translated to C<.>). (See the MakeMaker documentation
-for more details on installation options for extensions.)
-However, it can be manually placed in any of several locations:
+is sufficient to handle most extensions. (See the MakeMaker
+documentation for more details on installation options for
+extensions.)
=over 4
expects, if a VMS path cannot be translated to a Unix path, it is
passed through unchanged, so C<unixify("[...]")> will return C<[...]>.
-The handling of extended characters is largely complete in the
-VMS-specific C infrastructure of Perl, but more work is still needed to
-fully support extended syntax filenames in several core modules. In
-particular, at this writing PathTools has only partial support for
-directories containing some extended characters.
-
There are several ambiguous cases where a conversion routine cannot
determine whether an input filename is in Unix format or in VMS format,
since now both VMS and Unix file specifications may have characters in
=head2 Filename Case
-Perl follows VMS defaults and override settings in preserving (or not
-preserving) filename case. Case is not preserved on ODS-2 formatted
-volumes on any architecture. On ODS-5 volumes, filenames may be case
-preserved depending on process and feature settings. Perl now honors
-DECC$EFS_CASE_PRESERVE and DECC$ARGV_PARSE_STYLE on those systems where
-the CRTL supports these features. When these features are not enabled
-or the CRTL does not support them, Perl follows the traditional CRTL
-behavior of downcasing command-line arguments and returning file
-specifications in lower case only.
+Perl enables DECC$EFS_CASE_PRESERVE and DECC$ARGV_PARSE_STYLE by
+default. Note that the latter only takes effect when extended parse
+is set in the process in which Perl is running. When these features
+are explicitly disabled in the environment or the CRTL does not support
+them, Perl follows the traditional CRTL behavior of downcasing command-line
+arguments and returning file specifications in lower case only.
I<N. B.> It is very easy to get tripped up using a mixture of other
programs, external utilities, and Perl scripts that are in varying
such as MMK or MMS may generate a filename in all upper case even on an
ODS-5 volume. If this filename is later retrieved by a Perl script or
module in a case preserving environment, that upper case name may not
-match the mixed-case or lower-case exceptions of the Perl code. Your
+match the mixed-case or lower-case expectations of the Perl code. Your
best bet is to follow an all-or-nothing approach to case preservation:
either don't use it at all, or make sure your entire toolchain and
application environment support and use it.
}
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
} STMT_END
/* Same thing, but update mark register too. */
# define MEXTEND(p,n) STMT_START { \
- const int markoff = mark - PL_stack_base; \
+ const SSize_t markoff = mark - PL_stack_base; \
sp = stack_grow(sp,p,(SSize_t) (n)); \
mark = PL_stack_base + markoff; \
PERL_UNUSED_VAR(sp); \
} STMT_END
#else
# define EXTEND(p,n) STMT_START { \
- if (UNLIKELY(PL_stack_max - p < (int)(n))) { \
+ if (UNLIKELY(PL_stack_max - p < (SSize_t)(n))) { \
sp = stack_grow(sp,p,(SSize_t) (n)); \
PERL_UNUSED_VAR(sp); \
} } STMT_END
/* Same thing, but update mark register too. */
# define MEXTEND(p,n) STMT_START { \
- if (UNLIKELY(PL_stack_max - p < (int)(n))) { \
- const int markoff = mark - PL_stack_base; \
+ if (UNLIKELY(PL_stack_max - p < (SSize_t)(n))) { \
+ const SSize_t markoff = mark - PL_stack_base; \
sp = stack_grow(sp,p,(SSize_t) (n)); \
mark = PL_stack_base + markoff; \
PERL_UNUSED_VAR(sp); \
#endif
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
}
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
if (gimme == G_SCALAR) {
/* undef TARG, and push that undefined value */
if (type != OP_RCATLINE) {
- SV_CHECK_THINKFIRST_COW_DROP(TARG);
- SvOK_off(TARG);
+ sv_setsv(TARG,NULL);
}
PUSHTARG;
}
const bool localizing = PL_op->op_private & OPpLVAL_INTRO;
bool preeminent = TRUE;
- assert(SvTYPE(hv) == SVt_PVHV);
+ if (SvTYPE(hv) != SVt_PVHV)
+ RETPUSHUNDEF;
if (localizing) {
MAGIC *mg;
}
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
#ifdef __GNUC__
/* to work round a gcc/x86 bug; don't use SvNV */
anv.nv = sv_2nv(fromstr);
+# if defined(LONGDOUBLE_X86_80_BIT) && defined(USE_LONG_DOUBLE) \
+ && LONG_DOUBLESIZE > 10
+ /* GCC sometimes overwrites the padding in the
+ assignment above */
+ Zero(anv.bytes+10, sizeof(anv.bytes) - 10, U8);
+# endif
#else
anv.nv = SvNV(fromstr);
#endif
# ifdef __GNUC__
/* to work round a gcc/x86 bug; don't use SvNV */
aldouble.ld = (long double)sv_2nv(fromstr);
+# if defined(LONGDOUBLE_X86_80_BIT) && LONG_DOUBLESIZE > 10
+ /* GCC sometimes overwrites the padding in the
+ assignment above */
+ Zero(aldouble.bytes+10, sizeof(aldouble.bytes) - 10, U8);
+# endif
# else
aldouble.ld = (long double)SvNV(fromstr);
# endif
}
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
#endif
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
#endif /* LOCKF_EMULATE_FLOCK */
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
#define PERL_ARGS_ASSERT_OP_NULL \
assert(o)
-PERL_CALLCONV OP* Perl_op_parent(OP *o)
- __attribute__nonnull__(1);
-#define PERL_ARGS_ASSERT_OP_PARENT \
- assert(o)
-
PERL_CALLCONV OP* Perl_op_prepend_elem(pTHX_ I32 optype, OP* first, OP* last);
PERL_CALLCONV void Perl_op_refcnt_lock(pTHX);
PERL_CALLCONV void Perl_op_refcnt_unlock(pTHX);
PERL_CALLCONV OP* Perl_op_scope(pTHX_ OP* o);
-PERL_CALLCONV OP* Perl_op_sibling_splice(OP *parent, OP *start, int del_count, OP* insert)
- __attribute__nonnull__(1);
-#define PERL_ARGS_ASSERT_OP_SIBLING_SPLICE \
- assert(parent)
-
+PERL_CALLCONV OP* Perl_op_sibling_splice(OP *parent, OP *start, int del_count, OP* insert);
PERL_CALLCONV OP* Perl_op_unscope(pTHX_ OP* o);
PERL_CALLCONV void Perl_pack_cat(pTHX_ SV *cat, const char *pat, const char *patend, SV **beglist, SV **endlist, SV ***next_in_list, U32 flags)
__attribute__nonnull__(pTHX_1)
#endif
#if defined(PERL_IN_DUMP_C)
-STATIC CV* S_deb_curcv(pTHX_ const I32 ix);
+STATIC CV* S_deb_curcv(pTHX_ I32 ix);
STATIC void S_debprof(pTHX_ const OP *o)
__attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT_DEBPROF \
# endif
#endif
+#if defined(PERL_OP_PARENT)
+PERL_CALLCONV OP* Perl_op_parent(OP *o)
+ __attribute__nonnull__(1);
+#define PERL_ARGS_ASSERT_OP_PARENT \
+ assert(o)
+
+#endif
#if defined(PERL_USES_PL_PIDSTATUS) && defined(PERL_IN_UTIL_C)
STATIC void S_pidgone(pTHX_ Pid_t pid, int status);
#endif
ENTER;
SAVETMPS;
+ save_re_context();
PUSHSTACKi(PERLSI_REQUIRE);
/* G_RE_REPARSING causes the toker to collapse \\ into \ when
* parsing qr''; normally only q'' does this. It also alters
op = POSIXA;
}
}
- else if (AT_LEAST_ASCII_RESTRICTED || ! FOLD) {
+ else if (! FOLD || ASCII_FOLD_RESTRICTED) {
/* We can optimize A-Z or a-z, but not if they could match
- * something like the KELVIN SIGN under /i (/a means they
- * can't) */
+ * something like the KELVIN SIGN under /i. */
if (prevvalue == 'A') {
if (value == 'Z'
#ifdef EBCDIC
Perl_croak(aTHX_ "%"UTF8f, UTF8fARG(utf8, l1-1, buf));
}
+/* XXX Here's a total kludge. But we need to re-enter for swash routines. */
+
+#ifndef PERL_IN_XSUB_RE
+void
+Perl_save_re_context(pTHX)
+{
+ I32 nparens = -1;
+ I32 i;
+
+ /* Save $1..$n (#18107: UTF-8 s/(\w+)/uc($1)/e); AMS 20021106. */
+
+ if (PL_curpm) {
+ const REGEXP * const rx = PM_GETRE(PL_curpm);
+ if (rx)
+ nparens = RX_NPARENS(rx);
+ }
+
+ /* RT #124109. This is a complete hack; in the SWASHNEW case we know
+ * that PL_curpm will be null, but that utf8.pm and the modules it
+ * loads will only use $1..$3.
+ * The t/porting/re_context.t test file checks this assumption.
+ */
+ if (nparens == -1)
+ nparens = 3;
+
+ for (i = 1; i <= nparens; i++) {
+ char digits[TYPE_CHARS(long)];
+ const STRLEN len = my_snprintf(digits, sizeof(digits),
+ "%lu", (long)i);
+ GV *const *const gvp
+ = (GV**)hv_fetch(PL_defstash, digits, len, 0);
+
+ if (gvp) {
+ GV * const gv = *gvp;
+ if (SvTYPE(gv) == SVt_PVGV && GvSV(gv))
+ save_scalar(gv);
+ }
+ }
+}
+#endif
+
#ifdef DEBUGGING
STATIC void
#endif /* DEBUGGING */
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
} bound_type;
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
i_divide integer division (/) ck_null ifsT2 S S
modulo modulus (%) ck_null IifsT2 S S
i_modulo integer modulus (%) ck_null ifsT2 S S
-repeat repeat (x) ck_repeat fmT2 L S
+repeat repeat (x) ck_repeat fmt2 L S
add addition (+) ck_null IfsT2 S S
i_add integer addition (+) ck_null ifsT2 S S
ne numeric ne (!=) ck_null Iifs2 S S<
i_ne integer ne (!=) ck_null ifs2 S S<
ncmp numeric comparison (<=>) ck_null Iifst2 S S<
-i_ncmp integer comparison (<=>) ck_null ifsT2 S S<
+i_ncmp integer comparison (<=>) ck_null ifst2 S S<
slt string lt ck_null ifs2 S S
sgt string gt ck_null ifs2 S S
sge string ge ck_null ifs2 S S
seq string eq ck_null ifs2 S S
sne string ne ck_null ifs2 S S
-scmp string comparison (cmp) ck_null ifsT2 S S
+scmp string comparison (cmp) ck_null ifst2 S S
bit_and bitwise and (&) ck_bitop fst2 S S|
bit_xor bitwise xor (^) ck_bitop fst2 S S|
negate negation (-) ck_null Ifst1 S
i_negate integer negation (-) ck_null ifst1 S
not not ck_null ifs1 S
-complement 1's complement (~) ck_bitop fsT1 S
+complement 1's complement (~) ck_bitop fst1 S
ncomplement numeric 1's complement (~) ck_bitop fsT1 S
# scomplement uses ck_bitop only for the experimental warning. Once the
# warning is gone, this can change to ck_null.
length length ck_length ifsTu% S?
substr substr ck_substr st@ S S S? S?
-vec vec ck_fun isT@ S S S
+vec vec ck_fun ist@ S S S
index index ck_index isT@ S S S?
rindex rindex ck_index isT@ S S S?
unpack unpack ck_fun u@ S S?
pack pack ck_fun fmst@ S L
-split split ck_split T@ S S S
+split split ck_split t@ S S S
join join or string ck_join fmst@ S L
# List operators.
__END__
package warnings;
-our $VERSION = '1.31';
+our $VERSION = '1.32';
# Verify that we're called correctly so that warnings will work.
# see also strict.pm.
=head2 Fatal Warnings
X<warning, fatal>
-The presence of the word "FATAL" in the category list will escalate any
-warnings detected from the categories specified in the lexical scope
-into fatal errors. In the code below, the use of C<time>, C<length>
+The presence of the word "FATAL" in the category list will escalate
+warnings in those categories into fatal errors in that lexical scope.
+
+B<NOTE:> FATAL warnings should be used with care, particularly
+C<< FATAL => 'all' >>.
+
+Libraries using L<warnings::warn|/FUNCTIONS> for custom warning categories
+generally don't expect L<warnings::warn|/FUNCTIONS> to be fatal and can wind up
+in an unexpected state as a result. For XS modules issuing categorized
+warnings, such unanticipated exceptions could also expose memory leak bugs.
+
+Moreover, the Perl interpreter itself has had serious bugs involving
+fatalized warnings. For a summary of resolved and unresolved problems as
+of January 2015, please see
+L<this perl5-porters post|http://www.nntp.perl.org/group/perl.perl5.porters/2015/01/msg225235.html>.
+
+While some developers find fatalizing some warnings to be a useful
+defensive programming technique, using C<< FATAL => 'all' >> to fatalize
+all possible warning categories -- including custom ones -- is particularly
+risky. Therefore, the use of C<< FATAL => 'all' >> is
+L<discouraged|perlpolicy/discouraged>.
+
+The L<strictures|strictures/VERSION-2> module on CPAN offers one example of
+a warnings subset that the module's authors believe is relatively safe to
+fatalize.
+
+B<NOTE:> users of FATAL warnings, especially those using
+C<< FATAL => 'all' >>, should be fully aware that they are risking future
+portability of their programs by doing so. Perl makes absolutely no
+commitments to not introduce new warnings or warnings categories in the
+future; indeed, we explicitly reserve the right to do so. Code that may
+not warn now may warn in a future release of Perl if the Perl5 development
+team deems it in the best interests of the community to do so. Should code
+using FATAL warnings break due to the introduction of a new warning we will
+NOT consider it an incompatible change. Users of FATAL warnings should
+take special caution during upgrades to check to see if their code triggers
+any new warnings and should pay particular attention to the fine print of
+the documentation of the features they use to ensure they do not exploit
+features that are documented as risky, deprecated, or unspecified, or where
+the documentation says "so don't do that", or anything with the same sense
+and spirit. Use of such features in combination with FATAL warnings is
+ENTIRELY AT THE USER'S RISK.
+
+The following documentation describes how to use FATAL warnings but the
+perl5 porters strongly recommend that you understand the risks before doing
+so, especially for library code intended for use by others, as there is no
+way for downstream users to change the choice of fatal categories.
+
+In the code below, the use of C<time>, C<length>
and C<join> can all produce a C<"Useless use of xxx in void context">
warning.
C<< no warnings 'FATAL'; >> was unspecified; they did not behave as if
they included the C<< => 'all' >> portion. As of 5.20, they do.)
-B<NOTE:> Users of FATAL warnings, especially
-those using C<< FATAL => 'all' >>
-should be fully aware that they are risking future portability of their
-programs by doing so. Perl makes absolutely no commitments to not
-introduce new warnings, or warnings categories in the future, and indeed
-we explicitly reserve the right to do so. Code that may not warn now may
-warn in a future release of Perl if the Perl5 development team deems it
-in the best interests of the community to do so. Should code using FATAL
-warnings break due to the introduction of a new warning we will NOT
-consider it an incompatible change. Users of FATAL warnings should take
-special caution during upgrades to check to see if their code triggers
-any new warnings and should pay particular attention to the fine print of
-the documentation of the features they use to ensure they do not exploit
-features that are documented as risky, deprecated, or unspecified, or where
-the documentation says "so don't do that", or anything with the same sense
-and spirit. Use of such features in combination with FATAL warnings is
-ENTIRELY AT THE USER'S RISK.
-
=head2 Reporting Warnings from a Module
X<warning, reporting> X<warning, registering>
}
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
}
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
}
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
#define save_op() save_pushptr((void *)(PL_op), SAVEt_OP)
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
}
items = AvMAX((const AV *)sstr) - AvFILLp((const AV *)sstr);
while (items-- > 0) {
- *dst_ary++ = &PL_sv_undef;
+ *dst_ary++ = NULL;
}
}
else {
nsv = sv_newmortal();
SvSetSV_nosteal(nsv, sv);
}
+ save_re_context();
PUSHMARK(sp);
EXTEND(SP, 3);
PUSHs(encoding);
dSP;
ENTER;
SAVETMPS;
+ save_re_context();
PUSHMARK(sp);
EXTEND(SP, 6);
PUSHs(encoding);
}
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
#define SV_CONSTS_COUNT 35
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
my $Is_EBCDIC = (ord('A') == 193) ? 1 : 0;
my $Is_UTF8 = (${^OPEN} || "") =~ /:utf8/;
-my $total_tests = 56;
+my $total_tests = 57;
if ($Is_EBCDIC || $Is_UTF8) { $total_tests -= 3; }
print "1..$total_tests\n";
print "# $@\nnot " if $@;
print "ok ",$i++," - require 5.5.630\n";
+eval { require(v5.5.630); };
+print "# $@\nnot " if $@;
+print "ok ",$i++," - require(v5.5.630) with parens [perl #124153]\n";
+
sub v5 { die }
eval { require v5; };
print "# $@\nnot " if $@;
Use of assignment to $[ is deprecated at - line 2.
Assigning non-zero to $[ is no longer possible at - line 5.
b
+########
+# NAME $^H accidentally enabling all features
+eval 'BEGIN { $^H |= 0x1c020000 } $_ = evalbytes 12345';
+print $_||$@;
+EXPECT
+Number found where operator expected at (eval 1) line 1, near "evalbytes 12345"
+ (Do you need to predeclare evalbytes?)
+syntax error at (eval 1) line 1, near "evalbytes 12345"
Wide character (U+100) in pattern match (m//) at - line 16.
Wide character (U+100) in pattern match (m//) at - line 16.
########
+# NAME Wide character in UTF-8 locale
+require '../loc_tools.pl';
+unless (locales_enabled()) {
+ print("SKIPPED\n# locales not available\n"),exit;
+}
+eval { require POSIX; POSIX->import("locale_h") };
+if ($@) {
+ print("SKIPPED\n# no POSIX\n"),exit;
+}
+my @utf8_locales = find_utf8_ctype_locale();
+unless (@utf8_locales) {
+ print("SKIPPED\n# no UTF-8 locales\n"),exit;
+}
+use warnings 'locale';
+use locale;
+setlocale(&POSIX::LC_CTYPE, $utf8_locales[0]);
+"\x{100}" =~ /\x{100}|\x{101}/il;
+"\x{100}" =~ /\x{100}|\x{101}/l;
+"\x{100}" =~ /\w/l;
+"\x{100}" =~ /\x{100}+/l;
+"\x{100}" =~ /[\x{100}\x{102}]/l;
+EXPECT
+########
# NAME \b{} in non-UTF-8 locale
eval { require POSIX; POSIX->import("locale_h") };
if ($@) {
-a;
;-a;
EXPECT
+########
+# toke.c
+# [perl #124113] Compile-time warning with UTF8 variable in array index
+use warnings;
+use utf8;
+my $𝛃 = 0;
+my @array = (0);
+my $v = $array[ 0 + $𝛃 ];
+ $v = $array[ $𝛃 + 0 ];
+EXPECT
+########
+# toke.c
+# Allow Unicode here doc boundaries
+use warnings;
+use utf8;
+my $v = <<EnFraçais;
+Comme ca!
+EnFraçais
+print $v;
+EXPECT
+Comme ca!
+########
+# toke.c
+# Fix 'Use of "..." without parentheses is ambiguous' warning for
+# Unicode function names. If not under PERL_UNICODE, this will generate
+# a "Wide character" warning
+use utf8;
+use warnings;
+sub 𝛃(;$) { return 0; }
+my $v = 𝛃 - 5;
+EXPECT
+OPTION regex
+(Wide character.*\n)?Warning: Use of "𝛃" without parentheses is ambiguous
Wide character (U+102) in fc at - line 16.
Wide character (U+103) in uc at - line 17.
Wide character (U+104) in ucfirst at - line 18.
+########
+# NAME Wide character in UTF-8 locale
+require '../loc_tools.pl';
+unless (locales_enabled('LC_CTYPE')) {
+ print("SKIPPED\n# locales not available\n"),exit;
+}
+eval { require POSIX; POSIX->import("locale_h") };
+if ($@) {
+ print("SKIPPED\n# no POSIX\n"),exit;
+}
+my @utf8_locales = find_utf8_ctype_locale();
+unless (@utf8_locales) {
+ print("SKIPPED\n# no UTF-8 locales\n"),exit;
+}
+use warnings 'locale';
+use feature 'fc';
+use locale;
+setlocale(&POSIX::LC_CTYPE, $utf8_locales[0]);
+my $a;
+$a = lc("\x{100}");
+$a = lcfirst("\x{101}");
+$a = fc("\x{102}");
+$a = uc("\x{103}");
+$a = ucfirst("\x{104}");
+EXPECT
# anyway later during the scanning process (and besides, some clueless
# vendor might have them capitalized erroneously anyway).
-sub _trylocale ($$$$) { # Adds the locale given by the first parameter to the
- # list given by the 3rd iff the platform supports the
- # locale in each of the categories given by the 2nd
- # parameter, which is either a single category or a
- # reference to a list of categories
- # The 4th parameter is true if to reject locales that
- # aren't apparently fully compatible with Perl.
+# Functions whose names begin with underscore are internal helper functions
+# for this file, and are not to be used by outside callers.
+
+sub _trylocale ($$$$) { # For use only by other functions in this file!
+
+ # Adds the locale given by the first parameter to the list given by the
+ # 3rd iff the platform supports the locale in each of the categories given
+ # by the 2nd parameter, which is either a single category or a reference
+ # to a list of categories The 4th parameter is true if to reject locales
+ # that aren't apparently fully compatible with Perl.
+
my $locale = shift;
my $categories = shift;
my $list = shift;
push @$list, $locale;
}
-sub _decode_encodings {
+sub _decode_encodings { # For use only by other functions in this file!
my @enc;
foreach (split(/ /, shift)) {
is @warnings, 0, "No more warnings";
}
-# Local variables:
-# indent-tabs-mode: nil
-# End:
-#
# ex: set ts=8 sts=4 sw=4 et:
# This file is for concatenation tests that require test.pl.
#
-# concat.t cannot use test.pl as it needs to avoid using concatenation in
+# t/opbasic/concat.t cannot use test.pl as
+# it needs to avoid using concatenation in
# its ok() function.
BEGIN {
skip_all("no point in dumping on $^O")
unless $^O =~ /^(linux|.*bsd|solaris)$/;
+skip_all("avoid coredump under ASan")
+ if $Config{ccflags} =~ /-fsanitize=/;
+
# execute in a work directory so File::Temp can clean up core dumps
my $tmp = tempdir(CLEANUP => 1);
@_;
}
-# Local variables:
-# indent-tabs-mode: nil
-# End:
-#
# ex: set ts=8 sts=4 sw=4 et:
}
}
+# [perl #123790] Assigning to a typeglob
+# These used to die or crash.
+# Once the bug is fixed for all ops, we can combine this with the tests
+# above that use <DATA>.
+for my $glob (*__) {
+ $glob = $y x $z;
+ { use integer; $glob = $y <=> $z; }
+ $glob = $y cmp $z;
+ $glob = vec 1, 2, 4;
+ $glob = ~${\""};
+ $glob = split;
+}
+
# XXX This test does not really belong here, as it has nothing to do with
# OPpTARGET_MY optimisation. But where should it go?
eval {
@AutoloadTest::ISA = AutoloadTestSuper::;
AutoloadTest->blah;
}
+
+# This used to crash because op.c:find_lexical_cv was looking at the wrong
+# CV’s OUTSIDE pointer. [perl #124099]
+{
+ my sub h; sub{my $x; sub{h}}
+}
use strict;
no warnings 'once';
-plan(tests => 146);
+plan(tests => 147);
@A::ISA = 'B';
@B::ISA = 'C';
'restoring the stash returns to a method');
}
+# RT #123619 constant class name should be read-only
+
+{
+ sub RT123619::f { chop $_[0] }
+ eval { 'RT123619'->f(); };
+ like ($@, qr/Modification of a read-only value attempted/, 'RT #123619');
+}
+
__END__
#FF9900
#F78C08
set_up_inc('../lib');
}
-plan tests => 31;
+plan tests => 32;
# [perl #19566]: sv_gets writes directly to its argument via
# TARG. Test that we respect SvREADONLY.
readline undef;
is ${^LAST_FH}, undef, '${^LAST_FH} after readline undef';
+{
+ my $w;
+ local($SIG{__WARN__},$^W) = (sub { $w .= shift }, 1);
+ *x=<y>;
+ like $w, qr/^readline\(\) on unopened filehandle y at .*\n(?x:
+ )Undefined value assigned to typeglob at .*\n\z/,
+ '[perl #123790] *x=<y> used to fail an assertion';
+}
+
__DATA__
moo
moo
skip_all_without_config('useithreads');
skip_all_if_miniperl("no dynamic loading on miniperl, no threads");
- plan(27);
+ plan(28);
}
use strict;
'no crash when deleting $::{INC} in thread'
);
+fresh_perl_is(<<'CODE', 'ok', 'no crash modifying extended array element');
+use threads;
+my @a = 1;
+threads->create(sub { $#a = 1; $a[1] = 2; print qq/ok\n/ })->join;
+CODE
+
# EOF
return $ok;
}
-print "1..30\n";
+print "1..31\n";
($a, $b, $c) = qw(foo bar);
$x .= "-append-";
ok($x eq "ab-append-", "Appending to something initialized using constant folding");
}
+
+# [perl #124160]
+package o { use overload "." => sub { $_[0] }, fallback => 1 }
+$o = bless [], "o";
+ok(ref(CORE::state $y = "a $o b") eq 'o',
+ 'state $y = "foo $bar baz" does not stringify; only concats');
sort @found_built);
}
-# Local variables:
-# cperl-indent-level: 4
-# indent-tabs-mode: nil
-# End:
-#
# ex: set ts=8 sts=4 sw=4 et:
);
$skip{PL_hash_rand_bits}= $skip{PL_hash_rand_bits_enabled}= 1; # we can be compiled without these, so skip testing them
+$skip{PL_warn_locale}= 1; # we can be compiled without locales, so skip testing them
my $trial = "nm globals$Config{_o} 2>&1";
-# This file is the data file for porting/podcheck.t.
+# This file is the data file for t/porting/podcheck.t.
# There are three types of lines.
# Comment lines are white-space only or begin with a '#', like this one. Any
# changes you make to the comment lines will be lost when the file is
Hook::LexWrap
HTML::StripScripts
HTTP::Lite
+iconv(1)
+iconv(3)
inetd(8)
IO::Socket::IP
IPC::Run
splain
sprintf(3)
stat(2)
+strictures
String::Base
String::Scanf
Switch
Time::Object
Tk
Tk::Pod
+tr(1)
tty(1)
Unicode::CaseFold
Unicode::Casing
pod/perlgpl.pod Verbatim line length including indents exceeds 79 by 50
pod/perlguts.pod ? Should you be using F<...> or maybe L<...> instead of 2
pod/perlguts.pod ? Should you be using L<...> instead of 1
+pod/perlguts.pod Verbatim line length including indents exceeds 79 by 1
pod/perlhack.pod ? Should you be using L<...> instead of 1
pod/perlhist.pod Verbatim line length including indents exceeds 79 by 1
pod/perlhpux.pod Verbatim line length including indents exceeds 79 by 7
pod/perlos2.pod Verbatim line length including indents exceeds 79 by 21
pod/perlos390.pod Verbatim line length including indents exceeds 79 by 11
pod/perlperf.pod Verbatim line length including indents exceeds 79 by 154
+pod/perlport.pod ? Should you be using L<...> instead of 1
pod/perlrun.pod Verbatim line length including indents exceeds 79 by 3
pod/perlsolaris.pod Verbatim line length including indents exceeds 79 by 14
pod/perlsource.pod ? Should you be using F<...> or maybe L<...> instead of 1
pod/perltrap.pod ? Should you be using F<...> or maybe L<...> instead of 1
pod/perltru64.pod ? Should you be using F<...> or maybe L<...> instead of 1
pod/perltru64.pod Verbatim line length including indents exceeds 79 by 5
-pod/perlvms.pod ? Should you be using F<...> or maybe L<...> instead of 1
pod/perlwin32.pod Verbatim line length including indents exceeds 79 by 12
porting/epigraphs.pod Verbatim line length including indents exceeds 79 by 16
porting/expand-macro.pl Verbatim line length including indents exceeds 79 by 2
--- /dev/null
+#!./perl -w
+#
+# Check that utf8.pm and its dependencies only use the subset of the
+# $1..$n capture vars that Perl_save_re_context() is hard-coded to
+# localise, because that function has no efficient way of determining at
+# runtime what vars to localise.
+#
+# Note that this script tests for the existence of symbol table entries in
+# %::, so @4 etc would trigger a failure as well as $4.
+#
+# If tests start to fail, either (in order of descending preference):
+#
+# * fix utf8.pm or its dependencies so that any recent change no longer
+# uses more special vars (ideally it would use no vars);
+#
+# * fix Perl_save_re_context() so that it localises more vars, then
+# update this test script with the new relaxed var list.
+
+
+use warnings;
+use strict;
+
+# trigger the dependency loading
+
+my $x = lc "\x{411}";
+
+# determine which relevant vars those dependencies accessed
+
+my @vars =
+ grep !/^[0123]$/, # $0, and $1, ..$3 allowed
+ grep /^(?:\d+|[`'&])$/, # numeric and $`, $&, $' vars
+ sort keys %::;
+
+# load any other modules *after* calculating @vars
+
+require './test.pl';
+
+plan(1);
+
+is(scalar @vars, 0, "extraneous vars")
+ or diag("extra vars seen: " . join(", ", map "*$_", @vars));
+
+exit 0;
}
}
-# Local variables:
-# cperl-indent-level: 4
-# indent-tabs-mode: nil
-# End:
-#
# ex: set ts=8 sts=4 sw=4 et:
}
{
+ fresh_perl_is(<<'EOF',
+ my $s = "\x{41c}";
+ $s =~ /(.*)/ or die;
+ $ls = lc $1;
+ print $ls eq lc $s ? "good\n" : "bad: [$ls]\n";
+EOF
+ "good\n",
+ {},
+ "swash triggered by lc() doesn't corrupt \$1"
+ );
+ }
+
+ {
#' RT #119075
no warnings 'regexp'; # Silence "has useless greediness modifier"
local $@;
# pat string y/n/etc expr expected-expr skip-reason comment
/[a-z]/i \N{KELVIN SIGN} y $& \N{KELVIN SIGN}
+/[A-Z]/ia \N{KELVIN SIGN} y $& \N{KELVIN SIGN}
+/[A-Z]/iaa \N{KELVIN SIGN} n - -
/[A-Z]/i \N{LATIN SMALL LETTER LONG S} y $& \N{LATIN SMALL LETTER LONG S}
# RT #123840: these used to hang in re_intuit_start
########
# These tests are here instead of lib/locale.t because
-# some bugs depend on in the internal state of the locale
+# some bugs depend on the internal state of the locale
# settings and pragma/locale messes up that state pretty badly.
# We need "fresh runs".
BEGIN {
skip_all_without_unicode_tables();
}
-plan (tests => 51);
+plan (tests => 52);
use utf8;
use open qw( :utf8 :std );
CORE::evalbytes "use charnames ':full'; use utf8; my \$x = \"\\N{abc$malformed_to_be}\"";
like( $@, qr/Malformed UTF-8 character immediately after '\\N\{abc' at .* within string/, 'Malformed UTF-8 input to \N{}');
}
+
+# RT# 124216: Perl_sv_clear: Assertion
+# If a parsing error occurred during a forced token within an interpolated
+# context, the stack unwinding failed to restore PL_lex_defer and so after
+# error recovery the state restored after the forced token was processed
+# was the wrong one, resulting in the lexer thinking we're still inside a
+# quoted string and things getting freed multiple times.
+#
+# \xe3\x80\xb0 are the utf8 bytes making up the character \x{3030}.
+# The \x{3030} char isn't a legal var name, and this triggers the error.
+#
+# NB: this only failed if the closing quote of the interpolated string is
+# the last char of the file (i.e. no trailing \n).
+
+{
+ no utf8;
+
+ fresh_perl_like(qq{use utf8; "\$\xe3\x80\xb0"},
+ qr/
+ \A
+ ( \QWide character in print at - line 1.\E\n )?
+ \Qsyntax error at - line 1, near \E"\$.*"\n
+ \QExecution of - aborted due to compilation errors.\E\z
+ /xm,
+
+ {stderr => 1}, "RT# 124216");
+}
}
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
#endif
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
PL_last_uni++;
s = PL_last_uni;
while (isWORDCHAR_lazy_if(s,UTF) || *s == '-')
- s++;
+ s += UTF ? UTF8SKIP(s) : 1;
if ((t = strchr(s, '(')) && t < PL_bufptr)
return;
Perl_ck_warner_d(aTHX_ packWARN(WARN_AMBIGUOUS),
- "Warning: Use of \"%.*s\" without parentheses is ambiguous",
- (int)(s - PL_last_uni), PL_last_uni);
+ "Warning: Use of \"%"UTF8f"\" without parentheses is ambiguous",
+ UTF8fARG(UTF, (int)(s - PL_last_uni), PL_last_uni));
}
/*
SAVEI32(PL_lex_casemods);
SAVEI32(PL_lex_starts);
SAVEI8(PL_lex_state);
+ SAVEI8(PL_lex_defer);
SAVESPTR(PL_lex_repl);
SAVEVPTR(PL_lex_inpat);
SAVEI16(PL_lex_inwhat);
/* We deliberately don't try to print the malformed character, which
* might not print very well; it also may be just the first of many
* malformations, so don't print what comes after it */
- yyerror(Perl_form(aTHX_
+ yyerror_pv(Perl_form(aTHX_
"Malformed UTF-8 character immediately after '%.*s'",
- (int) (first_bad_char_loc - (U8 *) backslash_ptr), backslash_ptr));
+ (int) (first_bad_char_loc - (U8 *) backslash_ptr), backslash_ptr),
+ SVf_UTF8);
return NULL;
}
char *t = s+1;
while (isSPACE(*t) || isWORDCHAR_lazy_if(t,UTF) || *t == '$')
- t++;
+ t += UTF ? UTF8SKIP(t) : 1;
if (*t++ == ',') {
PL_bufptr = skipspace(PL_bufptr); /* XXX can realloc */
while (t < PL_bufend && *t != ']')
t++;
Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
- "Multidimensional syntax %.*s not supported",
- (int)((t - PL_bufptr) + 1), PL_bufptr);
+ "Multidimensional syntax %"UTF8f" not supported",
+ UTF8fARG(UTF,(int)((t - PL_bufptr) + 1), PL_bufptr));
}
}
}
term = '"';
if (!isWORDCHAR_lazy_if(s,UTF))
deprecate("bare << to mean <<\"\"");
- for (; isWORDCHAR_lazy_if(s,UTF); s++) {
- if (d < e)
- *d++ = *s;
+ peek = s;
+ while (isWORDCHAR_lazy_if(peek,UTF)) {
+ peek += UTF ? UTF8SKIP(peek) : 1;
}
+ len = (peek - s >= e - d) ? (e - d) : (peek - s);
+ Copy(s, d, len, char);
+ s += len;
+ d += len;
}
if (d >= PL_tokenbuf + sizeof PL_tokenbuf - 1)
Perl_croak(aTHX_ "Delimiter for here document is too long");
}
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
{
dXSARGS;
REGEXP *re;
- U8 const gimme = GIMME_V;
+ I32 const gimme = GIMME_V;
EXTEND(SP, 2);
SP -= items;
}
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
#endif
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
PUSHSTACKi(PERLSI_MAGIC);
ENTER;
SAVEHINTS();
+ save_re_context();
/* We might get here via a subroutine signature which uses a utf8
* parameter name, at which point PL_subname will have been set
* but not yet used. */
#ifndef NO_TAINT_SUPPORT
/* It is assumed that callers of this routine are not passing in
* any user derived data. */
+ /* Need to do this after save_re_context() as it will set
+ * PL_tainted to 1 while saving $1 etc (see the code after getrx:
+ * in Perl_magic_get). Even line to create errsv_save can turn on
+ * PL_tainted. */
SAVEBOOL(TAINT_get);
TAINT_NOT;
#endif
}
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
#endif /* H_UTF8 */
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
* The EBCDIC invariants have been chosen to be those characters whose Unicode
* equivalents have ordinal numbers less than 160, that is the same characters
* that are expressible in ASCII, plus the C1 controls. So there are 160
- * invariants instead of the 128 in UTF-8. (My guess is that this is because
- * the C1 control NEL (and maybe others) is important in IBM.)
+ * invariants instead of the 128 in UTF-8.
*
* The purpose of Step 3 is to make the encoding be invariant for the chosen
* characters. This messes up the convenient patterns found in step 2, so
* pages. Best is to convert to I8 before sending them, as the I8
* representation is the same no matter what the underlying code page is.
*
- * tr16 also says that NEL and LF be swapped. We don't do that.
- *
* Because of the way UTF-EBCDIC is constructed, the lowest 32 code points that
* aren't equivalent to ASCII characters nor C1 controls form the set of
* continuation bytes; the remaining 64 non-ASCII, non-control code points form
#define MAX_UTF8_TWO_BYTE 0x3FF
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
SV *exarg;
ENTER;
+ save_re_context();
if (warn) {
SAVESPTR(*hook);
*hook = NULL;
#endif /* #ifdef USE_C_BACKTRACE */
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
#endif
/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
* ex: set ts=8 sts=4 sw=4 et:
*/
extra.pods : miniperl
@ @extra_pods.com
-PERLDELTA_CURRENT = [.pod]perl52110delta.pod
+PERLDELTA_CURRENT = [.pod]perl52111delta.pod
$(PERLDELTA_CURRENT) : [.pod]perldelta.pod
Copy/NoConfirm/Log $(MMS$SOURCE) $(PERLDELTA_CURRENT)
package FindExt;
-our $VERSION = '1.02';
+our $VERSION = '1.03';
use strict;
use warnings;
}
1;
-# Local variables:
-# cperl-indent-level: 4
-# indent-tabs-mode: nil
-# End:
-#
# ex: set ts=8 sts=4 sw=4 et:
# versioned installation can be obtained by setting INST_TOP above to a
# path that includes an arbitrary version string.
#
-#INST_VER = \5.21.10
+#INST_VER = \5.21.11
#
# Comment this out if you DON'T want your perl installation to have
copy ..\README.tw ..\pod\perltw.pod
copy ..\README.vos ..\pod\perlvos.pod
copy ..\README.win32 ..\pod\perlwin32.pod
- copy ..\pod\perldelta.pod ..\pod\perl52110delta.pod
+ copy ..\pod\perldelta.pod ..\pod\perl52111delta.pod
cd ..\win32
$(PERLEXE) $(PL2BAT) $(UTILS)
$(MINIPERL) -I..\lib ..\autodoc.pl ..
-if exist $(LIBDIR)\Win32API rmdir /s /q $(LIBDIR)\Win32API
-if exist $(LIBDIR)\XS rmdir /s /q $(LIBDIR)\XS
-cd $(PODDIR) && del /f *.html *.bat roffitall \
- perl52110delta.pod perlaix.pod perlamiga.pod perlandroid.pod \
+ perl52111delta.pod perlaix.pod perlamiga.pod perlandroid.pod \
perlapi.pod perlbs2000.pod perlce.pod perlcn.pod perlcygwin.pod \
perldos.pod perlfreebsd.pod perlhaiku.pod perlhpux.pod \
perlhurd.pod perlintern.pod perlirix.pod perljp.pod perlko.pod \
# versioned installation can be obtained by setting INST_TOP above to a
# path that includes an arbitrary version string.
#
-#INST_VER *= \5.21.10
+#INST_VER *= \5.21.11
#
# Comment this out if you DON'T want your perl installation to have
LIBOUT_FLAG =
BUILDOPT += -fno-strict-aliasing -mms-bitfields
+MINIBUILDOPT += -fno-strict-aliasing
+
+TESTPREPGCC = test-prep-gcc
.ELSE
EXEOUT_FLAG = -Fe
LIBOUT_FLAG = /out:
+TESTPREPGCC =
+
.ENDIF
CFLAGS_O = $(CFLAGS) $(BUILDOPT)
copy ..\README.tw ..\pod\perltw.pod
copy ..\README.vos ..\pod\perlvos.pod
copy ..\README.win32 ..\pod\perlwin32.pod
- copy ..\pod\perldelta.pod ..\pod\perl52110delta.pod
+ copy ..\pod\perldelta.pod ..\pod\perl52111delta.pod
$(PERLEXE) $(PL2BAT) $(UTILS)
$(MINIPERL) -I..\lib ..\autodoc.pl ..
$(MINIPERL) -I..\lib ..\pod\perlmodlib.PL -q ..
-if exist $(LIBDIR)\Win32API rmdir /s /q $(LIBDIR)\Win32API
-if exist $(LIBDIR)\XS rmdir /s /q $(LIBDIR)\XS
-cd $(PODDIR) && del /f *.html *.bat roffitall \
- perl52110delta.pod perlaix.pod perlamiga.pod perlandroid.pod \
+ perl52111delta.pod perlaix.pod perlamiga.pod perlandroid.pod \
perlapi.pod perlbs2000.pod perlce.pod perlcn.pod perlcygwin.pod \
perldos.pod perlfreebsd.pod perlhaiku.pod perlhpux.pod \
perlhurd.pod perlintern.pod perlirix.pod perljp.pod perlko.pod \
# Without this copying, the op/taint.t test script will fail.
.IF "$(CCTYPE)" == "GCC"
-TESTPREPGCC = test-prep-gcc
+
test-prep-gcc :
if exist $(CCDLLDIR)\libgcc_s_seh-1.dll $(XCOPY) $(CCDLLDIR)\libgcc_s_seh-1.dll ..\t\$(NULL)
if exist $(CCDLLDIR)\libgcc_s_sjlj-1.dll $(XCOPY) $(CCDLLDIR)\libgcc_s_sjlj-1.dll ..\t\$(NULL)
if exist $(CCDLLDIR)\libgcc_s_dw2-1.dll $(XCOPY) $(CCDLLDIR)\libgcc_s_dw2-1.dll ..\t\$(NULL)
if exist $(CCDLLDIR)\libstdc++-6.dll $(XCOPY) $(CCDLLDIR)\libstdc++-6.dll ..\t\$(NULL)
if exist $(CCDLLDIR)\libwinpthread-1.dll $(XCOPY) $(CCDLLDIR)\libwinpthread-1.dll ..\t\$(NULL)
-.ELSE
-TESTPREPGCC =
+
.ENDIF
test : test-prep
perl5202delta.pod \
perl5210delta.pod \
perl52110delta.pod \
+ perl52111delta.pod \
perl5211delta.pod \
perl5212delta.pod \
perl5213delta.pod \
perl5202delta.man \
perl5210delta.man \
perl52110delta.man \
+ perl52111delta.man \
perl5211delta.man \
perl5212delta.man \
perl5213delta.man \
perl5202delta.html \
perl5210delta.html \
perl52110delta.html \
+ perl52111delta.html \
perl5211delta.html \
perl5212delta.html \
perl5213delta.html \
perl5202delta.tex \
perl5210delta.tex \
perl52110delta.tex \
+ perl52111delta.tex \
perl5211delta.tex \
perl5212delta.tex \
perl5213delta.tex \
or warn "Can't unlink $file after error: $!";
die $error;
-# Local variables:
-# cperl-indent-level: 4
-# indent-tabs-mode: nil
-# End:
-#
# ex: set ts=8 sts=4 sw=4 et: