Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Mr. Muskrat (4572)

Mr. Muskrat
  reversethis-{moc ... ta} {tarksum.rm}

I'm married with 2 girls. I work as a full time Perl programmer for a Land Mobile Radio company in the Dallas/Fort Worth area.

I am enrolled at the Art Institute of Pittsburgh - Online working towards a Bachelor of Science in photography.

My other blog []

Journal of Mr. Muskrat (4572)

Saturday July 10, 2004
12:21 PM


[ #19785 ]

TeeJay released a new version of SpringGraph about four days ago. I saw the example scripts and the output from them and I thought "that's pretty cool."

I had the idea to show file links graphically so I installed GD and SpringGraph at work on my Windows XP box running AS Perl 5.8.3. I proceeded to try out the example scripts and well, one out of three scripts worked (OO worked but procedural and records did not). I fired off an email to him about it.

When I got home, I installed GD and SpringGraph on my Windows XP box running AS Perl 5.8.4. I once again tried out the example scripts and this time two of the three worked (oo and procedural worked but records did not). Once again I sent TeeJay an email about it.

I started to look into why it was failing and spent about a half an hour before I decided that it really wasn't worth it. I didn't need records for my project.

I started coding and in under 30 minutes I had a suitable proof of concept script. I didn't have to think about how to graph it. With SpringGraph, you just add nodes and then later add edges. Very nice. You have done a really good job TeeJay and I am looking forward to future versions.

Here's the script if you are curious:

use strict;
use warnings;
use Cwd;
use File::Find;
use SpringGraph;

my $graph = new SpringGraph;
my $filename = 'oo_file_find.png';

find(\&process_files, cwd); # do your magic

print "outputting as png.\n";


print "finished.\n";

sub process_files {
  my $file = $_;

  return unless -f $file;
  return unless $file =~ /\.(?:p[l|m]|cgi)$/i;

  $graph->add_node($file, label => $file);

  open(FILE, '<', $file) or print "couldn't open $file\n" && return;

  while (<FILE>) {
    next if /^#/;
    if (/\buse\s/) {
      # I didn't use a next because I may want to find other files
      # in form action links, for example.  Capture the module
      # information and strip everything after the first whitespace
      my ($match) = /\buse\s+(.*);/;
      $match = (split /\s/, $match)[0];

      $graph->add_edge($file => $match);

  close FILE;

Here's a link to one of the better results files that was produced as a PNG. oo_file_find.png

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Thanks for the feedback, its always nice to get the first mail about something you have been working on and released.

    Yes, it still requires some work : 0.02 means not done yet, although I have other modules on CPAN that are only 0.01 or 0.02 that are fairly solid ( or at least don't break or fail often).

    Anyway I have a pre-release of version 0.03 at the digraph [] bit of my site if you want it.

    I plan to spend a few days working out some stuff using paper and pencil (and rubber) before attacking all the g


    @JAPH = qw(Hacker Perl Another Just);
    print reverse @JAPH;