Discussion:
Mojolicious debugging with perl -d
(too old to reply)
m***@gmail.com
2016-12-02 05:20:22 UTC
Permalink
Hi!

I'am newbie in Mojo.
Please, tell me, how I can run Mojolicious app (not lite), run
in full perl debug mode (perl -d) with breakpoints, vars watch etc.

p.s.
the application which I need debugging have a main package, let's call him
"MyPackage.pm" with function "startup {}", if this important.

Thanks you!
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
Dotan Dimet
2016-12-02 05:58:28 UTC
Permalink
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">perl -d script/my_app get
/route/to/controller<br>
<br>
Stepping through mojo code until it reaches your startup() method
is tricky and time-consuming.<br>
The best way to avoid all that is to add the line<br>
$DB::single = 1;<br>
inside your startup() method code. Then, once you run the
debugger, just hit 'c' at the prompt<br>
and it will break at that position.<br>
<br>
Something worth considering, particularly if you are trying to
debug controller code (or anything that happens in a route),<br>
is that Mojo always runs your app in an Event loop, even in the
debugger, which means that timeouts can happen (will definitely
happen)<br>
while you are pondering your code.<br>
<a class="moz-txt-link-freetext" href="http://mojolicious.org/perldoc/Mojolicious/Guides/FAQ#What-does-Inactivity-timeout-mean">http://mojolicious.org/perldoc/Mojolicious/Guides/FAQ#What-does-Inactivity-timeout-mean</a><br>
You can avoid this by setting
<meta http-equiv="content-type" content="text/html; charset=utf-8">
MOJO_INACTIVITY_TIMEOUT=0 in your environment before starting the
debugger.<br>
<br>
Good Luck,<br>
 Dotan<br>
