-----BEGIN PGP SIGNED MESSAGE-----

Moin,

On Saturday 24 September 2005 00:15, Michael G Schwern wrote:
> On Fri, Sep 23, 2005 at 07:33:04PM +0200, Tels wrote:
> > Not yet. Good idea. The relevant code is in parse_file() in gen_graph
> > - it gets as option one .pm file and then does something with it.
> >
> > The lopp for each file is in gather_data(), under the recurse branch:
> >
> > I'll redesign the code to be more re-usable and move away from the
> > "file" methodology. But I won't have time until mid-October.
>
> Ok, thanks.  I'll let you know if I get any tuits to work on it before
> then.

Ah, what the heck, I couldn't relax if I have this problem on my mind, 
anyway :)

So I whipped up Graph::Usage 0.10:

        http://bloodgate.com/perl/packages/devel/

it is not on CPAN because it is still a bit rough and I have a flight to 
catch. Anyway, the logic is now in Graph::Usage, which is loaded by 
gen_graph and then simple used. You can choose which package to use for 
processing via the --use command line switch.

There is an example subclass of Graph::Usage in t/lib/Graph/Usage, and 
here is how you would use it:

        perl -It/lib ./gen_graph --use=Graph::Usage::MySubClass
         --recurse=Math::BigInt --versions

I re-arranged the logic to call methods instead of fiddling some things 
directly into the graph, the relevant methods you would want to override 
are:

        parse_file($file);
        add_package($name,$ver);
        add_link ($src,$dst,$type);
        set_package_version($ver);

There also some hooks that are called on strategic points through the 
code:

        sub hook_after_graph_generation
        sub hook_before_colorize
        sub hook_after_colorize

I hope this is usefull, but I can imagine that I missed something or that 
the existing hooks are not enough for your application.

Any feedback (preferable patches :) welcome :)

Best wishes,

Tels

- -- 
 Signed on Sat Sep 24 13:52:59 2005 with key 0x93B84C15.
 Visit my photo gallery at http://bloodgate.com/photos/
 PGP key on http://bloodgate.com/tels.asc or per email.

 "...pornographic images stay in the brain forever." -- Mary Anne Layden;
 "That's a feature, not a bug." -- God

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iQEVAwUBQzU/aHcLPEOTuEwVAQGUagf7Bt4gpeMF3ta3eRvYRI8RKinxSqPJcys/
5DcASSg/wzrjcTteS/JxQoDVecOcnzoCM/1VaLIT/T60V2l5UNYa2dFALiOqBfXK
JAEBTr+4izVsHlfk6kjC1Fz2WNbrOnfqW+D0AZ5/1kBXcnumLTZBx0xq6RH+1zkJ
5gRJlEexZyZEtoELjRGZsUqSXFs2PTuaEW6dv1aLRSb6nS6/h8qFCueloB9knQHB
7KV9ata2LbvJvLEy4wwszgwBSB+AvHCUekxP4GC3itN4PYTPgEUH33sfS2bcF9vo
zDYfhjtuKrKmmLurMjH0jm5+xy6LWlyjoWEQU6iBhUjtGrnRpqp9Zw==
=HZaT
-----END PGP SIGNATURE-----

Reply via email to