Skip to content

Commit

Permalink
add JsonEncoder support role
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur Axel 'fREW' Schmidt committed Jun 22, 2012
1 parent 7a79943 commit 7a8135e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/DU/Role/JsonEncoder.pm
@@ -0,0 +1,19 @@
package DU::Role::JsonEncoder;

use Moo::Role;

use JSON::XS ();

has _json_encoder => (
is => 'ro',
lazy => 1,
builder => '_build_json_encoder',
handles => {
encode_json => 'encode',
decode_json => 'decode',
},
);

sub _build_json_encoder { JSON::XS->new }

1;

0 comments on commit 7a8135e

Please sign in to comment.