Re: how to debug Mason code?

Emil-Nicolaie Perhinschi <[email protected]> Thu, 25 Sep 2014 11:39:17 +0300
Newsgroups gmane.comp.web.mason.user
Message-ID <CAC0qhnyxRzjKOmwvcQm3QXqo9yHxK3quRDTjT2AQPxyF8TvWEQ@mail.gmail.com>
--===============7350666352539604257==
Content-Type: multipart/alternative; boundary=001a11c248f8725c7e0503dfbc12

--001a11c248f8725c7e0503dfbc12
Content-Type: text/plain; charset=UTF-8

start with https://www.perl.org/books/beginning-perl/, then to read
http://www.masonbook.com/

for Perl you have the perl debugger http://perldoc.perl.org/perldebug.html,
you can run tests scripts to debug your templates with it

HTML::Mason is compiled into Perl code and ran on the backend and the
output, including the js code is sent to the browser; the javascript runs
in the browser: you can't debug them in the same time

On Thu, Sep 11, 2014 at 12:58 PM, -, - <[email protected]> wrote:

> Dear Mason-users!
>
> I'm a software developer from Hungary. We've got a large code which is a
> mix of HTML, Perl, and special Mason commands. Our task is to understand,
> maintain and develop this code.
>
> My question: is there any tool out there which we were able to debug our
> code effectivly? We would like to use breakpoints, step into and step over
> functions, watch variables while the code is running line-by-line, etc...
> Or... is there any way for example to force Komodo or Eclipse to
> handle/able to debug Mason code?
>
> Our giant code has the structure shown below:
>
> <script type="text/javascript">
>     function validateform() {
>         var example1  = /example/;
>         var example2     = example;
>         <JAVASCRIPT CODE HERE>
>     (function($) {
>         $(document).ready(function(){
>             var msg = '<% $message %>';
>             });
>     })(jQuery);
> </script>
>
> <link rel="stylesheet" type="text/css" href="css/stylesheet.css" />
> <div id="debug" style="display:none"></div>
> % if ($info->{attr_changed} =~ /y/) {
>     <div class="alert-status" >
>     <EXAMPLE>
>     </div>
> % }
>
>
> <%method example>
>     <%init>
>         my $f = $path;
>         my $result = open my $fh, "<", $f;
>
>          if(!$result) {
> die "Couldn't open '".$f."' for reading because: ".$!;
>           }
>
>                  my $line_counter;
>                  while(!eof $fh) {
> $line_counter++;
>                           my $line = readline $fh;
> if (index($line, $userinput) > 0) {
>                                          print "EXAMPLE"\n";
>                                          print "\n" . $line =~
> m/($userinput)/;
>                           }
> }
>     </%init>
> </%method>
>
>
>
> We would like to debug our Mason/Javascript/Perl code line-by-line and
> watching the variables meanwhile. Is it possible?
> Our problem is that for example Firebug never displays the mason scripts
> and the Perl code... so I'm unable to put breakpoints into the code, etc.
>
> Please help!
>
> Thank you very much for your answer,
> Regards,
> Zoltan Trencsenyi
>
>
> ------------------------------------------------------------------------------
> Want excitement?
> Manually upgrade your production database.
> When you want reliability, choose Perforce
> Perforce version control. Predictably reliable.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
> _______________________________________________
> Mason-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mason-users
>
>


-- 
==================================
Emil Perhinschi     http://www.lunch-break.ro
==================================

--001a11c248f8725c7e0503dfbc12
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><div>start with <a href=3D"https://www.perl.org/books=
/beginning-perl/">https://www.perl.org/books/beginning-perl/</a>, then to r=
ead <a href=3D"http://www.masonbook.com/">http://www.masonbook.com/</a> <br=
><br></div>for Perl you have the perl debugger <a href=3D"http://perldoc.pe=
rl.org/perldebug.html">http://perldoc.perl.org/perldebug.html</a>, you can =
run tests scripts to debug your templates with it <br><br></div>HTML::Mason=
 is compiled into Perl code and ran on the backend and the output, includin=
g the js code is sent to the browser; the javascript runs in the browser: y=
ou can&#39;t debug them in the same time<br></div><div class=3D"gmail_extra=
"><br><div class=3D"gmail_quote">On Thu, Sep 11, 2014 at 12:58 PM, -, - <sp=
an dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]" target=3D"_blank"=
>[email protected]</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex=
"><div dir=3D"ltr"><font face=3D"arial, sans-serif">Dear Mason-users!</font=
><br><div style=3D"font-size:13px;font-family:arial,sans-serif"><span style=
=3D"color:rgb(0,0,0);font-family:&#39;Times New Roman&#39;;font-size:medium=
"><br></span></div><div style=3D"font-size:13px;font-family:arial,sans-seri=
f"><span style=3D"color:rgb(0,0,0);font-family:&#39;Times New Roman&#39;;fo=
nt-size:medium">I&#39;m a software developer from Hungary.=C2=A0</span><spa=
n style=3D"color:rgb(0,0,0);font-family:&#39;Times New Roman&#39;;font-size=
:medium">We&#39;ve got a large code which is=C2=A0</span><span style=3D"col=
or:rgb(0,0,0);font-family:&#39;Times New Roman&#39;;font-size:medium">a mix=
 of HTML, Perl, and special Mason commands. Our task is to understand, main=
