July 2018 Archives

A widespread and broken Perl idiom

The following code is using a widespread Perl idiom, taking advantage of features designed for one-liners:

my $content = do { local ( @ARGV, $/ ) = ("$file"); <> };

Another trick here is the array assignment, which slurps all elements of the list into @ARGV, leaving $/ to undef; that way, the diamond operator will read the entire file at once.

I've been using and publicizing this local @ARGV idiom for years. And I've spent several days last week chasing a bug caused by this line of code.

Wallflower improvements and issues

Wallflower is my static website generator. Well, not really: it's actually generating a static version of any Plack application, provided it behaves reasonably when seen as a static site.

(Read on, I'm asking for help towards the end!)

About BooK

user-pic Pink.