Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.
I've just uploaded Class::Sniff 0.07. It no longer has any concept of "tree" (and this made the internal code easier to understand) and you can pass an instance to the constructor -- a minor tweak, but still very useful.
My favorite feature, though, is combining graphs. The following code lets me generate a nice PNG of HTML::TokeParser::Simple's inheritance hierarchy. (Sigh. No images allowed here.)
#!/usr/bin/env perl
use strict;
use warnings;
use Class::Sniff;
use HTML::TokeParser::Simple;
my $html = <<'END_HTML';
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<!-- This is a comment -->
<title>This is a title</title>
<?php
print "<!-- this is generated by php -->";
?>
</head>
<body alink="#0000ff" BGCOLOR="#ffffff">
<h1>Do not edit this HTML lest the tests fail!!!</h1>
<hr class="foo"/>
<hr class="bar"/>
</body>
</html>
END_HTML
my $parser = HTML::TokeParser::Simple->new( string => $html );
my %seen;
my @sniffs;
while ( my $token = $parser->get_token ) {
no warnings 'numeric';
next if $seen{ ref $token }++;
push @sniffs => Class::Sniff->new( { class => $token } );
}
my $sniff = pop @sniffs;
my $graph = $sniff->combine_graphs(@sniffs);
my $graphviz = $graph->as_graphviz();
open my $DOT, '|dot -Tpng -o graph.png' or die("Cannot open pipe to dot: $!");
print $DOT $graphviz;
You could also include UNIVERSAL with the universal => 1 argument to the constructor and all objects will be attached on graphs since that's the ultimate base class for everything.
With Methods (Score:1)
I'm using Class::Sniff to draw inheritance tree with methods. Thank you!
http://blog.8-p.info/2009/02/class-sniff-combine_graphs [8-p.info]
Re: (Score:2)
Sweet! I should play around with that and see if there's a clean way for me to support that directly.