<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Dec 3, 2007, at 4:38 PM, Ian Docherty wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"> <div bgcolor="#ffffff" text="#000000">Tatsuhiko Miyagawa wrote: <blockquote cite="mid:693254b90712031159g37160be4gb71ef9787becb973@mail.gmail.com" type="cite">  <pre wrap="">On 12/3/07, Ian Docherty <a class="moz-txt-link-rfc2396E" href="mailto:catalyst@iandocherty.com">&lt;catalyst@iandocherty.com&gt;</a> wrote:<br></pre>  <blockquote type="cite">    <pre wrap="">On looking at the code for C::V::JSON it creates a new JSON::Any object
but does not pass on any parameters (probably because there is no
standard parameter mappings for the different JSON modules).

I am at a loss as to how to do this without writing my own C::V::JSON<br></pre>  </blockquote>  <pre wrap=""><!---->Can you s/writing my own/submtiting a patch for/?  </pre> </blockquote> <br></div></blockquote><blockquote type="cite">A quick patch that works for me, please see if it is compatible with the way you want the code to work. (Apologies if the&nbsp; patch is not correct, I am not too familiar with creating patch files).<br><br></blockquote>Although I like the idea, this patch will blow up on anyone who is already using the package, as you don't provide any defaults for the new accessor. &nbsp;You probably want to replace:</div><div><br class="webkit-block-placeholder"></div><div>my $json = JSON::Any-&gt;new(%{$self-&gt;params}); # create the copy of JSON handler</div><div><br class="webkit-block-placeholder"></div><div>with</div><div><br class="webkit-block-placeholder"></div><div>my $json = JSON::Any-&gt;new( %{ $self-&gt;params || {} } ); # create the copy of JSON handler</div><div><br><blockquote type="cite"><div bgcolor="#ffffff" text="#000000"> @@ -9,7 +9,7 @@<br> &nbsp;use Catalyst::Exception;<br> &nbsp;require JSON::Any;<br> <br> -__PACKAGE__-&gt;mk_accessors(qw( allow_callback callback_param expose_stash encoding json_dumper no_x_json_header ));<br> +__PACKAGE__-&gt;mk_accessors(qw( params allow_callback callback_param expose_stash encoding json_dumper no_x_json_header ));<br> <br> &nbsp;sub new {<br> &nbsp;&nbsp;&nbsp;&nbsp; my($class, $c, $arguments) = @_;<br> @@ -29,7 +29,7 @@<br> <br> &nbsp;&nbsp;&nbsp;&nbsp; eval {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; JSON::Any-&gt;import($driver);<br> -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; my $json = JSON::Any-&gt;new; # create the copy of JSON handler<br> +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; my $json = JSON::Any-&gt;new(%{$self-&gt;params}); # create the copy of JSON handler<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $self-&gt;json_dumper(sub { $json-&gt;objToJson($_[0]) });<br> &nbsp;&nbsp;&nbsp;&nbsp; };<br> <br> @@ -134,6 +134,7 @@<br> &nbsp;&nbsp; MyApp-&gt;config({<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'View::JSON' =&gt; {<br> +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; params&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; {pretty =&gt; 1, indent =&gt; 2},&nbsp; # pass params to the JSON module<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; allow_callback&nbsp; =&gt; 1,&nbsp;&nbsp;&nbsp; # defaults to 0<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; callback_param&nbsp; =&gt; 'cb', # defaults to 'callback'<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; expose_stash&nbsp;&nbsp;&nbsp; =&gt; [ qw(foo bar) ], # defaults to everything<br> <br> </div>  _______________________________________________<br>List: <a href="mailto:Catalyst@lists.scsys.co.uk">Catalyst@lists.scsys.co.uk</a><br>Listinfo: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a><br>Searchable archive: <a href="http://www.mail-archive.com/catalyst@lists.rawmode.org/">http://www.mail-archive.com/catalyst@lists.rawmode.org/</a><br>Dev site: <a href="http://dev.catalyst.perl.org/">http://dev.catalyst.perl.org/</a><br></blockquote></div><br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div>--&nbsp;</div><div>Jason Kohles, RHCA RHCDS RHCE</div><div>email@jasonkohles.com -&nbsp;<a href="http://www.jasonkohles.com/">http://www.jasonkohles.com/</a></div><div>"A witty saying proves nothing."&nbsp; -- Voltaire</div></span></span></div><br class="Apple-interchange-newline"></span> </div><br></body></html>