NAME

Devel::Diagram - Discover the classes of an arbitrary suite of Perl modules

SYNOPSIS

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');

DESCRIPTION

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.

METHODS

The few methods you need to activate Devel::Diagram.

new( $moduleSpecifications )

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.

Render( $renderType [, $transformType] )

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.

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.

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.

Any warnings or errors in the rendering process can be found by investigating $@ on return.

TODO

These are some of the things I think can be done to extend Devel::Diagram.

XMI format

Currently UXF is the only XML format supported. XMI is another commonly used format (but more complex).

Fancy HTML rendering

Perhaps with Javascript and/or server side to assist in browsing the codebase.

Class::Struct parsing

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.

Parameters

What are the parameters of the operations?

Other parsing

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.

Other UML diagrams

Collaboration, sequence, etc. (see UML::Sequence).

Devel::Diagram all modules of CPAN

Anybody?

AUTHOR

Devel::Diagram is written and maintained by Glenn Wood, http://search.cpan.org/search?mode=author&query=GLENNWOOD.

COPYRIGHT

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.