tain and develop this code.</span></div><div style=3D"font-size:13px;font-f=
amily:arial,sans-serif"><span style=3D"color:rgb(0,0,0);font-family:&#39;Ti=
mes New Roman&#39;;font-size:medium"><br></span></div><div style=3D"font-si=
ze:13px;font-family:arial,sans-serif"><font color=3D"#000000" face=3D"Times=
 New Roman" size=3D"3">My question: is there any tool out there which we we=
re able to debug our code effectivly? We would like to use breakpoints, ste=
p into and step over functions, watch variables while the code is running l=
ine-by-line, etc...</font></div><div style=3D"font-size:13px;font-family:ar=
ial,sans-serif"><font color=3D"#000000" face=3D"Times New Roman" size=3D"3"=
>Or... is there any way for example to force Komodo or Eclipse to handle/ab=
le to debug Mason code?=C2=A0</font></div><div style=3D"font-size:13px;font=
-family:arial,sans-serif"><font color=3D"#000000" face=3D"Times New Roman" =
size=3D"3"><br></font></div><div><font color=3D"#000000" face=3D"Times New =
Roman" size=3D"3">Our giant code has the structure shown below:</font></div=
><div><font color=3D"#000000" face=3D"Times New Roman" size=3D"3"><br></fon=
t></div><div><font color=3D"#000000" face=3D"Times New Roman" size=3D"3"><d=
iv>&lt;script type=3D&quot;text/javascript&quot;&gt;</div><div>=C2=A0 =C2=
=A0 function validateform() {</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 var exa=
mple1 =C2=A0=3D /example/;</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 var exampl=
e2 =C2=A0 =C2=A0 =3D example;</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 &lt;JAV=
ASCRIPT CODE HERE&gt;</div><div>=C2=A0 =C2=A0 (function($) {<br></div><div>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 $(document).ready(function(){</div><div>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 var msg =3D &#39;&lt;% $message %&gt;&#3=
9;;</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 });<br></div><div>=
=C2=A0 =C2=A0 })(jQuery);</div><div>&lt;/script&gt;</div><div><br></div><di=
v>&lt;link rel=3D&quot;stylesheet&quot; type=3D&quot;text/css&quot; href=3D=
&quot;css/stylesheet.css&quot; /&gt;</div><div>&lt;div id=3D&quot;debug&quo=
t; style=3D&quot;display:none&quot;&gt;&lt;/div&gt;</div><div>% if ($info-&=
gt;{attr_changed} =3D~ /y/) {</div><div>=C2=A0 =C2=A0 &lt;div class=3D&quot=
;alert-status&quot; &gt;</div><div>=C2=A0 =C2=A0 &lt;EXAMPLE&gt;</div><div>=
=C2=A0 =C2=A0 &lt;/div&gt;</div><div>% }</div><div><br></div><div><br></div=
><div>&lt;%method example&gt;</div><div>=C2=A0 =C2=A0 &lt;%init&gt;</div><d=
iv>=C2=A0 =C2=A0 =C2=A0 =C2=A0 my $f =3D $path;</div><div>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 my $result =3D open my $fh, &quot;&lt;&quot;, $f;</div><div><br>=
</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if(!$result) {</div><div><span=
 style=3D"white-space:pre-wrap">           	</span>die &quot;Couldn&#39;t o=
pen &#39;&quot;.$f.&quot;&#39; for reading because: &quot;.$!;</div><div>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }</div><div><br></div><div>=C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0my $line_counter;</div><di=
v>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0while(!eof =
$fh) {</div><div><span style=3D"white-space:pre-wrap">	                  </=
span>$line_counter++;</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 my $line =3D readline $fh;=
</div><div><span style=3D"white-space:pre-wrap">	                  </span>i=
f (index($line, $userinput) &gt; 0) {</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0print &quot;EXAMPLE&quot;\n&qu=
ot;;</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0print &quot;\n&quot; . $line =3D~ m/($userinput)/;</div><div>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 }</div><div>}</div><div>=C2=A0 =C2=A0 &lt;/%init&gt;</div=
><div>&lt;/%method&gt;</div></font></div><div style=3D"font-size:13px;font-=
family:arial,sans-serif"><font color=3D"#000000" face=3D"Times New Roman" s=
ize=3D"3"><br></font></div><div style=3D"font-size:13px;font-family:arial,s=
ans-serif"><br></div><div style=3D"font-size:13px;font-family:arial,sans-se=
rif"><font color=3D"#000000" face=3D"Times New Roman" size=3D"3"><br></font=
></div><div style=3D"font-size:13px;font-family:arial,sans-serif"><font col=
or=3D"#000000" face=3D"Times New Roman" size=3D"3">We would like to debug o=
ur Mason/Javascript/Perl code line-by-line and watching the variables meanw=
hile. Is it possible?</font></div><div style=3D"font-size:13px;font-family:=
arial,sans-serif"><font color=3D"#000000" face=3D"Times New Roman" size=3D"=
3">Our problem is that for example Firebug never displays the mason scripts=
 and the Perl code... so I&#39;m unable to put breakpoints into the code, e=
tc.</font></div><div style=3D"font-size:13px;font-family:arial,sans-serif">=
<br></div><div style=3D"font-size:13px;font-family:arial,sans-serif">Please=
 help!</div><div style=3D"font-size:13px;font-family:arial,sans-serif"><fon=
t color=3D"#000000" face=3D"Times New Roman" size=3D"3"><br></font></div><d=
iv style=3D"font-size:13px;font-family:arial,sans-serif"><font color=3D"#00=
0000" face=3D"Times New Roman" size=3D"3">Thank you very much for your answ=
er,</font></div><div style=3D"font-size:13px;font-family:arial,sans-serif">=
<font color=3D"#000000" face=3D"Times New Roman" size=3D"3">Regards,</font>=
</div><div style=3D"font-size:13px;font-family:arial,sans-serif"><font colo=
r=3D"#000000" face=3D"Times New Roman" size=3D"3">Zoltan Trencsenyi</font><=
/div></div>
<br>-----------------------------------------------------------------------=
-------<br>
Want excitement?<br>
Manually upgrade your production database.<br>
When you want reliability, choose Perforce<br>
Perforce version control. Predictably reliable.<br>
<a href=3D"http://pubads.g.doubleclick.net/gampad/clk?id=3D157508191&amp;iu=
=3D/4140/ostg.clktrk" target=3D"_blank">http://pubads.g.doubleclick.net/gam=
pad/clk?id=3D157508191&amp;iu=3D/4140/ostg.clktrk</a><br>__________________=
_____________________________<br>
Mason-users mailing list<br>
<a href=3D"mailto:[email protected]">[email protected]=
ceforge.net</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/mason-users" target=
=3D"_blank">https://lists.sourceforge.net/lists/listinfo/mason-users</a><br=
>
<br></blockquote></div><br><br clear=3D"all"><br>-- <br>=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D<br>Emil Perhinschi=C2=A0 =C2=A0=C2=A0 <a href=3D"http://www.lunch=
-break.ro">http://www.lunch-break.ro</a><br>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
</div>

--001a11c248f8725c7e0503dfbc12--


--===============7350666352539604257==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
--===============7350666352539604257==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Mason-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-users

--===============7350666352539604257==--