title: Perl JSON::XS non-OO interface
body: <p>All of the documentation and examples I have seen for the Perl JSON::XS module use a OO interface, e.g.</p>
  
  <pre><code>print JSON::XS-&gt;new-&gt;ascii()-&gt;pretty()-&gt;canonical()-&gt;encode($in);
  </code></pre>
  
  <p>But I don't necessarily want all those options every time, I'd prefer to send them in a hash like you can with the basic JSON module, e.g.</p>
  
  <pre><code>print to_json($in, { canonical =&gt; 1, pretty =&gt; 1, ascii =&gt; 1 } );
  </code></pre>
  
  <p>sending to that encode_json yields</p>
  
  <pre><code>Too many arguments for JSON::XS::encode_json
  </code></pre>
  
  <p>Is there any way to do that?</p>