in reply to Re: Unwrapping values in a template
in thread Unwrapping values in a template
I was all ready to hand you the gold star for this solution, until I realized, it drops the key entirely. Try this somewhere in the code you've suggested, and then try it again after putting the url back up into place in the template, manually:
my %params = %{$config{'template'}}; print $params{'home_url'};
However, this works, but isn't as elegant:
print $config{'template'}->{'home_url'};
Update: After screwing my head on straight, I realized that my initializer for %params was before the modification to the hash, and should have been after. This works properly, as it should:
my %config = ParseConfig(\*DATA); for (keys %{$config{template}}) { if (/^http/) { $config{template}{home_url} = $_; delete $config{template}{$_}; last; } } $Data::Dumper::Sortkeys = \%config; print Dumper(\%config); print $params{'home_url'};
Please ignore that man behind the curtain, it's just me making silly mistakes again.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Unwrapping values in a template
by Anonymous Monk on Nov 15, 2003 at 03:16 UTC | |
by hacker (Priest) on Nov 15, 2003 at 17:56 UTC | |
by Anonymous Monk on Nov 15, 2003 at 19:14 UTC |