Virtual Spring Cleaning Interlude, in which I could do more for Perl
Do not ask what Perl can do for you, ask what you can do for Perl!
In my effort to bring the new signature back to older versions of Perl, I'm maintaining Filter::signatures, a source filter that simply converts the signatures to the equivalent old-style Perl code. That filter works surprisingly well for its simplicity and has caused very little in problems.
One bug report I got for it is that the line numbers do not match the original source file when here-documents come into play. This is not a bug with Filter::signatures but a documented misfeature of Filter::Simple, which employs Text::Balanced to do here document extraction and then rewrites the code to an "equivalent" (but not identical) version which messes up line numbers.
It rewrites this code
my @decl3 = (<<'XS', <<'XS');
nananana
XS
batman
XS
to
my @decl3 = (<<'XS'
nananana
XS
, <<'XS'
batman
XS
);
The above code has obviously a different number of lines.
My patch changes Filter::Simple to reconstruct the filtered source code closer to the original. The change has not been applied, but as Steffen is only the maintainer of the distribution and not really actively maintaining the module, I feel that the onus is on me to produce a new release of Filter::Simple.
In theory, doing a new release of Filter::Simple should have little effect as it is a module whose use has not been recommended to use for anything in the past ten years. On the other hand, making changes to a core module, especially one that is certain to be used in code that has not been closely looked at for a longer time makes me somewhat uneasy.
My rough plan for the change is to find time and do a CPAN release of it. After 5.26 has been released, the change can then be pulled up into core. This is a bit ironic, as the reason for my change is Filter::signatures, which exists to use signatures on versions of Perl that don't support signatures. Perl 5.26 supports signatures.
Leave a comment