Group
Extension

Matches 3

PickLE ( N/NA/NATHANPC/PickLE-v0.1.0.tar.gz, NATHANPC, 2022; MetaCPAN )
PickLE/lib/PickLE/Exporter/JSON.pm ( view source; MetaCPAN )


=head1 NAME

C<PickLE::Exporter::JSON> - Converts a PickLE document to JSON.

=cut

package PickLE::Exporter::JSON;

use strict;
use warnings;
use autodie;
use JSON::MaybeXS;

use PickLE::Document;
HODS

=over 4

=item I<$%json> = C<PickLE::Exporter::JSON>->C<as_hash>(I<$document>)

Converts a PickLE I<$document> into a hash reference that can be easily
converted to JSON by any of the common lib
raries.

=cut

sub as_hash {
	my ($class, $document) = @_;
	my $json = {
		doctype => 'pickle',
		version => 1,
		name => undef,
		revision => undef,
		description => undef,
		properties => [],
		cate
PickLE ( N/NA/NATHANPC/PickLE-v0.1.0.tar.gz, NATHANPC, 2022; MetaCPAN )
PickLE/lib/App/pickle/OptArgs.pm ( view source; MetaCPAN )
 format',
	optargs => sub {
		arg 'type' => (
			comment  => 'File type. Supported formats: html, json',
			isa      => 'Str',
			required => 1,
		);

		arg 'file' => (
			comment  => 'PickLE pick lis
PickLE ( N/NA/NATHANPC/PickLE-v0.1.0.tar.gz, NATHANPC, 2022; MetaCPAN )
PickLE/lib/App/pickle/export.pm ( view source; MetaCPAN )
trict;
use warnings;
use autodie;
use utf8;
use Moo;

use PickLE::Document;
use PickLE::Exporter::JSON;
use PickLE::Exporter::HTML;

=head1 ATTRIBUTES

=over 4

=item I<document>

PickLE parsed docume
eck if we are even able to export in this file type.
	if ($self->{type} eq 'json') {
		# JSON
		return PickLE::Exporter::JSON->as_string($self->{document});
	} elsif ($self->{type} eq 'html') {
		# HT

	}

	# Unknown type to export.
	die "Unknown type of file to be exported. Supported types: html, json\n";
}

1;

__END__

=back

=head1 AUTHOR

Nathan Campos <nathan@innoveworkshop.com>

=head1 COPYR

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