Adam Spiers <[EMAIL PROTECTED]> writes:

> Adam Spiers ([EMAIL PROTECTED]) wrote:
> > I just spent this afternoon and this evening knocking this up (see
> > attached PS file).  It's nowhere near complete and probably buggy, but
> > you get the idea.  Could be a useful tool?  (Yes, it will work for any
> > Perl, not just Test::Unit.)
> 
> OK, attached is the generator (a lot better but still unfinished and
> ugly in places), a target class guesser (sorry, no docs yet; read
> the code to understand), and sample output: a much improved diagram
> showing which methods called which, in Test::Unit::*. Usage is:
> 
>   $ perl -MO=Xref,-raw foo.pm > foo.Xrefs
>   $ Xref2dot.pl [ options, see source :-] foo.Xrefs > foo.dot
>   $ dot foo.dot -Tps -o foo.ps
>   $ gv foo.ps
> 
> You can use epssplit or similar to split the diagram over several
> pages if you want to print it.
> 
> I plan to release this properly at some point; I think it could be a
> useful tool. Why did I write it? I was trying to figure out why
> unwanted stacktraces had crept back in, so was hacking around and
> got horribly confused by exception handling and the way
> TestCase::run() calls TestResult::run() which calls
> TestCase::run_bare(). I wished I had an easier way to visualise the
> flow control, and then I discovered B::Xref. Several hours of
> intense hacking later ...
> 
> I was pretty pleased when the run()->run()->run_bare() circular loop
> stuck out like a sore thumb on an otherwise pretty nicely structured
> graph.  See the attached output to see what I mean.  This smelt like
> slightly bad design to me (and to my colleague, who knows much more
> about OO design than me).  Would you agree?  Can it be got rid of?

Probably. Time to go spelunking.

As an aside. I have a dream. I have a dream that one day we'll've
eliminated inner classes from Test::Unit. Or at least made them take
hashes of coderefs instead of strings...

-- 
Piers


_______________________________________________
Perlunit-devel mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/perlunit-devel

Reply via email to