=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
format',
optargs => sub {
arg 'type' => (
comment => 'File type. Supported formats: html, json',
isa => 'Str',
required => 1,
);
arg 'file' => (
comment => 'PickLE pick lis
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