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

Stevan on 2006-09-14T19:22:55

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


Gleee!

DAxelrod on 2006-09-14T21:13:36

This is quite sexy. And I rather like how it looks.

Impressive

tsee on 2006-09-15T07:09:11

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

Re:Impressive

Stevan on 2006-09-15T16:40:28

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

You'know...

Alias on 2006-09-15T07:42:22

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 :)