Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Journal of Stevan (6065)

Thursday September 14, 2006
02:22 PM

Class::MOP browser - Now Smalltalk ain't got nothin' on us

[ #30998 ]

I recently hacked together a very basic Smalltalk-esque class browser for Class::MOP. This is really just a basic proof of concept, and it was pretty simple to build, in fact, it is pretty much all TT code. (My CSS and HTML skills are sorely lacking, so my apologies if it looks really bad).

Of course being a proof of concept, it has many caveats. To start with, it needs the bleeding edge (svn) version of Class::MOP. It does not yet work well with Moose either (this is because the latest Moose is not yet synced up with the bleeding edge Class::MOP).

But it is not all bad news :) it does some really cool stuff as well. To start with, it is not just restircted to Class::MOP and Moose classes. Because Class::MOP is meant to also be able to introspect vanilla Perl OO, it can be used to browse those classes as well. And if you are using Moose or Class::MOP, the browser simply loads all the metaclasses in Class::MOP's metaclass cache, so as long as you load your classes, they will appear in the browser.

The eventual goal is to make this into a more full featured class browser, with full support for both Moose and non-Moose classes & possibly also including documentation (parsed from the POD). But anyway, enough babbling, back to $work for now.

- Stevan

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • This is quite sexy. And I rather like how it looks.
  • Really quite impressive!

    I have no idea how you wrote it. If I had written it, I'd have walked the stashes and went from there. But then, how do you manage to extract the code for specific methods? B::Deparse? Or do you parse the sources themselves?

    • Steffen

      Here [] is the code, it simply uses Class::MOP's introspection rather than walking the stashes, and yes, the method bodies are feed to B::Deparse.

      - Stevan
  • Mostly those pages are being created from structured data...

    I really can't help but wonder what sort of magical things you could do with a combination of something like the Display.Only and Jemplate JSAN modules.

    Send all the data down the pipe at once, and then just render the inline bits client-side :)