]> git.vpit.fr Git - perl/modules/B-RecDeparse.git/commitdiff
Only fool single_delim when we're coming from B::RecDeparse
authorVincent Pit <vince@profvince.com>
Sat, 1 Nov 2008 13:56:13 +0000 (14:56 +0100)
committerVincent Pit <vince@profvince.com>
Sat, 1 Nov 2008 13:56:13 +0000 (14:56 +0100)
MANIFEST
lib/B/RecDeparse.pm
t/21-single_delim.t [new file with mode: 0644]

index dec81262ef2aa26818d3db4462731e525848b1e3..0c9b3e583511d24a0d4db7809f116c634dccb295 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -12,6 +12,7 @@ t/12-level.t
 t/13-prototypes.t
 t/14-refs.t
 t/20-compile.t
+t/21-single_delim.t
 t/90-boilerplate.t
 t/91-pod.t
 t/92-pod-coverage.t
index 26986677a01a66de8182191f0b2645dd4975744e..db96fd6b763ea091a5707db1ce986c3c6542cdc8 100644 (file)
@@ -112,7 +112,7 @@ if (FOOL_SINGLE_DELIM) {
  no warnings 'redefine';
  *B::Deparse::single_delim = sub {
   my $body = $_[2];
-  if ($body =~ s/^$key//) {
+  if ((caller 1)[0] eq __PACKAGE__ and $body =~ s/^$key//) {
    return $body;
   } else {
    $oldsd->(@_);
diff --git a/t/21-single_delim.t b/t/21-single_delim.t
new file mode 100644 (file)
index 0000000..0ef571d
--- /dev/null
@@ -0,0 +1,15 @@
+#!perl -T
+
+use strict;
+use warnings;
+
+use Test::More tests => 1;
+
+use B::RecDeparse;
+use B::Deparse;
+
+sub wut { "\x{1c}B::RecDeparse\x{1c}"->() }
+
+my $bd = B::Deparse->new();
+my $code = $bd->coderef2text(\&wut);
+like $code, qr/B::RecDeparse/, 'single_delim is only fooled when called from B::RecDeparse';