Devel::Diagram - Discover the classes of an arbitrary suite of Perl modules
use Devel::Diagram; # Discover classes of a package anchored by a single Perl module. # $diagram = new Devel::Diagram('CGI'); # Discover classes of a package anchored by a collection of modules in a folder. # use Devel::Diagram; $diagram = new Devel::Diagram('HTML/'); # Render the result in your desired format. # print $diagram->Render('UXF20'); # Render the result, then transform it via XSL. # print $diagram->Render('UXF20', 'xsl:uxf20toHtml');
Devel::Diagram scans the given Perl modules attempting to discover the class structure. It produces a hash table that can be converted to XML (or other formats) via Render().
An XSL stylesheet is included that converts the XML class diagram into HTML.
See eg/Diagram.pl for a full example of use.
eg/Diagram.pl
The few methods you need to activate Devel::Diagram.
Here you name the Perl module (or suite) you want to process. Enter the string you would specify in a 'use' or 'require' statement for this module.
You may enter as many module specifications as you like, separated by commas.
Renders the class diagram in the given format. Currently the only format that is recognized is 'UXF20'. These can be extended easily by creating a new Devel::Diagram::Render::<yourName> module.
Devel::Diagram::Render::<yourName
Render() optionally takes a second parameter specifying a transformation on the rendered format, presumably resulting in a new format. For instance,
Render('UXF20', 'xsl:uxf20toHtml')
renders the class diagram as UXF20, then runs it through the XSL transform named uxf20toHtml.xsl.
uxf20toHtml.xsl
Render() expects to find the XSL stylesheet in the xsl folder of Devel::Diagram. You need XML::XSLT::Wrapper and an appropriate XSL transform engine to make this work.
Render()
xsl
Devel::Diagram
XML::XSLT::Wrapper
Any warnings or errors in the rendering process can be found by investigating $@ on return.
$@
These are some of the things I think can be done to extend Devel::Diagram.
Currently UXF is the only XML format supported. XMI is another commonly used format (but more complex).
UXF
XMI
Perhaps with Javascript and/or server side to assist in browsing the codebase.
Class::Struct is also used to code OO Perl. Need to recognize this structure in the codebase. There are also several other modules for class creation.
What are the parameters of the operations?
The is more than one way to do it. OO Perl can be implemented in many ways; Devel::Diagram recognizes a few of them. CPAN is big, really big, so there are OO Perl techniques that Devel::Diagram will not recognize, yet.
Collaboration, sequence, etc. (see UML::Sequence).
UML::Sequence
Anybody?
Devel::Diagram is written and maintained by Glenn Wood, http://search.cpan.org/search?mode=author&query=GLENNWOOD.
Copyright (c) 2003 Glenn Wood All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Devel::Package, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Devel::Package
CPAN shell
perl -MCPAN -e shell install Devel::Package
For more information on module installation, please visit the detailed CPAN module installation guide.