[dancer-users] Trapping parameters from a dynamic list of checkboxes.

Yitzchak Scott-Thoennes sthoenna at gmail.com
Thu Aug 27 17:24:37 BST 2015


The symbolic reference there is $key; you are (unintentionally, I'd
guess) using print's:

    print FILEHANDLE LIST

syntax, and it is trying to use $key as the filehandle.

Maybe you meant:

    print $key, $input_hash->{ $key }, "\n"

On Thu, Aug 27, 2015 at 8:42 AM, Richard Reina <gatorreina at gmail.com> wrote:
> Hi WK,
>
> Thanks for the reply. Line 577 is the print statement  print $key
> $input_hash->{ $key } . "\n"; In the foreach. I know I shouldn't be printing
> here however, I just want to see what value comes across for for example
> $input_hash->{ '13' } before I create a DB record based on that value.So I
> guess I just need help figuring out how to see or get the value out of
> $input_hash->{ID NUMBER}.
>
>
>
> 2015-08-27 10:07 GMT-05:00 WK <wanradt at gmail.com>:
>>
>> 2015-08-27 17:28 GMT+03:00 Richard Reina <gatorreina at gmail.com>:
>>
>> > After figuring out how to accommodate my placeholder in
>> > selectall_hashref I
>> > did this:
>> >
>> >  my $Accomps = $dbh->selectall_hashref( $q, 'ID', \%attr, $Sid );
>>
>> If you need placeholder here, but you don't have need for any
>> attributes, you may use `undef` here
>>
>> my $Accomps = $dbh->selectall_hashref( $q, 'ID', undef, $Sid );
>>
>> > Then as you suggested I do:
>> >
>> >  # get parameter for accomp type keys
>> >       foreach my $key ( keys %$Accomps ) {
>> >       print "Checking: " . $key . " for value.\n";
>> >       if ( param( $key ) ) {
>> >           $input_hash->{ $key } = $Accomps->{ $key };
>> >           print $key $input_hash->{ $key } . "\n";
>> >       }
>> >       }
>> >
>> > (just printing temporarily to see if it trapped the values)
>>
>> Here we actually don't need values of $Accomps-hashref, we just using
>> it as list to check out form values, so depending of your futher
>> needs, you may assign your specific value here, like, for example:
>>
>>            $input_hash->{ $key } = 1;
>>
>> > However, I get this error:
>> >
>> >  Route exception: Can't use string ("1") as a symbol ref while "strict
>> > refs"
>> > in use at /home/richard/Dancer2/MyApp/bin/../lib/MyApp.pm line 557.
>> >
>> > Any idea what I am doing wrong?
>>
>> What is on line 577 of your MyApp.pm?
>>
>> Wbr,
>> --
>> Kõike hääd,
>>
>> Gunnar
>> _______________________________________________
>> dancer-users mailing list
>> dancer-users at dancer.pm
>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
>
>
>
> _______________________________________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
>


More information about the dancer-users mailing list