-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getline method is inoperative and maybe outdated #183
Comments
I don't think get line is outdated; can I get a test case that shows this issue? |
What should test case look like? |
Ideally it should be a failing test that shows the problem. We need to know how you are getting this error. There's a simple test case that has some JSON in it at https://github.com/perl-catalyst/catalyst-runtime/blob/master/t/content_negotiation.t that you might want to crib. |
EDIT: Oops, rookie mistake! I tried to install TestContentNegation from CPAN when the module is actually called TestContentNegotiation! EDIT2: However, neither of these modules are found in CPAN! Can you please tell me where that module is to be found? |
That modules is included in the |
generally run test cases from the commandline, in the project root
directory like
prove -lvr t/$NAMEOFTEST
…-jn
On Mon, Apr 24, 2023 at 11:22 AM Graham Knop ***@***.***> wrote:
That modules is included in the t/lib directory.
—
Reply to this email directly, view it on GitHub
<#183 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAR5IZK6MLQYLNJOHKBHBVDXC2SCVANCNFSM6AAAAAAXFH3NOQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Entering the command
|
Hi,
you run prove from the root of your github checkout. If you need help let
me know some times you can do a short Zoom session and I will review it
with you. I 'm (GMT-5) or US Central timezone. -jn
On Wed, Apr 26, 2023 at 1:21 AM Openstreetmapler ***@***.***> wrote:
Entering the command prove -lvr t/content_negotiation.t outputs these
errors (probably because the files are missing or me using perlbrew):
Cannot detect source of 't/content_negotiation.t'! at
/home/nasaruk/perl5/perlbrew/perls/perl-5.22.3/lib/5.22.3/TAP/Parser/IteratorFactory.pm
line 261.
TAP::Parser::IteratorFactory::detect_source(TAP::Parser::IteratorFactory=HASH(0x55b71da73840),
TAP::Parser::Source=HASH(0x55b71da55a30)) called at
/home/nasaruk/perl5/perlbrew/perls/perl-5.22.3/lib/5.22.3/TAP/Parser/IteratorFactory.pm
line 211
TAP::Parser::IteratorFactory::make_iterator(TAP::Parser::IteratorFactory=HASH(0x55b71da73840),
TAP::Parser::Source=HASH(0x55b71da55a30)) called at
/home/nasaruk/perl5/perlbrew/perls/perl-5.22.3/lib/5.22.3/TAP/Parser.pm
line 472
TAP::Parser::_initialize(TAP::Parser=HASH(0x55b71da59f10),
HASH(0x55b71d828e48)) called at
/home/nasaruk/perl5/perlbrew/perls/perl-5.22.3/lib/5.22.3/TAP/Object.pm
line 55
TAP::Object::new("TAP::Parser", HASH(0x55b71d828e48)) called at
/home/nasaruk/perl5/perlbrew/perls/perl-5.22.3/lib/5.22.3/TAP/Object.pm
line 130
TAP::Object::_construct(TAP::Harness=HASH(0x55b71d308220), "TAP::Parser",
HASH(0x55b71d828e48)) called at
/home/nasaruk/perl5/perlbrew/perls/perl-5.22.3/lib/5.22.3/TAP/Harness.pm
line 852
TAP::Harness::make_parser(TAP::Harness=HASH(0x55b71d308220),
TAP::Parser::Scheduler::Job=HASH(0x55b71d75ee90)) called at
/home/nasaruk/perl5/perlbrew/perls/perl-5.22.3/lib/5.22.3/TAP/Harness.pm
line 651
TAP::Harness::_aggregate_single(TAP::Harness=HASH(0x55b71d308220),
TAP::Parser::Aggregator=HASH(0x55b71d757948),
TAP::Parser::Scheduler=HASH(0x55b71d75ee30)) called at
/home/nasaruk/perl5/perlbrew/perls/perl-5.22.3/lib/5.22.3/TAP/Harness.pm
line 743
TAP::Harness::aggregate_tests(TAP::Harness=HASH(0x55b71d308220),
TAP::Parser::Aggregator=HASH(0x55b71d757948), "t/content_negotiation.t")
called at
/home/nasaruk/perl5/perlbrew/perls/perl-5.22.3/lib/5.22.3/TAP/Harness.pm
line 558
TAP::Harness::__ANON__() called at
/home/nasaruk/perl5/perlbrew/perls/perl-5.22.3/lib/5.22.3/TAP/Harness.pm
line 571
TAP::Harness::runtests(TAP::Harness=HASH(0x55b71d308220),
"t/content_negotiation.t") called at
/home/nasaruk/perl5/perlbrew/perls/perl-5.22.3/lib/5.22.3/App/Prove.pm line
546
App::Prove::_runtests(App::Prove=HASH(0x55b71d2dfc98),
HASH(0x55b71d71f460), "t/content_negotiation.t") called at
/home/nasaruk/perl5/perlbrew/perls/perl-5.22.3/lib/5.22.3/App/Prove.pm line
504
App::Prove::run(App::Prove=HASH(0x55b71d2dfc98)) called at
/home/nasaruk/perl5/perlbrew/perls/perl-5.22.3/bin/prove line 13
…
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.
Message ID: ***@***.***
com>
|
I don’t have a GitHub checkout. I am running a Catalyst project in a local git repository. |
same thing
…On Tue, May 2, 2023 at 2:13 AM Openstreetmapler ***@***.***> wrote:
I don’t have a GitHub checkout. I am running a Catalyst project in a local
git repository.
—
Reply to this email directly, view it on GitHub
<#183 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAR5IZO55QGQGEUJL5IJUMDXECXY5ANCNFSM6AAAAAAXFH3NOQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
you run prove from the directory that has the 't' directory in it
…On Tue, May 2, 2023 at 7:17 AM john napiorkowski ***@***.***> wrote:
same thing
On Tue, May 2, 2023 at 2:13 AM Openstreetmapler ***@***.***>
wrote:
> I don’t have a GitHub checkout. I am running a Catalyst project in a
> local git repository.
>
> —
> Reply to this email directly, view it on GitHub
> <#183 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAR5IZO55QGQGEUJL5IJUMDXECXY5ANCNFSM6AAAAAAXFH3NOQ>
> .
> You are receiving this because you commented.Message ID:
> ***@***.***>
>
|
Where is that directory? |
should be the directory that has the .git directory for the git checkout -jn
…On Tue, May 2, 2023 at 10:05 AM Openstreetmapler ***@***.***> wrote:
Where is that directory?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
No matter where I run the command (even in the Catalyst project’s root folder), it outputs the errors. There is a
|
I tried running the command with At this point, it feels like this issue is impossible to solve and I just have to re-install Catalyst. 😞 |
TestContentNegotiation is not installed with Catalyst. It is included with the Catalyst-Runtime git repository or with the CPAN release tarball. The test scripts and their related modules do not get installed.
|
Thanks a lot for the info! However, due to vacation, I won’t be able to try it out until May 31st since the issue is work-related in my case. |
If something else had already read from the filehandle, we'd get nothing, and end up throwing an error like: ``` [error] Caught exception in engine "Error Parsing POST 'undef', Error: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "(end of string)") at /home/davidp/perl5/lib/perl5/Catalyst.pm line 4092, <$fh> chunk 11." ``` ... that sounds like we got an empty POST or something, but in fact the problem was that a plugin had caused the request body to have already been read, so the filehandle wasn't at the beginning. This seek means that we will read and parse the whole body content as intended, even if something had already read from the filehandle. I think this will also likely solve perl-catalyst#183.
In my installation of Catalyst, I had to replace this line of code
catalyst-runtime/lib/Catalyst.pm
Line 4091 in ff923f7
with a filehandle read operation (print and comments are not required)
because the
getline
makes the$slurped
variable not have any content, which causes aJSON malformed
error when attempting to access the HTTP request body via$c->req->body_data
:Maybe that
getline
method is heavily outdated and no-one noticed that it ceased to work.The text was updated successfully, but these errors were encountered: