[cgiapp] Application params problem
Amelia Ireland
amelia.ireland at gmail.com
Thu Jul 10 17:57:39 EDT 2008
Hi,
I'm having some problems getting and setting parameters in CGI::App.
Initially, I wanted to check my CGI data was OK (using
Data::FormValidator) as part of cgiapp_prerun, and then go on to doing
the main subroutine. However, the parameter setting and retrieval
doesn't seem to be working as I'd hoped, either in cgiapp_prerun or in
one of the application modes.
For example, take this code:
sub check_query_h {
my $self = shift;
my $valid_h; # hashref to store valid data in
[... validation code ...]
$self->param('validated_query', $valid_h);
print STDERR "valid_h: ".Dumper( $valid_h )."\n";
# see what is in the param 'validated_query'
print STDERR "validated_query: ". Dumper( $self-
>param('validated_query') )."\n";
# check all params
print STDERR "all_values: ".Dumper( [ $self->param() ] )."\n";
# try setting params as a hash instead
$self->param('validated_query_2' => $valid_h);
print STDERR "validated_query_2: ".Dumper( $self-
>param('validated_query_2') )."\n";
print STDERR "all_values: ".Dumper( [ $self->param() ] )."\n";
...
in the STDERR, I get:
valid_h: $VAR1 = {
'group_by' => 'none',
'op' => 'or',
'page' => '1',
'page_size' => '20',
'sort' => 'year'
};
validated_query: $VAR1 = 'validated_query';
all_values: $VAR1 = [
'validated_query'
];
validated_query_2: $VAR1 = 'validated_query_2';
all_values: $VAR1 = [
'validated_query_2'
];
Am I making a really simple, stupid error? I can't see what's going
wrong here... any help would be greatly appreciated!
Thanks,
Amelia.
--
Amelia Ireland
GO Editorial Office
http://www.ebi.ac.uk || http://www.berkeleybop.org
BBOP Plant Project: http://bbopgarden.blogspot.com
More information about the cgiapp
mailing list