PlantUML::ClassDiagram::Parse - PlantUML class diagram syntax parser
use List::Util qw/first/; use Data::Section::Simple qw/get_data_section/; my $pu_string = get_data_section('synopsis.pu'); my $parse = PlantUML::ClassDiagram::Parse->parse($pu_string); my $classes = $parse->get_classes; # bless( { # 'relations' => [ # bless( { # 'from' => 'Foo', # 'to' => 'Base', # 'name' => 'generalization' # }, 'PlantUML::ClassDiagram::Relation' ) # ], # 'variables' => [ # bless( { # 'attribute' => '', # 'name' => 'foo' # }, 'PlantUML::ClassDiagram::Class::Variable' ) # ], # 'attribute' => '', # 'name' => 'Base', # 'methods' => [ # bless( { # 'name' => 'new', # 'attribute' => 'static' # }, 'PlantUML::ClassDiagram::Class::Method' ), # bless( { # 'name' => 'bar', # 'attribute' => 'abstract' # }, 'PlantUML::ClassDiagram::Class::Method' ) # ] # }, 'PlantUML::ClassDiagram::Class' ), # bless( { # 'methods' => [ # bless( { # 'name' => 'new', # 'attribute' => 'static' # }, 'PlantUML::ClassDiagram::Class::Method' ), # bless( { # 'name' => 'bar', # 'attribute' => '' # }, 'PlantUML::ClassDiagram::Class::Method' ) # ], # 'name' => 'Foo', # 'relations' => [ # $VAR1->[0]{'relations'}[0] # ], # 'variables' => [ # bless( { # 'name' => 'foo', # 'attribute' => '' # }, 'PlantUML::ClassDiagram::Class::Variable' ) # ], # 'attribute' => '' # }, 'PlantUML::ClassDiagram::Class' ) my $foo = first { $_->get_name eq 'Foo' } @$classes; $foo->get_parents; # [ 'Base' ]; __DATA__ @@ synopsis.pu @startuml class Base { foo {static} new() {abstract} bar() } class Foo { foo {static} new() bar() } Foo --|> Base @enduml
PlantUML::ClassDiagram::Parse is parser for PlantUML class diagram syntax It generate objects that represent class structure written in class diagram.
Generate perl module using PlantUML::ClassDiagram::Class objects. In fact you will also use template engine (ex: Text::Xslate) together.
Sample script: See examples/generate_pm_sample.pl
PlantUML::ClassDiagram::Class - represent each class
own class name
'' or 'abstract'
PlantUML::ClassDiagram::Class::Variable objects
PlantUML::ClassDiagram::Class::Method objects
PlantUML::ClassDiagram::Relation objects related in own class
parent class names it guessed from 'generalization' relation
PlantUML::ClassDiagram::Class::Method - represent each method
own method name
'' or 'abstract' or 'static'
PlantUML::ClassDiagram::Class::Variable - represent each member variable
PlantUML::ClassDiagram::Relation - represent class to class relation
own relation name
from class name
to class name
Only support follow relation syntax
Copyright (C) Kenta Kase.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Kenta Kase <kesin1202000@gmail.com>
To install PlantUML::ClassDiagram::Parse, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PlantUML::ClassDiagram::Parse
CPAN shell
perl -MCPAN -e shell install PlantUML::ClassDiagram::Parse
For more information on module installation, please visit the detailed CPAN module installation guide.