]> git.vpit.fr Git - perl/modules/indirect.git/commitdiff
Properly handle heredocs rt115392
authorVincent Pit <perl@profvince.com>
Tue, 12 Jul 2016 14:52:50 +0000 (11:52 -0300)
committerVincent Pit <perl@profvince.com>
Tue, 12 Jul 2016 14:53:54 +0000 (11:53 -0300)
This fixes RT #115392.

MANIFEST
Makefile.PL
indirect.xs
t/50-external.t
t/testcases/rt115392.pl [new file with mode: 0644]

index 9c3bb7e6602a7d2b6bdd2b39a8abc6fa35cfb527..7f3d8d66e4f3eee4f7553ed5979fb9dc38d178b8 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -52,6 +52,7 @@ t/lib/indirect/TestRequired5/c0.pm
 t/lib/indirect/TestRequired5/d0.pm
 t/lib/indirect/TestRequired6.pm
 t/lib/indirect/TestRequiredGlobal.pm
+t/testcases/rt115392.pl
 xsh/caps.h
 xsh/debug.h
 xsh/hints.h
index 430cc537cbcc50834003b28285779cf846eb0508..a084ca5c2833533d1e4a203a7aaa6034d5ff4301 100644 (file)
@@ -65,6 +65,7 @@ my %PREREQ_PM = (
 my %BUILD_REQUIRES =(
  'Config'              => 0,
  'ExtUtils::MakeMaker' => 0,
+ 'File::Spec'          => 0,
  'IO::Handle'          => 0,
  'IO::Select'          => 0,
  'IPC::Open3'          => 0,
index 9e8dc99bdb995fd2979471cf13dadbb945cb04ab..ee702c61c6f64f575a02970da3fafde7206039a5 100644 (file)
@@ -146,6 +146,9 @@ static SV *indirect_hint(pTHX) {
 # ifndef PL_lex_inwhat
 #  define PL_lex_inwhat PL_parser->lex_inwhat
 # endif
+# ifndef PL_multi_close
+#  define PL_multi_close PL_parser->multi_close
+# endif
 #else
 # ifndef PL_linestr
 #  define PL_linestr PL_Ilinestr
@@ -159,6 +162,9 @@ static SV *indirect_hint(pTHX) {
 # ifndef PL_lex_inwhat
 #  define PL_lex_inwhat PL_Ilex_inwhat
 # endif
+# ifndef PL_multi_close
+#  define PL_multi_close PL_Imulti_close
+# endif
 #endif
 
 /* ... Safe version of call_sv() ........................................... */
@@ -333,8 +339,11 @@ static OP *indirect_ck_const(pTHX_ OP *o) {
 
   if (SvPOK(sv) && (SvTYPE(sv) >= SVt_PV)) {
    STRLEN pos;
+   const char *bufptr;
+
+   bufptr = PL_multi_close == '<' ? PL_bufptr : PL_oldbufptr;
 
-   if (indirect_find(sv, PL_oldbufptr, &pos)) {
+   if (indirect_find(sv, bufptr, &pos)) {
     STRLEN len;
 
     /* If the constant is equal to the current package name, try to look for
index ebf123f8487231e30af519891772062bde9e94d4..60ed24469d13ef24921596254bdee9fe8ce3cc28 100644 (file)
@@ -5,7 +5,7 @@ use warnings;
 
 use Config;
 
-use Test::More tests => 6;
+use Test::More tests => 7;
 
 use lib 't/lib';
 use VPIT::TestHelpers 'run_perl';
@@ -67,3 +67,13 @@ SKIP: {
  skip RUN_PERL_FAILED() => ($tests - 1) unless defined $status;
  is $status, 0, 'indirect and local END blocks executed at the end of a forked process';
 }
+
+SKIP: {
+ my $status;
+ for my $run (1 .. 10) {
+  $status = run_perl_file 't/testcases/rt115392.pl';
+  skip RUN_PERL_FAILED() => 1 unless defined $status;
+  last if $status;
+ }
+ is $status, 0, 'RT #115392';
+}
diff --git a/t/testcases/rt115392.pl b/t/testcases/rt115392.pl
new file mode 100644 (file)
index 0000000..9fd84ad
--- /dev/null
@@ -0,0 +1,19 @@
+no indirect;
+
+<<'END_CODE1';
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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