Skip Menu |
 

This queue is for tickets about the Devel-Declare CPAN distribution.

Report information
The Basics
Id: 86861
Status: new
Priority: 0/
Queue: Devel-Declare

People
Owner: Nobody in particular
Requestors: l.mai [...] web.de
Cc:
AdminCc:

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



Subject: declarators don't work in s//.../e
Download (untitled) / with headers
text/plain 1.1k
% cat Foo.pm package Foo; use strict; use warnings; use Devel::Declare; sub import { my $class = shift; my $caller = caller; Devel::Declare->setup_for( $caller, { flub => { const => \&parser }, } ); no strict 'refs'; *{$caller . '::flub'} = sub (&) { $_[0]() }; } sub parser { my ($declarator, $offset) = @_; $offset += Devel::Declare::toke_move_past_token($offset); my $line = Devel::Declare::get_linestr; substr($line, $offset) =~ s/^\s*(\S)(.*?)\1/ { q\x01<<$2>>\x01 }/; Devel::Declare::set_linestr $line; } 'ok' __END__ % cat try.pl #!/usr/bin/perl use strict; use warnings; use feature qw(say); use Foo; BEGIN { say flub |one|; } BEGIN { $_ = ""; s/^/eval 'say flub |two|'/e; } BEGIN { $_ = ""; s/^/say flub |three|/e; } __END__ % perl try.pl <<one>> <<two>> Not enough arguments for main::flub at try.pl line 20, near "flub |" syntax error at try.pl line 20, near "|}" BEGIN not safe after errors--compilation aborted at try.pl line 21. Expected output: <<one>> <<two>> <<three>>


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.