Re: printing/echo'ing vars/arrays within mason tags?
Pedro Melo <[email protected]> Tue, 16 Aug 2016 18:32:01 +0100
| Newsgroups | gmane.comp.web.mason.user |
|---|---|
| Message-ID | <D3D90C4D.125974%[email protected]> |
> This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --===============2952733598328913474== Content-type: multipart/alternative; boundary="B_3554217166_22634308" > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3554217166_22634308 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit Hi, From: Guido Brugnara <[email protected]> Date: Tuesday, August 16, 2016 4:49 PM To: <[email protected]> Subject: Re: [Mason] printing/echo'ing vars/arrays within mason tags? > > ----- Il 16-ago-16, alle 17:30, Hiram Gibbard <[email protected]> ha scritto: >> Hi All, >> I'm wondering if there is a way to echo or print our vars or arrays within >> the Mason tags? > You can write to standard error, like: > > % use Data::Dumper; > % print STDERR Dumper \%my_hash; > > then you can read the result in the log files (I suppos you work on Apache, > but I think with other servers the beavior is the same). This will work fine. If you want to send to the browser, I recommend this recipe: https://metacpan.org/pod/Data::Printer#Easily-rendering-Data::Printers-outpu t-as-HTML It uses Data::Printer which tends to generate less verbose dumps compared to Data::Dumper or even Data::Dumo (IMVHO, of course). Bye, > > bye > gdo > > ------------------------------------------------------------------------------ > _______________________________________________ Mason-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/mason-users --B_3554217166_22634308 Content-type: text/html; charset="US-ASCII" Content-transfer-encoding: quoted-printable <html><head></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s= pace; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size:= 14px; font-family: Calibri, sans-serif; "><div>Hi,</div><div><br></div><spa= n id=3D"OLK_SRC_BODY_SECTION"><div style=3D"font-family:Calibri; font-size:11pt;= text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medi= um none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-= TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt"><span s= tyle=3D"font-weight:bold">From: </span> Guido Brugnara <<a href=3D"mailto:gdo= @leader.it">[email protected]</a>><br><span style=3D"font-weight:bold">Date: </= span> Tuesday, August 16, 2016 4:49 PM<br><span style=3D"font-weight:bold">To:= </span> <<a href=3D"mailto:[email protected]">mason-users@= lists.sourceforge.net</a>><br><span style=3D"font-weight:bold">Subject: </s= pan> Re: [Mason] printing/echo'ing vars/arrays within mason tags?<br></div><= div><br></div><blockquote id=3D"MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style=3D"BOR= DER-LEFT: #b5c4df 5 solid; PADDING:0 0 0 5; MARGIN:0 0 0 5;"><div><div><div = style=3D"font-family: arial, helvetica, sans-serif; font-size: 10pt; color: #0= 00000"><div><br></div><div><span id=3D"zwchr" data-marker=3D"__DIVIDER__">----- = Il 16-ago-16, alle 17:30, Hiram Gibbard <<a href=3D"mailto:[email protected]= om">[email protected]</a>> ha scritto:<br></span></div><div data-marker=3D= "__QUOTED_TEXT__"><blockquote style=3D"border-left: 2px solid #1010FF; margin-= left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: = normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font= -size: 12pt;" data-mce-style=3D"border-left: 2px solid #1010FF; margin-left: 5= px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal;= text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: = 12pt;"><div dir=3D"ltr">Hi All,<br><div>I'm wondering if there is a way to ech= o or print our vars or arrays within the Mason tags?</div></div></blockquote= >You can write to standard error, like:<br></div><div data-marker=3D"__QUOTED_= TEXT__"><br data-mce-bogus=3D"1"></div><div data-marker=3D"__QUOTED_TEXT__">% us= e Data::Dumper;<br data-mce-bogus=3D"1"></div><div data-marker=3D"__QUOTED_TEXT_= _">% print STDERR Dumper \%my_hash;<br><br data-mce-bogus=3D"1"></div><div dat= a-marker=3D"__QUOTED_TEXT__">then you can read the result in the log files (I = suppos you work on Apache, but I think with other servers the beavior is the= same).<br data-mce-bogus=3D"1"></div></div></div></div></blockquote></span><d= iv><br></div><div>This will work fine. If you want to send to the browser, I= recommend this recipe:</div><div><br></div><div><a href=3D"https://metacpan.o= rg/pod/Data::Printer#Easily-rendering-Data::Printers-output-as-HTML">https:/= /metacpan.org/pod/Data::Printer#Easily-rendering-Data::Printers-output-as-HT= ML</a></div><div><br></div><div>It uses Data::Printer which tends to generat= e less verbose dumps compared to Data::Dumper or even Data::Dumo (IMVHO, of = course).</div><div><br></div><div>Bye,</div><div><br></div><div><br></div><s= pan id=3D"OLK_SRC_BODY_SECTION"><blockquote id=3D"MAC_OUTLOOK_ATTRIBUTION_BLOCKQ= UOTE" style=3D"BORDER-LEFT: #b5c4df 5 solid; PADDING:0 0 0 5; MARGIN:0 0 0 5;"= ><div><div><div style=3D"font-family: arial, helvetica, sans-serif; font-size:= 10pt; color: #000000"><div data-marker=3D"__QUOTED_TEXT__"><br data-mce-bogus= =3D"1"></div><div data-marker=3D"__QUOTED_TEXT__">bye<br data-mce-bogus=3D"1"></di= v><div data-marker=3D"__QUOTED_TEXT__">gdo<br data-mce-bogus=3D"1"></div><div da= ta-marker=3D"__QUOTED_TEXT__"><br data-mce-bogus=3D"1"></div></div></div></div>-= ----------------------------------------------------------------------------= - _______________________________________________ Mason-users mailing list <a href=3D"mailto:[email protected]">[email protected]= forge.net</a> <a href=3D"https://lists.sourceforge.net/lists/listinfo/mason-users">https://= lists.sourceforge.net/lists/listinfo/mason-users</a> </blockquote></span></body></html> --B_3554217166_22634308-- --===============2952733598328913474== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ --===============2952733598328913474== 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 --===============2952733598328913474==--