Permalink
Browse files

Use Devel::Declare until B::Hooks::Parser is fixed for 5.14 on string…

… evals
  • Loading branch information...
1 parent 9fbacfc commit 0b145fa457bc31068ca25d28c524a8d34197f422 @clkao committed May 30, 2011
Showing with 11 additions and 11 deletions.
  1. +1 −1 Makefile.PL
  2. +10 −10 lib/invoker.pm
View
2 Makefile.PL
@@ -13,7 +13,7 @@ configure_requires 'B::Hooks::OP::Check';
requires 'B::Hooks::OP::Check';
requires 'B::Hooks::EndOfScope';
-requires 'B::Hooks::Parser' => '0.07';
+requires 'Devel::Declare' => '0.006004';
requires 'B::OPCheck';
my $pkg = ExtUtils::Depends->new('invoker', 'B::Hooks::OP::Check');
View
20 lib/invoker.pm
@@ -8,24 +8,24 @@ use B::Hooks::EndOfScope;
our $VERSION = "0.29_003";
-use B::Hooks::Parser;
+use Devel::Declare;
require XSLoader;
XSLoader::load(__PACKAGE__, $VERSION);
sub import {
my ($class) = @_;
- my $parser = B::Hooks::Parser::setup();
+ my $parser = Devel::Declare::setup();
- my $linestr = B::Hooks::Parser::get_linestr();
- my $offset = B::Hooks::Parser::get_linestr_offset();
- B::Hooks::Parser::inject('use B::OPCheck const => check => \&invoker::_check;');
+ my $linestr = Devel::Declare::get_linestr();
+ my $offset = Devel::Declare::get_linestr_offset();
+ substr($linestr, $offset, 0) = 'use B::OPCheck const => check => \&invoker::_check;';
+ Devel::Declare::set_linestr($linestr);
my $hook = $class->setup;
on_scope_end {
$class->teardown($hook);
- B::Hooks::Parser::teardown($parser);
};
return;
@@ -35,12 +35,12 @@ sub _check {
my $op = shift;
return unless ref($op->gv) eq 'B::PV';
- my $linestr = B::Hooks::Parser::get_linestr;
- my $offset = B::Hooks::Parser::get_linestr_offset;
+ my $linestr = Devel::Declare::get_linestr;
+ my $offset = Devel::Declare::get_linestr_offset;
if (substr($linestr, $offset-2, 3) eq '$->') {
- substr($linestr, $offset-2, 3, '$-->');
- B::Hooks::Parser::set_linestr($linestr);
+ substr($linestr, $offset-2, 3) = '$-->';
+ Devel::Declare::set_linestr($linestr);
}
}

0 comments on commit 0b145fa

Please sign in to comment.