Mojo::Reactor::Poll: I/O watcher failed: Can't call method "build_tx" on an undefined value at C:/Perl64/site/lib/Mojo/Server.pm line 23.

464 views
Skip to first unread message

petra

unread,
Oct 7, 2016, 3:52:26 PM10/7/16
to Mojolicious
Hi all,

I just begin to learn Mojo.

But after section Simplified application script and running test, I got such error:

t/login.t .. Mojo::Reactor::Poll: I/O watcher failed: Can't call method "build_tx" on an undefined value at C:/Perl64/site/lib/Mojo/Server.pm line 23.
# Premature connection close

#   Failed test 'GET /'
#   at t/login.t line 21.

Anybody can help to solve this problem?

I am working on Windows 10 and perl 5.24 from ActivePerl.

Thanks in advance.

Heiko Jansen

unread,
Oct 11, 2016, 4:30:32 PM10/11/16
to Mojolicious
Am Freitag, 7. Oktober 2016 21:52:26 UTC+2 schrieb petra:
[...]


But after section Simplified application script and running test, I got such error:

t/login.t .. Mojo::Reactor::Poll: I/O watcher failed: Can't call method "build_tx" on an undefined value at C:/Perl64/site/lib/Mojo/Server.pm line 23.
# Premature connection close

#   Failed test 'GET /'
#   at t/login.t line 21. 

As far as I understand it, the problem is that "myapp.pl" at this step no longer implements the app by itself, but loads it from a module by its name.
The test file still expects to have access to the app by "require"ing the start script, but that no longer works.
In order to have the tests succeed again you have to tell Test::Mojo which app to load.
In other words:

Line 9 in login.t still reads:
my $t = Test::Mojo->new();

But you have to add the name of the app, so it reads:
my $t = Test::Mojo->new('MyApp');

HTH
- Heiko

petra

unread,
Oct 13, 2016, 2:19:53 PM10/13/16
to Mojolicious
Thanks for answer, Heiko.

But in my test script login.t all was right, just like this:

my $t = Test::Mojo->new('MyApp');

After some manipulation all became to work, but i don't know what it was.



пятница, 7 октября 2016 г., 22:52:26 UTC+3 пользователь petra написал:
Reply all
Reply to author
Forward
0 new messages