pperl 0.6.9#
2026-07-28 to 2026-08-05, 211 commits.
Language and runtime#
SIGPIPE stops a program whose output pipe was closed, as on perl5:
pperl generate.pl | headran forever. pperl keeps theSIGPIPEdisposition it was started with instead of ignoring the signal, so the exit status is 141, and$SIG{PIPE}handlers and$SIG{PIPE} = 'IGNORE'behave as on perl5.$0: assigning to it, as cpanm and Starman do to label their processes, no longer crashes pperl or writes into unrelated memory. The assignment changes the process’s command line aspsand/proc/self/cmdlineshow it, also for names longer than the original command line, so Starman’s renamed workers can be told apart.
JIT and parallelization#
mandelbrot: the Benchmarks Game’s mandelbrot, with its thread pool replaced by a plain loop over scanlines and its kernel unchanged, now runs its kernel compiled; before, the kernel never compiled. At size 2000 it takes 0.62 s of CPU time on one core, against 4.96 s wall-clock and 19.7 s CPU time for the published four-thread entry on perl5.
Loops that now compile:
for (LIST)with the implicit$_compiles, as donext LABELandlast LABELaimed at an enclosing compiled loop, and aforloop over an array nested in another compiled loop, which now compiles together with it. A loop body may begin withmy $x;ormy ($a, $b);, assign a list such asmy ($a, $b) = (0, 0), and append with.=to a variable declared without a value; each of these kept the loop from compiling.Element updates: the assignment operators
+=,-=,*=,/=,|=,&=,^=,<<=and>>=and the operators++and--compile on array and hash elements and on elements reached through references, such as$m[$i][$j] += $x, also when the index is computed, as in$a[$i + 1]or$a[$i % 2].sqrtcompiles too.Subroutines called from compiled loops compile together with the loop also when they use arrays, hashes or strings, use package variables, or assign to a
myvariable they close over, as inmy $acc; sub add { $acc += $_[0] }. Arguments read through@_or as$_[0]compile, also in a sub that never copies them, such assub f { $_[0] * $_[1] }, and a call with literal arguments such asf(3, 5)no longer keeps its loop from compiling.Wrong results in compiled loops: a nested range loop whose body assigns its loop variable or whose lower bound is an expression, a sub assigning to
$_[0], and a sub adding to a variable it closes over could abort or give wrong results in compiled code. They now give perl5’s results.
Modules#
Encode provides all 124 encodings of the upstream distribution, up from 21: the single-byte tables generated from the Unicode mapping data, UTF-16, UTF-32 and UCS-2, the 21 multi-byte CJK encodings, ISO-2022, gsm0338, hz, UTF-7 and the MIME encoded-word codecs. Each was checked against perl5’s Encode, the CJK tables over every two-byte sequence. Names resolve through upstream’s alias rules, so
windows-1252,latin2,sjisormacintoshwork without a perl5 installation, andEncode->encodingslists the loaded encodings until":all"is asked for.Encode error handling: the
CHECKargument ofencode,decodeandfrom_tois honoured.FB_CROAKdies,FB_PERLQQ,FB_HTMLCREFandFB_XMLCREFsubstitute escapes, andFB_QUIETandFB_WARNreturn what was converted and leave the rest in the source variable, as on perl5; before, every mode behaved as the default. The UTF-16 and UTF-32 encodings report surrogates, noncharacters and partial characters with perl5’s messages.:encodinglayers no longer replace a character that straddles a read buffer boundary with U+FFFD; a 6 KiB file of three-byte characters lost characters at three places.:encoding(UTF-16LE),:encoding(koi8-r)and the other new encodings work for reading and writing,$PerlIO::encoding::fallbackis reset on the layer’s first use as on perl5, andrequire PerlIO::encodingat run time no longer dies with “Out of memory during stack extend”.Storable writes and reads perl5’s format byte for byte: an image stored by perl5 retrieves on pperl and the other way round, and with
$Storable::canonicalboth write identical bytes. Hooks (STORABLE_freeze,STORABLE_thaw,STORABLE_attach), code references, regexps, tied and restricted hashes, weak references and images written by Storable versions before 0.7 are handled, and the module’s Perl half is upstream’sStorable.pm. Storable’s own test suite passes all 2,728 assertions it passes on perl5. Freezing a tied hash stored none of its keys; it now stores the tie object, as perl5 does.Thawing untrusted data: a Storable image whose class name was crafted Perl code ran that code when it was thawed; class methods are now looked up without compiling anything. A truncated image returns undef without setting
$@, a corrupt one croaks with perl5’s message, and an image that blesses a file name intoCGITempFilewarns as perl5 does (CVE-2015-1592).POSIX:
use POSIX;imports POSIX’s default export list; it imported nothing, sofloor,INT_MAXorWIFEXITEDhad to be fully qualified, and Test::TCP did not install. The functions perl5 implements in Perl, such asPOSIX::localtimeandPOSIX::stat, exist, C-only names such asPOSIX::malloccroak with perl5’s advice,use POSIX qw(locale_h)works, and a call with the wrong number of arguments croaks with perl5’s usage message wherePOSIX::abort(1,2,3)aborted andPOSIX::_exit(1,2,3)exited. perl5’s own POSIX test suite gives the same results on pperl, all 4,514 assertions.POSIX time functions:
POSIX::strftimederives the weekday, the day of the year, daylight saving time and the UTC offset from the date instead of trusting optional arguments; called with six fields,%a,%j,%V,%zand%Zwere wrong. POSIX::strftime::Compiler, which Plack and Starman depend on, now installs with--cpan.strftimeno longer cuts its result at 1024 bytes,asctimeaccepts six arguments,ctimehonours$ENV{TZ}, anddifftimetruncates its arguments to integers as perl5 does.POSIX signals:
POSIX::SigActionandPOSIX::SigRtexist, sosigactionworks in its documented form, with a code reference as handler, a signal name such as"INT", and theSAFEflag as perl5 reports it.sigactiongiven an array or scalar reference instead of aPOSIX::SigActioncrashed the interpreter, and one that croaked left signals blocked; both now behave as on perl5.POSIX::SigSetobjects check their arguments,addset(-1)croaks, and can be subclassed.POSIX constants: the 16 terminal speed constants such as
B9600had wrong values (13 instead of 9600), andFP_NAN,FP_INFINITE,FP_ZEROandFP_NORMALwere permuted, sofpclassify(0.0)returned 4 instead of 2.ULONG_MAXis exact,MB_CUR_MAXfollows the locale,FLT_ROUNDSfollowsfesetround, andARG_MAX,LDBL_EPSILON,LDBL_MAXandLDBL_MINcroak as on perl5 instead of returning approximations. POSIX gained 104 constants and re-exports Fcntl’s record-locking constantsF_GETLK,F_SETLKandF_SETLKW.POSIX locale: under a locale such as
de_DE.UTF-8,POSIX::strtod("3,5")returns 3.5,localeconv()reports the locale’s separators, andsetlocale(LC_ALL)returns the locale’s name, as on perl5.localeconvreturns all 24 keys, with -1 for fields the locale leaves unspecified, andmblen,mbtowcandwctombanswer as perl5’s do at the edges,mblen("")being 0.POSIX arguments and results: POSIX functions read arguments that come from a regex capture or a tied variable;
POSIX::floor($1)returned 0. Functions perl5 declares as returning a system result, such assysconf,mkfifoandsetuid, giveundefon failure and “0 but true” for zero, sodefined(mkfifo(...)) or dieworks.strtolandstrtoulaccept the0bprefix,strtoulreturns values above the signed range,strtodin scalar context returns the number, and thePOSIX::Termiosspeed setters accept a baud rate.DBD::SQLite is a new driver over the system’s libsqlite3. It passes 98 of the 103 test files of DBD::SQLite 1.78’s own suite and supports user-defined functions, aggregates and collations, the commit, rollback, update and authorizer hooks, online backup, the catalogue methods and the fts3 Perl tokenizer. Values bind and fetch with the storage class and bytes upstream’s driver gives them, strings with embedded NUL bytes included, and SQL that issues its own
BEGINworks.DBD::Pg supports PostgreSQL arrays in both directions,
COPYthroughpg_putcopydataandpg_getcopydataas well aspg_putlineandpg_getline, savepoints, asynchronous queries (pg_async,pg_ready,pg_result,pg_cancel),cancel,bind_param_inoutandpg_enable_utf8. It exports thePG_*type constants, whereuse DBD::Pg ':pg_types'died, and reportsPRECISION,SCALE,NULLABLE,ParamValues,ParamTypes,pg_lib_versionand the type names inpg_typeas upstream’s driver does.DBD::Pg placeholders and quoting:
quotehonours its type argument, soquote(3.14, SQL_FLOAT)is unquoted and an invalid float dies, and identifiers that are reserved words are quoted. A placeholder written\?stays a literal?operator,:1and binding by name (bind_param('$1', ...)) work,pg_placeholder_dollaronlyandpg_placeholder_nocolonsare honoured, and an array slicearr[1:2]is not taken for a placeholder.dowithout bind values sends the statement unchanged, statements such asSET search_path TO ?run with placeholders, and onlybyteaparameters are sent in binary form; an integer parameter beside abyteaone made the server reject the statement.DBD::MariaDB is a new driver over libmariadb, and DBD::mysql is now a compatibility layer over it that keeps the
dbi:mysql:names and themysql_*attributes. Both gained asynchronous queries (async => 1,mysql_async_ready,mysql_async_result,mysql_fd),table_info,column_info,primary_key_info,foreign_key_infoandstatistics_info, the fullget_infotable,ChopBlanks, implicit reconnect and the numericmysql_serverversionandmysql_clientversion. Placeholders inside comments and afterLIMITare handled as upstream’s driver handles them.DBI: with
InactiveDestroyset, DBD::Pg and DBD::MariaDB leave the connection open when a handle is destroyed, so a forked child no longer closes its parent’s connection. A trueTaintattribute no longer croaks,NAME_hashis defined for a statement without columns, and the drivers’$VERSIONstrings use upstream’s_01form instead of a-pperl1suffix that version checks could not parse.Peta::FFI:
Peta::FFI::closureturns a Perl code reference into a C function pointer that a C library can call, andclosure_freereleases it. Adiein the Perl code does not unwind through the C caller.HTTP::Parser::XS is native, with the same results as the 0.17 module on 26,000 differential cases; it is the parser Plack, Starman and Twiggy use. On input where scanning dominates it is 6.0 times as fast as the module on perl5, and as fast on a typical ten-header request.
Time::Piece:
use Time::Pieceworks, where it died with a dynamic-loading error. Time::Piece 1.41’s Perl modules run on a native implementation of its compiled part, and the distribution’s own 15 test files pass, 1,142 assertions.Term::ReadLine::Gnu provides all 160 functions of the 1.47 module’s compiled part and runs the distribution’s own
Gnu.pm, embedded in pperl rather than taken from a perl5 installation. Perl callbacks such ascompletion_entry_functionand those added withadd_defunare called; before, they were stored and ignored.glob: the built-ingloband<*.c>use File::Glob, as on perl5, instead of starting a shell for every call. Results no longer depend on the locale’s collation order,$File::Glob::DEFAULT_FLAGSis honoured, and 200 globs take about 10 ms instead of 520 ms. File::Glob’s constants have perl5’s values,bsd_globsorts names differing only in case as perl5 does, anduse File::Glob ':bsd_glob'replacesglob.Socket has the 118 constants and seven functions it lacked, among them
pack_ip_mreqand its relatives, without which joining a multicast group was impossible, andsockaddr_un.unpack_sockaddr_unvalidates its argument, the deprecatedAI_IDN_*andNI_IDN_*constants croak as on perl5, and the:crlftag exports$CR,$LFand$CRLF.Fcntl has the record-locking constants
F_GETLK,F_SETLK,F_SETLKW,F_RDLCK,F_WRLCKandF_UNLCK, and 48 more. A plainuse Fcntlexports upstream’s 68 names,:Fcompatand:modehold the right names,S_ENFMTandS_ISTXTare absent as on perl5 on Linux, and theS_IS*functions return perl5’s true and false values.File::Temp:
unlink0compares the file handle with the path before deleting, so a file swapped in after creation is no longer removed, and theMEDIUMandHIGHsafety levels are enforced instead of being treated asSTANDARD. A File::Temp object keeps its file name and unlink flag in its glob, so${*$fh}gives the name, andFile::Temp::cleanup()no longer deletes the file of an object that is still alive.Imports from native modules: overwriting a sub imported from a native module, as Net::Ping does with Socket’s
SO_BINDTODEVICE, freed the module’s own sub and could crash the program later; imports now hold a reference, as on perl5. Import lists accept/pattern/entries (use POSIX qw(/^S_I/)) and variables, and twelve native modules, among them Socket, Cwd and Scalar::Util, report perl 5.44’s module versions, souse Socket 2.041works.B has every method perl5’s B has, among them the
B::REGEXPmethods B::Deparse needs for a sub that uses a regexp, andB::COP::label, without which deparsed code lost its loop labels.B::OP->sizereturns the op’s size in bytes instead of its class number,B::hashandB::cstringgive perl5’s results, and four list-returning methods such asB::AV::ARRAYno longer write past the stack and corrupt memory. B’s own test suite passes 535 of the 539 assertions it passes on perl5.mro: an
@ISAchain deeper than 100 classes no longer dies with “Recursive inheritance detected”; linearisations are cached as in perl5, and every depth measured, up to 500, behaves as on perl5. The C3 “Inconsistent hierarchy” error carries perl5’s merge trace,mro::get_linear_isa($class, 'dfs')honours its second argument and croaks on an unknown name, and a failingnext::methodnames the method and the class.Config:
%Confighas theextensionsandstatic_extkeys, listing the native modules the binary contains, and answers 174 of perl5’s keys, up from 107. Test suites that check$Config{extensions}before running, as perl5’s own do, no longer skip themselves, andConfig::config_rematches as perl5’s does.Devel::Peek:
DumpProgandrunops_debugwork,use Devel::Peek ':opd=stP'sets the debugging flags, and the module’s exports and variables, such as$D_flagsand%EXPORT_TAGS, match perl5’s.IO::Handle:
ungetcaccepts every code point perl5 accepts, including those above U+10FFFF, and treats negative and very large arguments as perl5 does;setbufcroaks only on output handles.Data::Dumper, List::Util, Time::HiRes:
print Dumper($x)printed its arguments before the dump, andTime::HiRes::statin scalar context returned a wrong value; both behave as on perl5.List::Util::shuffleandsamplefollowsrand, sosrand(42)gives perl5’s permutation;shufflereturned the same order on every call, andsamplecould return its count argument.Other native modules:
Cwd::fast_realpathexists,Hash::Util::hash_seedreturns the full 32-byte seed, andHash::Util::bucket_ratioof an empty hash is 0. SDBM_File’s methods called with too few arguments croak with a usage message instead of crashing, andattributes::getfinds the handler of a glob aliased from another package.
Command line#
Programs on standard input: pperl reads the program from standard input the three ways perl5 does,
pperl < prog.pl,pperl - < prog.plandpperl /dev/stdin < prog.pl, with$0set as perl5 sets it. All three were refused.--cpan:pperl --cpan MODULE...runs cpanm under pperl, installing into the library tree pperl searches, and--cpan --systeminstalls into/usr/local/share/pperl. When building a distribution’s C part fails, it installs the pure-Perl files, which many such distributions fall back to, and names each distribution it did this for; Params::Validate installs and runs this way. Modules installed into~/.pperl(or$PPERL_HOME) are found without settingPPERL5LIB.Command-line switches:
--ends switch processing and is removed from the arguments, as on perl5; pperl listed it in its usage text but rejected it. Several-eor-Eswitches form one program, joined by newlines, where only the last one used to run, and the Makefiles ExtUtils::MakeMaker writes rely on both. With-e, a program argument that looks like a switch reaches@ARGV.-Iin option clusters:pperl -wIlibis-wplus-Ilib, as on perl5; it died with “Unknown option: -I”.
Documentation#
Translations: the catalogues of all 41 translation languages were brought up to date with the English pages for the first time since April, and the pages that had none, among them the CPAN tutorial, HTTP::Parser::XS and Time::Piece, are translated in every language. Slovak gained the complete perlfunc reference, and Hebrew and Greek the module reference, which raised them from 79.3% and 76.2% to 93.0% and 92.9%.
Translation fixes: 665 translated headings in all 41 languages that begin with a number, a dash,
#or>, among them the numbered headings of the licence page, were displayed in English and now appear translated. Links to the perlfunc categories carry the translated category name, about 9,500 labels, and the line “Fully compatible with upstream Perl 5.44.” is translated again on the 217 perlfunc pages of 40 languages where it had fallen back to English.CPAN tutorial: a new tutorial covers installing CPAN modules with
pperl --cpan, the modules already built into pperl, how modules that need a C compiler are handled, and troubleshooting.Module reference: 14 module descriptions on the index pages that were cut off mid-sentence, among them HTTP::Parser::XS, are complete, and the pages for IO::Handle, Time::HiRes, PerlIO::mmap and Data::Dumper show descriptions instead of implementation notes.
List::Util::shufflehas its own page.perlfunc reference: factual errors were corrected on the pages for
abs,semop,shmget,send,crypt,getnetbyaddr,getservbyport,qqandexists;shmgetnow states that a key of 0 isIPC_PRIVATE.How-to page: guides and tutorials are separate sections of cards, and the entry for programmers coming from other languages names every guide that exists, PHP, Ruby, Lua, sed, awk, shell and Tcl included.