CBOR::Free::Decoder
my $decoder = CBOR::Free::Decoder->new()->set_tag_handlers( 2 => sub { DateTime->from_epoch( epoch => shift() ) }, );
This class provides an object-oriented interface to CBOR::Free’s decoder. This interface allows interpretation of tagged values.
Creates a new CBOR decoder object.
Same as CBOR::Free’s static function of the same name but applies any tag handlers configured in set_tag_handlers().
set_tag_handlers()
As in CBOR::Free, any unrecognized tags prompt a warning but are otherwise ignored.
Takes a list of key/value pairs where each key is a tag (i.e., number) and each value is a coderef that CBOR::Free will run when that tag is seen during a decode operation. The coderef will receive the tagged value, and its (scalar) return will be inserted into the decoded data structure.
To unset a tag handler, assign undef to it.
This returns the OBJ.
NOTE: Handlers assigned here will only fire if CBOR::Free itself doesn’t decode the tag. For example, a handler for the “indirection” tag here will be ignored.
To install CBOR::Free, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CBOR::Free
CPAN shell
perl -MCPAN -e shell install CBOR::Free
For more information on module installation, please visit the detailed CPAN module installation guide.