Group
Extension

Matches 1

Types-JsonCoercions ( T/TO/TOBYINK/Types-JsonCoercions-0.001.tar.gz, TOBYINK, 2022; MetaCPAN )
Types-JsonCoercions/lib/Types/JsonCoercions.pm ( view source; MetaCPAN )
use 5.008009;
use strict;
use warnings;

package Types::JsonCoercions;

our $AUTHORITY = 'cpan:TOBYINK';
our $VERSION   = '0.001';

use Type::Library 1.004
	-base,
	-declare => qw( ArrayRefJ HashRefJ 
JSON;

sub _code_to_load_package {
	my ( $me, $pkg, $keyword ) = ( shift, @_ );
	$keyword ||= 'do';
	return sprintf(
		'%s { require %s; q[%s] }',
		$keyword,
		$pkg,
		$pkg,
	);
}

sub _code_for_json
		'$%s::JSON ||= ( %s or %s )->new',
		$me,
		$me->_code_to_load_package( 'JSON::MaybeXS', 'eval' ),
		$me->_code_to_load_package( 'JSON::PP' ),
	);
}

my $meta = __PACKAGE__->meta;

my $ToJson = $met

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.