]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blobdiff - Magic.xs
Correctly propagate the errors thrown when variable destruction happens at compile...
[perl/modules/Variable-Magic.git] / Magic.xs
index cc403646a401293a8f473da988ab4f6453ee2229..735683c600e192599122ac3d8785809a5fcb68d4 100644 (file)
--- a/Magic.xs
+++ b/Magic.xs
@@ -1022,7 +1022,7 @@ STATIC U32 vmg_svt_len(pTHX_ SV *sv, MAGIC *mg) {
  svr = POPs;
  ret = SvOK(svr) ? (U32) SvUV(svr) : len;
  if (t == SVt_PVAV)
-   --ret;
+  --ret;
  PUTBACK;
 
  FREETMPS;
@@ -1098,8 +1098,16 @@ STATIC int vmg_svt_free(pTHX_ SV *sv, MAGIC *mg) {
 #endif
 
  has_err = SvTRUE(ERRSV);
- if (IN_PERL_COMPILETIME && !had_err && has_err)
-  ++PL_error_count;
+ if (IN_PERL_COMPILETIME && !had_err && has_err) {
+  if (PL_errors)
+   sv_catsv(PL_errors, ERRSV);
+  else
+   Perl_warn(aTHX_ "%s", SvPV_nolen(ERRSV));
+#ifdef PL_parser
+  if (PL_parser)
+#endif
+   ++PL_error_count;
+ }
 
  SPAGAIN;
  svr = POPs;