NAME

Review::Helper::Util - Small shared functions for Review::Helper.

DESCRIPTION

JSON, UUID and clock helpers used across the distribution. Nothing is exported by default.

SYNOPSIS

use Review::Helper::Util qw/json_encode json_decode gen_uuid now share_dir/;

my $bytes = json_encode({b => 1, a => 2});    # '{"a":2,"b":1}'
my $data  = json_decode($bytes);
my $id    = gen_uuid();
my $when  = now();

EXPORTS

$bytes = json_encode($data)

Encode $data as compact JSON with sorted keys, returned as UTF-8 bytes.

$data = json_decode($bytes)

Decode UTF-8 JSON bytes. Dies on invalid JSON.

$uuid = gen_uuid()

A new UUID v7 string.

$epoch = now()

The current time in integer Unix epoch seconds.

$dir = share_dir()

The distribution's share directory: ux holds the page, skills the shipped skills and standards the specifications and the schema. In a source checkout it is share/ beside lib/, whose entries are symlinks to the repository's top-level ux, skills and standards directories; otherwise it is the installed distribution's share directory.

SOURCE

The source code repository for Review-Helper can be found at https://github.com/exodist/Review-Helper.

MAINTAINERS

Chad Granum <exodist7@gmail.com>

AUTHORS

Chad Granum <exodist7@gmail.com>

COPYRIGHT

Copyright Chad Granum <exodist7@gmail.com>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See https://dev.perl.org/licenses/