<br>
<br>
On 02/12/2016 7:20, <a class="moz-txt-link-abbreviated" href="mailto:***@gmail.com">***@gmail.com</a> wrote:<br>
</div>
<blockquote
cite="mid:75a14ce0-8ff2-4d88-ada9-***@googlegroups.com"
type="cite">
<div dir="ltr">Hi!<br>
<br>
I'am newbie in Mojo.<br>
Please, tell me, how I can run Mojolicious app (not lite), run<br>
in full perl debug mode (perl -d) with breakpoints, vars watch
etc.<br>
<br>
p.s.<br>
the application which I need debugging have a main package,
let's call him "MyPackage.pm" with function "startup {}", if
this important.<br>
<br>
Thanks you!<br>
</div>
-- <br>
You received this message because you are subscribed to the Google
Groups "Mojolicious" group.<br>
To unsubscribe from this group and stop receiving emails from it,
send an email to <a moz-do-not-send="true"
href="mailto:mojolicious+***@googlegroups.com">mojolicious+***@googlegroups.com</a>.<br>
To post to this group, send email to <a moz-do-not-send="true"
href="mailto:***@googlegroups.com">***@googlegroups.com</a>.<br>
Visit this group at <a moz-do-not-send="true"
href="https://groups.google.com/group/mojolicious">https://groups.google.com/group/mojolicious</a>.<br>
For more options, visit <a moz-do-not-send="true"
href="https://groups.google.com/d/optout">https://groups.google.com/d/optout</a>.<br>
</blockquote>
<p><br>
</p>
</body>
</html>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &quot;Mojolicious&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:mojolicious+***@googlegroups.com">mojolicious+***@googlegroups.com</a>.<br />
To post to this group, send email to <a href="mailto:***@googlegroups.com">***@googlegroups.com</a>.<br />
Visit this group at <a href="https://groups.google.com/group/mojolicious">https://groups.google.com/group/mojolicious</a>.<br />
For more options, visit <a href="https://groups.google.com/d/optout">https://groups.google.com/d/optout</a>.<br />
m***@gmail.com
2016-12-04 14:59:06 UTC
Permalink
Thank you!
It's work. For one GET request, for example.
But, how I can send POST request? (I am testing code in module
authentication)
And moreover, how I can run and still application in perldebug mode, and
from time to time, stopping him by "ctrl+c", set breakpoint watch vars, and
continue application work, for more deep debugging?
Thanks in advance!
perl -d script/my_app get /route/to/controller
Stepping through mojo code until it reaches your startup() method is
tricky and time-consuming.
The best way to avoid all that is to add the line
$DB::single = 1;
inside your startup() method code. Then, once you run the debugger, just
hit 'c' at the prompt
and it will break at that position.
Something worth considering, particularly if you are trying to debug
controller code (or anything that happens in a route),
is that Mojo always runs your app in an Event loop, even in the debugger,
which means that timeouts can happen (will definitely happen)
while you are pondering your code.
http://mojolicious.org/perldoc/Mojolicious/Guides/FAQ#What-does-Inactivity-timeout-mean
You can avoid this by setting MOJO_INACTIVITY_TIMEOUT=0 in your
environment before starting the debugger.
Good Luck,
Dotan
Hi!
I'am newbie in Mojo.
Please, tell me, how I can run Mojolicious app (not lite), run
in full perl debug mode (perl -d) with breakpoints, vars watch etc.
p.s.
the application which I need debugging have a main package, let's call him
"MyPackage.pm" with function "startup {}", if this important.
Thanks you!
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an
<javascript:>.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
Dotan Dimet
2016-12-04 15:59:13 UTC
Permalink
You can make a POST request with the get command :
http://mojolicious.org/perldoc/Mojolicious/Command/get
But when your arguments get complicated, it might be best to just write
a test - using Test::Mojo - and run that in the debugger:
http://mojolicious.org/perldoc/Mojolicious/Guides/Growing#toc
I wouldn't trust "ctrl+c", because it just breaks the debugger at some
random point in the code (probably somewhere unhelpful inside the event
loop); I think it's better to set up breakpoints in advance. Use the
$DB::single=1 trick to break the debugger at the point the code you're
interested in is already loaded - startup() in your app or the beginning
of an action method of your controller - and then set further
breakpoints, watch vars, etc.
Have fun,
Post by m***@gmail.com
Thank you!
It's work. For one GET request, for example.
But, how I can send POST request? (I am testing code in module
authentication)
And moreover, how I can run and still application in perldebug mode,
and from time to time, stopping him by "ctrl+c", set breakpoint watch
vars, and continue application work, for more deep debugging?
Thanks in advance!
пятМОца, 2 Ўекабря 2016 г., 13:58:32 UTC+8 пПльзПватель Dotan Dimet
perl -d script/my_app get /route/to/controller
Stepping through mojo code until it reaches your startup() method
is tricky and time-consuming.
The best way to avoid all that is to add the line
$DB::single = 1;
inside your startup() method code. Then, once you run the
debugger, just hit 'c' at the prompt
and it will break at that position.
Something worth considering, particularly if you are trying to
debug controller code (or anything that happens in a route),
is that Mojo always runs your app in an Event loop, even in the
debugger, which means that timeouts can happen (will definitely
happen)
while you are pondering your code.
http://mojolicious.org/perldoc/Mojolicious/Guides/FAQ#What-does-Inactivity-timeout-mean
<http://mojolicious.org/perldoc/Mojolicious/Guides/FAQ#What-does-Inactivity-timeout-mean>
You can avoid this by setting MOJO_INACTIVITY_TIMEOUT=0 in your
environment before starting the debugger.
Good Luck,
Dotan
Post by m***@gmail.com
Hi!
I'am newbie in Mojo.
Please, tell me, how I can run Mojolicious app (not lite), run
in full perl debug mode (perl -d) with breakpoints, vars watch etc.
p.s.
the application which I need debugging have a main package, let's
call him "MyPackage.pm" with function "startup {}", if this
important.
Thanks you!
--
You received this message because you are subscribed to the
Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it,
<javascript:>.
Visit this group at https://groups.google.com/group/mojolicious
<https://groups.google.com/group/mojolicious>.
For more options, visit https://groups.google.com/d/optout
<https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the Google
Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
m***@gmail.com
2016-12-05 04:45:16 UTC
Permalink
Can I transfer form's params from command line with POST request? I read
the doc and don't understand, how I can do it. Or for this I need use
test's?

I wouldn't trust "ctrl+c", because it just breaks the debugger at some
Post by Dotan Dimet
random point in the code (probably somewhere unhelpful inside the event
loop); I think it's better to set up breakpoints in advance. Use the
$DB::single=1 trick to break the debugger at the point the code you're
interested in is already loaded - startup() in your app or the beginning of
an action method of your controller - and then set further breakpoints,
watch vars, etc.
may be.
But if I want use "source" debugger command, without change my code?


