Discussion:
[Mason-devel] Auditing mason components programmatically
C.J. Adams-Collier
2007-09-21 04:19:43 UTC
Permalink
Hey folks,

I have the daunting task of documenting our huge codebase. So... I
thought I would try to go about it programmatically. I'd like to
build an inheritance tree from the <%flags> inherit => $parent
</%flags> block as well as a usage tree from $m->comp() and <& $comp
&> calls.

I'm keeping a few notes in my wiki...

http://colliertech.org/index.php/HTML::Mason::Manage

Can someone tell me where I should start? Will
Mason::Component->fetch_comp() give me component attributes, method
list, shared_vars, etc. without much trouble?

Cheers,

C.J.
--
moo.
Dave Rolsky
2007-09-22 04:17:11 UTC
Permalink
Post by C.J. Adams-Collier
http://colliertech.org/index.php/HTML::Mason::Manage
Can someone tell me where I should start? Will
Mason::Component->fetch_comp() give me component attributes, method
list, shared_vars, etc. without much trouble?
It might be more effective to just write your own compiler subclass that
records the info you want. You'd get a lot more fine-grained detail and
you wouldn't have to do things like parse the <%args> blocks, since that
would be done for you.

If you look in the repo, there's a module named
HTML::Mason::Compiler::Events that implements a very simple compiler
subclass that just echoes out little bits of info about a component as its
called. I haven't used it in a long time, but it might be a good start for
a new compiler.


-dave

/*===================================================
VegGuide.Org www.BookIRead.com
Your guide to all that's veg. My book blog
===================================================*/
C.J. Adams-Collier
2007-09-22 14:18:19 UTC
Permalink
Thanks Dave. This looks perfect. Maybe I'll strip out
redundant/insignificant whitespace while I'm at it...
Post by Dave Rolsky
Post by C.J. Adams-Collier
http://colliertech.org/index.php/HTML::Mason::Manage
Can someone tell me where I should start? Will
Mason::Component->fetch_comp() give me component attributes, method
list, shared_vars, etc. without much trouble?
It might be more effective to just write your own compiler subclass that
records the info you want. You'd get a lot more fine-grained detail and
you wouldn't have to do things like parse the <%args> blocks, since that
would be done for you.
If you look in the repo, there's a module named
HTML::Mason::Compiler::Events that implements a very simple compiler
subclass that just echoes out little bits of info about a component as its
called. I haven't used it in a long time, but it might be a good start for
a new compiler.
-dave
/*===================================================
VegGuide.Org www.BookIRead.com
Your guide to all that's veg. My book blog
===================================================*/
--
moo.
Loading...