{"id":19129829,"url":"https://github.com/syohex/p5-graphviz-dsl","last_synced_at":"2026-06-20T13:31:23.642Z","repository":{"id":5017297,"uuid":"6175918","full_name":"syohex/p5-Graphviz-DSL","owner":"syohex","description":"Perl version of Gviz","archived":false,"fork":false,"pushed_at":"2023-01-12T05:20:01.000Z","size":79,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-03T11:09:20.777Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"rcamp021/InSeasonWebAPI","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/syohex.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-10-11T15:15:01.000Z","updated_at":"2023-01-12T14:10:08.000Z","dependencies_parsed_at":"2023-01-14T11:24:28.662Z","dependency_job_id":null,"html_url":"https://github.com/syohex/p5-Graphviz-DSL","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syohex%2Fp5-Graphviz-DSL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syohex%2Fp5-Graphviz-DSL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syohex%2Fp5-Graphviz-DSL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syohex%2Fp5-Graphviz-DSL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/syohex","download_url":"https://codeload.github.com/syohex/p5-Graphviz-DSL/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240206968,"owners_count":19765036,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T06:08:38.265Z","updated_at":"2025-11-13T13:01:26.706Z","avatar_url":"https://github.com/syohex.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Actions Status](https://github.com/syohex/p5-Graphviz-DSL/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/syohex/p5-Graphviz-DSL/actions?workflow=test) [![MetaCPAN Release](https://badge.fury.io/pl/Graphviz-DSL.svg)](https://metacpan.org/release/Graphviz-DSL)\n# NAME\n\nGraphviz::DSL - Graphviz Perl interface with DSL\n\n# SYNOPSIS\n\n    use Graphviz::DSL;\n\n    my $graph = graph {\n        name 'Sample';\n\n        route main =\u003e [qw/init parse cleanup printf/];\n        route init =\u003e 'make', parse =\u003e 'execute';\n        route execute =\u003e [qw/make compare printf /];\n\n        nodes colorscheme =\u003e 'piyg8', style =\u003e 'filled';\n\n        my $index = 1;\n        for my $n ( nodeset() ) {\n            node($n-\u003eid, fillcolor =\u003e $index++);\n        }\n\n        edges arrowhead =\u003e 'onormal', color =\u003e 'magenta4';\n        edge ['main' =\u003e 'printf'], arrowtail =\u003e 'diamond', color =\u003e '#3355FF';\n        global bgcolor =\u003e 'white';\n\n        node 'execute', shape =\u003e 'Mrecord',\n                        label =\u003e '{\u003cx\u003eexecute | {a | b | c}}';\n        node 'printf',  shape =\u003e 'Mrecord',\n                        label =\u003e '{printf |\u003cy\u003e format}';\n\n        edge ['execute:x' =\u003e 'printf:y'];\n        rank 'same', 'cleanup', 'execute';\n\n        subgraph {\n            global label =\u003e 'SUB';\n            node 'init';\n            node 'make';\n        };\n\n        subgraph {\n            global label =\u003e 'SUB2';\n            multi_route +{\n                'a' =\u003e [qw/b c d/],\n                'd' =\u003e 'e',\n                'f' =\u003e {\n                    'g' =\u003e { 'h' =\u003e 'i'},\n                    'j' =\u003e 'k',\n                },\n            };\n       };\n    };\n\n    $graph-\u003esave(path =\u003e 'output', type =\u003e 'png', encoding =\u003e 'utf-8');\n\n# DESCRIPTION\n\nGraphviz::DSL is Perl version of Ruby gem _Gviz_. This module provide\nDSL for generating DOT file(and image if you install Graphviz dot command).\nOutputted DOT file may be similar to your DSL, because Graphviz::DSL try to\nkeep objects order in DSL(Order of objects in DSL is very important. If you\nchange some objects order, then output image may be changed).\n\n# INTERFACES\n\n## Method in DSL\n\n### `name $name`\n\nSet `$name` as graph name. Default is 'G'.\n\n### `type $type`\n\nSet `$type` as graph type. `$type` should be digraph(directed graph)\nor graph(undirected graph). Default is 'digraph'.\n\n### `add, route`\n\nAdd nodes and them edges. `route` is alias of `add` function.\nYou can call these methods like following.\n\n- `add $nodes`\n\n    Add `$nodes` to this graph. `$nodes` should be Scalar or ArrayRef.\n\n- `add $node1, \\@edges1, $node2, \\@edges2 ...`\n\n    Add nodes and edges. `$noden` should be Scalar or ArrayRef.\n    For example:\n\n        add [qw/a b/], [qw/c d/]\n\n    Add node _a_ and _b_ and add edge a-\u003ec, a-\u003ed, b-\u003ec, b-\u003ed.\n\n### `multi_route(\\%routes])`\n\nAdd multiple routes at once.\n\n    multi_route +{\n        a =\u003e [qw/b c/],\n        d =\u003e 'e',\n        f =\u003e {\n            g =\u003e { h =\u003e 'i'},\n            j =\u003e 'k',\n        },\n    };\n\nequals to following:\n\n    route a =\u003e 'b', a =\u003e 'c';\n    route d =\u003e 'e';\n    route f =\u003e 'g', f =\u003e 'j';\n    route g =\u003e 'h';\n    route h =\u003e 'i';\n    route j =\u003e 'k';\n\n### `node($node_id, [%attributes])`\n\nAdd node or update attribute of specified node.\n\n### `edge($edge_id, [%attributes])`\n\nAdd edge or update attribute of specified edge.\n\n### `nodes(%attributes)`\n\nUpdate attribute of all nodes.\n\n### `edges(%attributes)`\n\nUpdate attribute of all edges.\n\n### `nodeset`\n\nReturn registered nodes.\n\n### `edgeset`\n\nReturn registered edges.\n\n### `global`\n\nUpdate graph attribute.\n\n### `rank`\n\nSet rank.\n\n### `subgraph($coderef)`\n\nCreate subgraph.\n\n## Class Method\n\n### `$graph-\u003esave(%args)`\n\nSave graph as DOT file.\n\n`%args` is:\n\n- path\n\n    Basename of output file.\n\n- type\n\n    Output image type, such as _png_, _gif_, if you install Graphviz(dot command).\n    If _dot_ command is not found, it generate only dot file.\n    `Graphviz::DSL` don't output image if you omit this attribute.\n\n- encoding\n\n    Encoding of output DOT file. Default is _utf-8_.\n\n### `$graph-\u003eas_string`\n\nReturn DOT file as string. This is same as stringify itself.\nGraphviz::DSL overload stringify operation.\n\n# SEE ALSO\n\nGviz [https://github.com/melborne/Gviz](https://github.com/melborne/Gviz)\n\nGraphviz [http://www.graphviz.org/](http://www.graphviz.org/)\n\n# AUTHOR\n\nShohei YOSHIDA \u003csyohex@gmail.com\u003e\n\n# COPYRIGHT\n\nCopyright 2013- Shohei YOSHIDA\n\n# LICENSE\n\nThis library is free software; you can redistribute it and/or modify\nit under the same terms as Perl itself.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyohex%2Fp5-graphviz-dsl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyohex%2Fp5-graphviz-dsl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyohex%2Fp5-graphviz-dsl/lists"}