#!/usr/bin/perl -w # $Id: DIR.pl,v 1.3 2004/02/06 15:18:13 mtsouk Exp mtsouk $ # # Please note that this is alpha code # # Command line arguments # program_name.pl directory use strict; my $directory=""; my $COMMAND=""; my %DIRECTORIES=(); die < $OUTPUT") || die "Cannot create output file $OUTPUT: $!\n"; print OUTPUT <) { chomp; my $orig=$_; # Get the right label my @split = split /\//, $_; $lastpart = pop @split; $_ =~ s/\//_/g; # # The _ is accepted as a valid node character # . , + - are not accepted # $_ =~ s/[^a-zA-Z0-9]/_/g; my @split = split /_/, $_; print OUTPUT "\t_".$_; print OUTPUT " [shape=box,label=\"$lastpart\"];"; print OUTPUT "\n"; $DIRECTORIES{$orig}=0; } my $subdir=""; my %TEMP=(); foreach $key ( sort keys %DIRECTORIES ) { print "KEY: $key\n"; my @split = split /\//, $key; my $prev = undef; for $subdir (@split) { $subdir =~ s/[^a-zA-Z0-9_]/_/g; my $next = $prev."_".$subdir; # print "NEXT: $next\n"; if ( !defined($prev) ) { $prev = $next; next; } my $val = "$prev->$next;\n"; # print "VAL: $val\n"; if ( !defined( $TEMP{$val} )) { print OUTPUT "$prev->$next;\n"; } $prev .= "_".$subdir; $TEMP{$val}=1; } } close(INPUT) || die "Cannot close input file: $!\n"; print OUTPUT <