From ee04074296fdbb037d9460c3f445f13f21fcf39a Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Sat, 10 Oct 2009 16:22:27 +0000 Subject: [PATCH] 2.04 - added RFE from rt.cpan.org (ID: 1218). the ::Interpolate module populates now uses of uninitialized variables in config files itself instead of just letting perl die(). The other suggestion of the RFE was declined. git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@30 be1acefe-a474-0410-9a34-9b3221f2030f --- Changelog | 5 +++++ General/Interpolated.pm | 16 +++++++++++----- README | 2 +- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Changelog b/Changelog index 94f24ea..0a421cc 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,8 @@ + 2.04 - added RFE from rt.cpan.org (ID: 1218). the ::Interpolate + module populates now uses of uninitialized variables in + config files itself instead of just letting perl die(). + The other suggestion of the RFE was declined. + 2.03 - fixed bug in the _parse() routine (better: design flaw). after the last patch for allowing whitespaces in option names, it had a problem with here-docs which diff --git a/General/Interpolated.pm b/General/Interpolated.pm index 5fc1131..34e4ff2 100644 --- a/General/Interpolated.pm +++ b/General/Interpolated.pm @@ -1,5 +1,5 @@ package Config::General::Interpolated; -$Config::General::Interpolated::VERSION = "1.3"; +$Config::General::Interpolated::VERSION = "1.4"; use strict; use Carp; @@ -70,9 +70,15 @@ sub _vars { } else { $value =~ s{$this->{regex}}{ - my $v = $varstack{$3} || $stack->{$3}; - $v = '' if ref($v); - $1 . $v; + my $con = $1; + my $var = $3; + my $v = $varstack{$var} || $stack->{$var}; + if (defined $v) { + $con . $v; + } + else { + croak "Use of uninitialized variable \$" . $var . "\n"; + } }egx; } @@ -210,7 +216,7 @@ See L =head1 VERSION -1.3 +1.4 =cut diff --git a/README b/README index df159df..148b01e 100644 --- a/README +++ b/README @@ -98,4 +98,4 @@ AUTHOR VERSION - 2.03 + 2.04