Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Graph your Perl inheritance structure

by ZZamboni (Curate)
on Jun 11, 2001 at 02:02 UTC ( #87364=note: print w/replies, xml ) Need Help??

in reply to Graph your Perl inheritance structure

This is very neat. I have made a patch (see below) that:
  • Makes it ignore POD lines.
  • Makes it deal with multi-line @ISA declarations such as:
    Of course, the only foolproof way to get @ISA would be to load the package and examine its value, but this seems to work OK.
For an example of a graph generated by this program, see this graph, which corresponds to the implementation of this project. :-)


Here's the patch:

--- Sun Jun 10 16:52:08 2001 +++ Sun Jun 10 17:00:00 2001 @@ -86,16 +86,31 @@ STDERR->print("processing $file\n") if $opts{v}; my $f = IO::File->new($file) or warn "can't open $file: $!\n", next; my ($package, @isa); + my $pod=0; while (<$f>) { + if (/^=cut/) { + $pod=0; + next; + } + if (/^=[a-zA-Z]+/) { + $pod=1; + next; + } + next if $pod; if (/^\s*package\s+([[:word:]:]+)\s*;/) { $package = $1; next; } - if (/@(?:([[:word:]:]+)::)?ISA\s*=\s*(.*)\s*;/) + if (/@(?:([[:word:]:]+)::)?ISA\s*=\s*(.*)\s*/) { - @isa = eval $2; + my $tmp=$2; + while (!/;/) { + $_=<$f>; + $tmp.=$_; + } + @isa = eval $tmp; if ($@) { warn "Unparseable \@ISA line: $_"; next } $package = $1 if defined($1); STDERR->print("package=$package, \@ISA=", join(',', @isa), "\n") i +f $opts{v};

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://87364]
LanX blame Canada!
[Discipulus]: to crash is not the default behaviour of IE? ;=)
[Discipulus]: so every library (js) to sdelect and modify the id parameters can be good.
[Discipulus]: I never understood something: I can on the fly modify the XML structure of the SVG using for example XML::Twig ?

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (11)
As of 2017-03-23 09:36 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (285 votes). Check out past polls.