From gaurav at ggvaidya.com Sun Feb 15 09:52:37 2009 From: gaurav at ggvaidya.com (Gaurav Vaidya) Date: Mon, 16 Feb 2009 01:52:37 +0800 Subject: [singapore-pm] Class::Sniff - making object inheritance trees In-Reply-To: <154321.71643.qm@web65712.mail.ac4.yahoo.com> References: <154321.71643.qm@web65712.mail.ac4.yahoo.com> Message-ID: <4B6A9234-ADFC-4455-8C34-A2C32B045BF2@ggvaidya.com> Hey there, I saw something cool on the Perl-QA mailing list today, and thought this list might be interested. If you have to document complex object hierarchies [1], the new Class::Sniff module might be helpful. On Feb 16, 2009, at 12:49 AM, Ovid wrote: > If you're struggling to understand a complex app, a graph of the > inheritance hierarchy can be very useful. Here's an example for > TAP::Parser: > > http://i82.photobucket.com/albums/j275/publius_ovidius/Geek%20Stuff/graph-5.png > > It's generated with this code: > > #!/usr/bin/env perl > > use strict; > use warnings; > > use Class::Sniff 0.08; > use TAP::Parser; > my @sniffs = Class::Sniff->new_from_namespace({ > namespace => 'TAP::Parser', > universal => 1, > }); > my $graph = $sniffs[0]->combine_graphs( @sniffs[ 1 .. > $#sniffs ] ); > my $graphviz = $graph->as_graphviz(); > open my $DOT, '|dot -Tpng -o graph.png' > or die("Cannot open pipe to dot: $!"); > print $DOT $graphviz; > > > It should be on the CPAN soon. If you prefer, it's also on github: > > http://github.com/Ovid/class--sniff/tree/master > > Cheers, > Ovid There's a Git repository on GitHub, too, so customizing this for your own use should be pretty easy. Hope this helps! cheers, Gaurav Footnote [1]: Not me -- the best thing about working in a startup is a complete absence of legacy code! :-P From gaurav at ggvaidya.com Wed Feb 25 23:47:26 2009 From: gaurav at ggvaidya.com (Gaurav Vaidya) Date: Thu, 26 Feb 2009 15:47:26 +0800 Subject: [singapore-pm] Fwd: [Slugnet] [OT] Famous Perl One-Liners Explained, Part I In-Reply-To: <3ace93110902251710u29dadd59rcb312e2805ef0972@mail.gmail.com> References: <3ace93110902251710u29dadd59rcb312e2805ef0972@mail.gmail.com> Message-ID: <2665a3df0902252347k374b1e1ek20836d400e3aea77@mail.gmail.com> Hey everybody, There was a pretty nice introductory article on Perl One Liners posted to Slugnet earlier today; if you haven't seen it yet, it's at http://www.catonmat.net/blog/perl-one-liners-explained-part-one/ If you're into Perl one-liners, I'd like to recommend https://twitter.com/perloneliner - it's updated pretty frequently, and has many really good tips. There's many good Perl resources on Twitter, incidently; I'll share them in another thread if anybody's interested. cheers, Gaurav -- Singapore Perl Mongers, now at http://singapore.pm.org/ Join our mailing list now! http://mail.pm.org/mailman/listinfo/singapore-pm