bradcathey has asked for the wisdom of the Perl Monks concerning the following question:
Fellow Monasterians,
It seems like I've seen this done before, but I can't make this work now. I start by assigning a simple hash to a param (BTW, using CGI::Application). Later, I want to add another key-value pair to that param, so:
#EARLIER $self->param( 'sql' => \%sql ); #LATER $self->param( 'sql' => { 'page_id' => 45 } );
This, of course, clobbers the original param and I end up with just the new pair. I suppose I could grab all the pairs back into a hash and then add to it:
my %sql = %{ $self->param('sql') }; $sql{'page_id'} = 45; $self->param( 'sql' => \%sql );
But this seems a bit verbose. *Is* there a way to do this? What's the concept at work here? Thanks in advance.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Adding a hash to a CGI param
by davidrw (Prior) on Jan 03, 2008 at 15:35 UTC | |
by bradcathey (Prior) on Jan 03, 2008 at 15:44 UTC | |
by Anonymous Monk on Jan 03, 2008 at 17:10 UTC |