RFC: Mason::Plugin::WithEncoding

David Baird <[email protected]> Wed, 13 Jan 2016 01:10:14 +0100
Newsgroups gmane.comp.web.mason.user
Message-ID <CAL_-_AzwE5hE=rCKaD7bvxQ2GVjtjj65KJ68-gRn-T9pHpy-Jw@mail.gmail.com>
--===============8327906947171691388==
Content-Type: multipart/alternative; boundary=047d7b5d3e688e9eec05292bfec7

--047d7b5d3e688e9eec05292bfec7
Content-Type: text/plain; charset=UTF-8

This plugin uses Plack::Request::WithEncoding to decode incoming content,
and Encode::encode() to, well, encode outgoing content after Mason has
finished with the request. It uses a little bit of dark arts to inject
Plack::Request::WithEncoding into the stack but it seems justifiable. I'd
be grateful for comments from anyone interested in using it.

https://github.com/davebaird/mason-plugin-withencoding

SYNOPSIS

In your Poet config file:

    # This is important or the first (and *only* the first) request will
    # not use Plack::Request::WithEncoding
    server.load_modules:
        - Mason::Plugin::WithEncoding

    mason:
      extra_plugins:
        - WithEncoding

    server.encoding.request: UTF-8
    server.encoding.response: UTF-8
    server.default_content_type: text/html; charset=UTF-8


Cheers,
Dave.
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
This
email has been sent from a virus-free computer protected by Avast.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

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

<div dir=3D"ltr">This plugin uses Plack::Request::WithEncoding to decode in=
coming content, and Encode::encode() to, well, encode outgoing content afte=
r Mason has finished with the request. It uses a little bit of dark arts to=
 inject Plack::Request::WithEncoding into the stack but it seems justifiabl=
e. I&#39;d be grateful for comments from anyone interested in using it. <br=
><br><a href=3D"https://github.com/davebaird/mason-plugin-withencoding">htt=
ps://github.com/davebaird/mason-plugin-withencoding</a><br><br>SYNOPSIS<br>=
<br>In your Poet config file:<br><br>=C2=A0 =C2=A0 # This is important or t=
he first (and *only* the first) request will<br>=C2=A0 =C2=A0 # not use Pla=
ck::Request::WithEncoding<br>=C2=A0 =C2=A0 server.load_modules:<br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 - Mason::Plugin::WithEncoding<br><br>=C2=A0 =C2=A0 mas=
on:<br>=C2=A0 =C2=A0 =C2=A0 extra_plugins:<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 -=
 WithEncoding<br><br>=C2=A0 =C2=A0 server.encoding.request: UTF-8<br>=C2=A0=
 =C2=A0 server.encoding.response: UTF-8<br>=C2=A0 =C2=A0 server.default_con=
tent_type: text/html; charset=3DUTF-8<br><br><br>Cheers,<br>Dave.<br></div>=
<div id=3D"DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><table style=3D"border-top=
:1px solid #aaabb6;margin-top:30px">
	<tr>
		<td style=3D"width:105px;padding-top:15px">
			<a href=3D"https://www.avast.com/sig-email?utm_medium=3Demail&amp;utm_so=
urce=3Dlink&amp;utm_campaign=3Dsig-email&amp;utm_content=3Dwebmail" target=
=3D"_blank"><img src=3D"https://ipmcdn.avast.com/images/logo-avast-v1.png" =
style=3D"width: 90px; height:33px;"></a>
		</td>
		<td style=3D"width:470px;padding-top:20px;color:#41424e;font-size:13px;fo=
nt-family:Arial,Helvetica,sans-serif;line-height:18px">This email has been =
sent from a virus-free computer protected by Avast. <br><a href=3D"https://=
www.avast.com/sig-email?utm_medium=3Demail&amp;utm_source=3Dlink&amp;utm_ca=
mpaign=3Dsig-email&amp;utm_content=3Dwebmail" target=3D"_blank" style=3D"co=
lor:#4453ea">www.avast.com</a>
		</td>
	</tr>
</table><a href=3D"#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width=3D"1" heigh=
t=3D"1"></a></div>

--047d7b5d3e688e9eec05292bfec7--


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

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
--===============8327906947171691388==
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

--===============8327906947171691388==--