unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: Perl 5 stuff I learned or relearned in 2019
Date: Tue, 31 Dec 2019 02:43:31 +0000	[thread overview]
Message-ID: <20191231024331.GA10767@dcvr> (raw)

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.

                 reply	other threads:[~2019-12-31  2:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191231024331.GA10767@dcvr \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).