in reply to Re^5: CGI Action call
in thread CGI Action call

Hi

Tried what you suggested and got the following error:

hash- or arrayref expected (not a simple scalar, use allow_nonref to allow this) at

 my $json_str = encode_json($result);

I tried the allow-nonref (\) and still does not work.

Replies are listed 'Best First'.
Re^7: CGI Action call
by poj (Abbot) on Mar 13, 2018 at 07:15 UTC
    hash- or arrayref expected

    That's because $result is undefined, ie no records were found so you need to decide how to handle that. You could simply encode an empty hash.

    my $json_str = encode_json( $result || {} );
    poj
Re^7: CGI Action call
by Anonymous Monk on Mar 13, 2018 at 02:44 UTC

    Tried what you suggested and got the following error: I tried the allow-nonref (\) and still does not work.

    Hi,

    What do you think is happening?

    What is $result?

    See Basic debugging checklist

      Quite possibly if I knew these answers

      What do you think is happening?What is $result?

      I would not be here seeking your wisdom

      I would like to see what is in result using datadumber but don't know how to get it to work

        Question on JSON object which is what we are dealing with:

        The paper on JSON defines the object as:

        {, string : value ,}

        Examples I have found have no : as a separator but only , and =>

        Confused