[cgiapp] Application params problem
David Baxter
david at sitesuite.com.au
Thu Jul 10 18:50:32 EDT 2008
Hi Amelia,
It looks like you are trying to set the CA params like query params and
I don't think that works. Try a different syntax :
$self->param('validated_query' => $valid_h);
Regards,
*DAVID BAXTER*
* SiteSuite Australasia*
Websites Made Easy
Tel: 61 2 9213 0500
Fax: 61 2 9212 5161
Email: david at sitesuite.com.au <mailto:david at sitesuite.com.au>
Web: www.sitesuite.com.au <http://www.sitesuite.com.au/>
Amelia Ireland wrote:
> 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
>
>
> ##### CGI::Application community mailing list ################
> ## ##
> ## To unsubscribe, or change your message delivery options, ##
> ## visit: http://lists.openlib.org/mailman/listinfo/cgiapp ##
> ## ##
> ## Web archive: http://lists.openlib.org/pipermail/cgiapp/ ##
> ## Wiki: http://cgiapp.erlbaum.net/ ##
> ## ##
> ################################################################
>
>
>
>
More information about the cgiapp
mailing list