Skip Menu |
 

This queue is for tickets about the Filter-Simple CPAN distribution.

Report information
The Basics
Id: 119932
Status: open
Priority: 0/
Queue: Filter-Simple

People
Owner: Nobody in particular
Requestors: MITHALDU [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: even with a null filter F::S mangles line numbers in code with HEREDOCs
Download (untitled) / with headers
text/plain 561b
Copied from: https://github.com/Corion/filter-signatures/issues/2 Filter: ------------------------------------------------ package Filter::null; use Filter::Simple; FILTER_ONLY code => sub { }, executable => sub { }, ; 1; ------------------------------------------------ Test: ------------------------------------------------ #!perl use strict; use warnings; use Test::More tests => 1; use Filter::null; my $decl = <<'XS'; name($args); XS is __LINE__, 11, "The filter doesn't ruin line numbers"; ------------------------------------------------
Download (untitled) / with headers
text/plain 1.1k
(dumping my observations from source-diving) The mangling of line numbers is due to the indiscriminate use of Text::Balanced::extract_quotelike resp. the reassembly of multiline here document strings in &gen_std_filter_for() . The reassembly doesn't discriminate between inline-use and newline use: my $decl = <<'XS'; foo XS my $decl2 = <<'XS' bar XS ; The likely change is in s/$extractor/${$components[unpack('N',$1)]}/g; which needs to know whether the here-document was "inline" or at the end of a line. This needs to have been remembered in the (implicit) invocations of \&extract_quotelike. The approach I'm currently playing with is a wrapper around extract_quotelike, which stores the information about whether information follows on the same line of the here document declaration ("inline" case) in the class name by blessing into DONT_MATCH_INLINE instead of DONT_MATCH. The case is not completely trivial due to Perl allowing interesting combinations of quoting across multiple lines, for example: my @decl4 = (<<'XS', q{); nananana XS batman }); ... which stores the strings "nananana\n" and "batman\n" in @decl4.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.