NAME

Data::Crumbr::Util - utility functions for Data::Crumbr

VERSION

version 0.1.2

DESCRIPTION

Utility functions for Data::Crumbr.

INTERFACE

id_encoder
my $encoder = id_encoder();

trivial encoding function that just returns its first argument (i.e. no real encoding is performed).

json_leaf_encoder
my $encoder = json_leaf_encoder();

encoding function that returns a JSON-compliant value, only for leaf values. It works on:

  • plain strings, returned after JSON encoding (e.g. tranformation of newlines, etc.)

  • empty array references, in which case string [] is returned

  • empty hash references, in which case string {} is returned

  • null values, in which case string null is returned

uri_encoder
my $encoder = uri_encoder();

encoding function that then encodes strings according to URI encoding (i.e. percent-encoding).

AUTHOR

Flavio Poletti <polettix@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2015 by Flavio Poletti <polettix@cpan.org>

This module is free software. You can redistribute it and/or modify it under the terms of the Artistic License 2.0.

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.