Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 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.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |