Developer-Dashboard

 view release on metacpan or  search on metacpan

lib/Developer/Dashboard/DataHelper.pm  view on Meta::CPAN

package Developer::Dashboard::DataHelper;

use strict;
use warnings;

our $VERSION = '4.16';

use Exporter 'import';

use Developer::Dashboard::JSON qw(json_decode json_encode);

our @EXPORT = qw(j je);

# j($value)
# Encodes a Perl value to canonical JSON text.
# Input: any JSON-encodable Perl value.
# Output: JSON string.
sub j {
    return json_encode( $_[0] );
}

# je($text)
# Decodes JSON text to a Perl value.
# Input: JSON string.
# Output: decoded Perl value.
sub je {
    return json_decode( $_[0] // '' );
}

1;

__END__

=head1 NAME

Developer::Dashboard::DataHelper - older JSON helper compatibility functions

=head1 SYNOPSIS

  use Developer::Dashboard::DataHelper qw(j je);
  my $json = j({ ok => 1 });

=head1 DESCRIPTION

This module provides the small older JSON helper functions used by older
bookmark code blocks.

=head1 FUNCTIONS

=head2 j, je

Encode and decode JSON values.

=for comment FULL-POD-DOC START

=head1 PURPOSE

This module keeps the tiny C<j()> and C<je()> compatibility helpers used by older bookmark code blocks. It maps those short names onto the project-standard JSON::XS encoder and decoder so older bookmark snippets can keep working without dragging a la...

=head1 WHY IT EXISTS

It exists because some bookmark code still expects the older helper names. Preserving them in one compatibility module lets the runtime stay backward-compatible without letting old helper naming spread through new code.

=head1 WHEN TO USE

Use this file when you are touching older bookmark snippets that call C<j()> or C<je()>, or when the project-wide JSON behavior changes and the compatibility layer has to stay in sync.

=head1 HOW TO USE

Import C<j> and C<je> in the bookmark or compatibility path that needs them. Newer runtime code should normally prefer C<Developer::Dashboard::JSON>, but this module remains the right place for the short historical helper names that old bookmark snip...

=head1 WHAT USES IT

It is used by older bookmark code, by compatibility-oriented tests, and by release metadata that keeps the shipped compatibility surface explicit.

=head1 EXAMPLES

Example 1:

  perl -Ilib -MDeveloper::Dashboard::DataHelper -e 1

Do a direct compile-and-load check against the module from a source checkout.

Example 2:



( run in 1.737 second using v1.01-cache-2.11-cpan-600a1bdf6e4 )