Subject: | YAML::Base $default_as_code minor regex problem |
I can't tell you how to reproduce this problem because I don't know how
it's getting to this point.
I have an app that works fine from the browser but from the command line
gives "Global symbol "$VAR1" requires explicit package name". This
doesn't make any sense to me how this is happening. In any case, I
stepped through to this point and in the YAML::Base module,
$default_as_code anonymous subroutine the line 'my $code =
$Data::Dumper::Dumper(1)' returns '__$VAR1 = 'YAML::Dumper''.
The next line strips the $VAR1 from the beginning of the line, but fails
because of the spaces. The following fixed it:
-- Base.pm.orig 2006-11-30 11:52:11.000000000 -0700
+++ Base.pm 2006-11-30 11:52:29.000000000 -0700
@@ -162,7 +162,7 @@
require Data::Dumper;
local $Data::Dumper::Sortkeys = 1;
my $code = Data::Dumper::Dumper(shift);
- $code =~ s/^\$VAR1 = //;
+ $code =~ s/^\s*\$VAR1 = //;
$code =~ s/;$//;
return $code;
};