The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Stepford::Grapher::Renderer::Json - Render to a JSON data structure

VERSION

version 1.01

SYNOPSIS

   my $grapher = Stepford::Grapher->new(
       step  => 'My::Step::ExampleStep',
       step_namespaces => ['My::Steps'],
       renderer => Stepford::Grapher::Renderer::Json->new(
           output => 'diagram.json',
       ),
   );
   $grapher->run;

DESCRIPTION

Renders the graph as a simple JSON data structure.

    {
        "Step::ExampleStep":{
            "the_air_that_i_breathe":"Step::Atmosphere",
            "to_love_you":"Step::Love",
        },
        "Step::Love":{
            "person":"Step::Partner",
            "oxytocin":"Step::Hug"
        },
        "Step::Partner":{
            "sugar":"Step::Supermarket",
            "spice":"Step::Supermarket",
            "all_things_nice":"Step::CotedAzur"
        },
        "Step::CotedAzur":{},
        "Step::Supermarket":{},
        "Step::Hug":{},
        "Step::Atmosphere":{
            "rainforest":"Step::Brazil",
            "sunlight":"Step::Sol"
        },
        "Step::Brazil":{},
        "Step::Sol":{}
    }

The data structure is a simple hash of hashes, where the top level keys represent the step class names and the value hashes contain mappings from dependency names to the other steps that fulfill that dependency.

ATTRIBUTE

output

A string containing the filename that the rendered JSON should be written to. By default this is undef, rendering the output to STDOUT.

METHOD

$renderer->render()

Renders the output.

SUPPORT

Bugs may be submitted through https://github.com/maxmind/Stepford-Grapher/issues.

AUTHOR

Mark Fowler <mfowler@maxmind.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 - 2017 by MaxMind, Inc..

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.