вПскресеМье, 4 Ўекабря 2016 г., 23:59:19 UTC+8 пПльзПватель Dotan Dimet
Post by Dotan Dimet
http://mojolicious.org/perldoc/Mojolicious/Command/get
But when your arguments get complicated, it might be best to just write a
http://mojolicious.org/perldoc/Mojolicious/Guides/Growing#toc
I wouldn't trust "ctrl+c", because it just breaks the debugger at some
random point in the code (probably somewhere unhelpful inside the event
loop); I think it's better to set up breakpoints in advance. Use the
$DB::single=1 trick to break the debugger at the point the code you're
interested in is already loaded - startup() in your app or the beginning of
an action method of your controller - and then set further breakpoints,
watch vars, etc.
Have fun,
Thank you!
It's work. For one GET request, for example.
But, how I can send POST request? (I am testing code in module
authentication)
And moreover, how I can run and still application in perldebug mode, and
from time to time, stopping him by "ctrl+c", set breakpoint watch vars, and
continue application work, for more deep debugging?
Thanks in advance!
пятМОца, 2 Ўекабря 2016 г., 13:58:32 UTC+8 пПльзПватель Dotan Dimet
perl -d script/my_app get /route/to/controller
Stepping through mojo code until it reaches your startup() method is
tricky and time-consuming.
The best way to avoid all that is to add the line
$DB::single = 1;
inside your startup() method code. Then, once you run the debugger, just
hit 'c' at the prompt
and it will break at that position.
Something worth considering, particularly if you are trying to debug
controller code (or anything that happens in a route),
is that Mojo always runs your app in an Event loop, even in the debugger,
which means that timeouts can happen (will definitely happen)
while you are pondering your code.
http://mojolicious.org/perldoc/Mojolicious/Guides/FAQ#What-does-Inactivity-timeout-mean
You can avoid this by setting MOJO_INACTIVITY_TIMEOUT=0 in your
environment before starting the debugger.
Good Luck,
Dotan
Hi!
I'am newbie in Mojo.
Please, tell me, how I can run Mojolicious app (not lite), run
in full perl debug mode (perl -d) with breakpoints, vars watch etc.
p.s.
the application which I need debugging have a main package, let's call
him "MyPackage.pm" with function "startup {}", if this important.
Thanks you!
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an
<javascript:>.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
m***@gmail.com
2016-12-05 08:48:03 UTC
Permalink
I could make request as follows:
perl -d ./script/myapp.pl get -M POST -H 'Content-Type:
application/x-www-form-urlencoded' -c 'user=username&password=thisspass' /
auth

Thanks you again!

пПМеЎельМОк, 5 Ўекабря 2016 г., 12:45:16 UTC+8 пПльзПватель
Post by m***@gmail.com
Can I transfer form's params from command line with POST request? I read
the doc and don't understand, how I can do it. Or for this I need use
test's?
I wouldn't trust "ctrl+c", because it just breaks the debugger at some
Post by Dotan Dimet
random point in the code (probably somewhere unhelpful inside the event
loop); I think it's better to set up breakpoints in advance. Use the
$DB::single=1 trick to break the debugger at the point the code you're
interested in is already loaded - startup() in your app or the beginning of
an action method of your controller - and then set further breakpoints,
watch vars, etc.
may be.
But if I want use "source" debugger command, without change my code?
вПскресеМье, 4 Ўекабря 2016 г., 23:59:19 UTC+8 пПльзПватель Dotan Dimet
Post by Dotan Dimet
http://mojolicious.org/perldoc/Mojolicious/Command/get
But when your arguments get complicated, it might be best to just write a
http://mojolicious.org/perldoc/Mojolicious/Guides/Growing#toc
I wouldn't trust "ctrl+c", because it just breaks the debugger at some
random point in the code (probably somewhere unhelpful inside the event
loop); I think it's better to set up breakpoints in advance. Use the
$DB::single=1 trick to break the debugger at the point the code you're
interested in is already loaded - startup() in your app or the beginning of
an action method of your controller - and then set further breakpoints,
watch vars, etc.
Have fun,
Thank you!
It's work. For one GET request, for example.
But, how I can send POST request? (I am testing code in module
authentication)
And moreover, how I can run and still application in perldebug mode, and
from time to time, stopping him by "ctrl+c", set breakpoint watch vars, and
continue application work, for more deep debugging?
Thanks in advance!
пятМОца, 2 Ўекабря 2016 г., 13:58:32 UTC+8 пПльзПватель Dotan Dimet
perl -d script/my_app get /route/to/controller
Stepping through mojo code until it reaches your startup() method is
tricky and time-consuming.
The best way to avoid all that is to add the line
$DB::single = 1;
inside your startup() method code. Then, once you run the debugger, just
hit 'c' at the prompt
and it will break at that position.
Something worth considering, particularly if you are trying to debug
controller code (or anything that happens in a route),
is that Mojo always runs your app in an Event loop, even in the
debugger, which means that timeouts can happen (will definitely happen)
while you are pondering your code.
http://mojolicious.org/perldoc/Mojolicious/Guides/FAQ#What-does-Inactivity-timeout-mean
You can avoid this by setting MOJO_INACTIVITY_TIMEOUT=0 in your
environment before starting the debugger.
Good Luck,
Dotan
Hi!
I'am newbie in Mojo.
Please, tell me, how I can run Mojolicious app (not lite), run
in full perl debug mode (perl -d) with breakpoints, vars watch etc.
p.s.
the application which I need debugging have a main package, let's call
him "MyPackage.pm" with function "startup {}", if this important.
Thanks you!
--
You received this message because you are subscribed to the Google
Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Loading...