Skip to content

getline method is inoperative and maybe outdated #183

@Openstreetmapler

Description

@Openstreetmapler

In my installation of Catalyst, I had to replace this line of code

$slurped = $fh->getline;

with a filehandle read operation (print and comments are not required)

            #! WORKAROUND: using the old and reliable filehandle method
            #- because $fh->getline doesn't return the JSON!
            open(FH, $fh);
            $slurped = <FH>;
            print("*DEBUG* slurped is $slurped\n");
            close(FH);
            #! END OF WORKAROUND

because the getline makes the $slurped variable not have any content, which causes a JSON malformed error when attempting to access the HTTP request body via $c->req->body_data:

[2023/04/20 10:31:12] [catalyst] [ERROR] Error Parsing POST 'undef', Error: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 at /home/nasaruk/perl5/lib/perl5/Catalyst.pm line 4092, <$fh> chunk 1.
[2023/04/20 10:31:12] [catalyst] [DEBUG] Response Code: 500; Content-Type: unknown; Content-Length: unknown

Maybe that getline method is heavily outdated and no-one noticed that it ceased to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions