Group
Extension

Matches 5

OODoc ( M/MA/MARKOV/OODoc-3.04.tar.gz, MARKOV, 2025; MetaCPAN )
OODoc/lib/OODoc/Export/JSON.pm ( view source; MetaCPAN )
ay be broken!

package OODoc::Export::JSON;{
our $VERSION = '3.04';
}

use parent 'OODoc::Export';

use strict;
use warnings;

use Log::Report  'oodoc';

use JSON   ();

#--------------------

sub new
 $class->SUPER::new(serializer => 'json', @_) }

#--------------------

# Bleh: JSON has real true and false booleans :-(
sub boolean($) { $_[1] ? $JSON::true : $JSON::false }


sub write($$%)
{	my ($
fault __x"cannot write output to {file}", file => $output;
	}

	my $json = JSON->new->pretty($args{pretty_print});
	$fh->print($json->encode($data));

	$output eq '-' || $fh->close
		or fault __x"writ
OODoc ( M/MA/MARKOV/OODoc-3.04.tar.gz, MARKOV, 2025; MetaCPAN )
OODoc/lib/OODoc/Export/JSON.pod ( view source; MetaCPAN )
rt::JSON - Dump the parsed docs into JSON

=head1 INHERITANCE

 OODoc::Export::JSON
   is an OODoc::Export
   is an OODoc::Object

=head1 SYNOPSIS

  my $doc = OODoc->new(...);
  $doc->export('json');


  my $exporter = OODoc::Export::JSON->new;

=head1 DESCRIPTION

Create a JSON dump or the parsed documentation, useful to work with dynamically
generated web-pages.

Extends L<"DESCRIPTION" in OODoc
efined in     --Default
  markup      OODoc::Export    <required>
  serializer  OODoc::Export    'json'

=over 2

=item markup => $markup

=item serializer => $name

=back

=back

=head2 Attributes

E
OODoc ( M/MA/MARKOV/OODoc-3.04.tar.gz, MARKOV, 2025; MetaCPAN )
OODoc/lib/OODoc/Export.pod ( view source; MetaCPAN )
xport is extended by
   OODoc::Export::JSON

=head1 SYNOPSIS

  my $doc  = OODoc->new(...);
  my $tree = $doc->export('json');

  my $export = OODoc::Export::JSON->new(markup => 'html');
  my $export 
t->new(serializer => 'json', markup => 'html');
  my $tree   = $export->tree;
  $export->write("a.json", $tree, pretty_print => 1);

=head1 DESCRIPTION

This base-class organizes export transformation
serialization formats.

Current serialization formats:

=over 4

=item L<OODoc::Export::JSON|OODoc::Export::JSON>

=back

Extends L<"DESCRIPTION" in OODoc::Object|OODoc::Object/"DESCRIPTION">.

=head1
OODoc ( M/MA/MARKOV/OODoc-3.04.tar.gz, MARKOV, 2025; MetaCPAN )
OODoc/lib/OODoc/Export.pm ( view source; MetaCPAN )
:Entities qw/encode_entities/;
use POSIX          qw/strftime/;

our %exporters = (
	json   => 'OODoc::Export::JSON',
);

#--------------------

sub new(%)
{	my ($class, %args) = @_;

	$class eq __PAC
OODoc ( M/MA/MARKOV/OODoc-3.04.tar.gz, MARKOV, 2025; MetaCPAN )
OODoc/lib/OODoc.pod ( view source; MetaCPAN )
st> script,
these parameters are read from the configuration in F<Makefile.PL>
(actually F<MYMETA.json>).
Improves base, see L<OODoc::Object/"Constructors">

 -Option      --Default
  distribution  <r
d exporters.  The current
implementation contains three POD formatters, one HTML formatter,
and a JSON exporter.

=head2 How OODoc works

Like with POD, you simply mix your documentation with your cod
(into JSON).

  My-Dist -------+                      +--formatter--> POD
  My-Other-Dist -|--parser--> DocTree --|--formatter--> HTML
  Even-More -----+                      +--exporter---> JSON/HTML

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