* Perl 5 stuff I learned or relearned in 2019
@ 2019-12-31 2:43 Eric Wong
0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2019-12-31 2:43 UTC (permalink / raw)
To: meta
It seems like I've learned a lot about Perl5 this year, which
is strange for something I've been using for so long.
Some good, some bad, but damn: Perl is a giant language. 2019
was also my first time using Perl 5.10 features (from 2007).
- the defined-or ("//") operator from 5.10 is awesome
- \w, \s, \d and their inverses match Unicode chars starting with 5.8;
not just the traditional ASCII-only chars (I suspect potential
security vulnerabilities, here)
- Perl 5.16 and earlier had several memory leaks (which could've
affected other projects I've worked on..)
- `# line $NUM "FILE"` comments are interpreted by eval; like CPP
- PerlIO layers, we're using PerlIO::scalar. This is also
independent of the "tie" interface used by IO::Socket::SSL.
Only "tie" seems suitable for non-blocking I/O, though.
- source filters (perlfilter(1), Filter::Simple). One of the
few things I like about Python is indentation, so Acme::Pythonic
here I come! (ok, not for this project, at least :P)
- rediscovering the flexibility and power of "local" on
globals like %SIG, %ENV, etc...
- the semi-colon to distinguish blocks from hashref literals
for "map {;" calls and such (how did I not know that before? :x)
- the native (C) signal handler installed by sigaction does not use
a self-pipe or eventfd; so it's susceptible to missed wakeups.
However, POSIX.pm supports sigprocmask, so I can use signalfd
or kqueue EVFILT_SIGNAL in my event loop depending on OS. In
retrospect, I like this hands off, worse-is-better approach of
the interpreter.
- "fc" (fold-case) for Unicode-aware case comparisons
(only in 5.16+, though)
- XS typemaps saves a lot of boring grunt work (other projects)
Anyways, maybe this helps anybody hacking or thinking about
hacking on this project.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-12-31 2:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-31 2:43 Perl 5 stuff I learned or relearned in 2019 Eric Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).