HAL::Tiny - Hypertext Application Language Encoder
use HAL::Tiny; my $resource = HAL::Tiny->new( state => +{ currentlyProcessing => 14, shippedToday => 20, }, links => +{ self => '/orders', next => '/orders?page=2', find => { href => '/orders{?id}', templated => JSON::true, }, }, embedded => +{ orders => [ HAL::Tiny->new( state => +{ id => 10 }, links => +{ self => '/orders/10' }, ), HAL::Tiny->new( state => +{ id => 11 }, links => +{ self => '/orders/11' }, ) ], }, ); $resource->as_json;
HAL::Tiny is a minimum implementation of Hypertext Application Language(HAL).
HAL::Tiny->new(%args);
%args are
The hash of representing the current state.
The hash of links related to the current state.
The hash of embedded objects. Each hash value must be an array of HAL::Tiny objects or a HAL::Tiny object.
Encode to json string.
Copyright (C) Yuuki Furuyama.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Yuuki Furuyama <addsict@gmail.com>
To install HAL::Tiny, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HAL::Tiny
CPAN shell
perl -MCPAN -e shell install HAL::Tiny
For more information on module installation, please visit the detailed CPAN module installation guide.