/usr/share/doc/libgraphviz-perl/examples/directories.pl is in libgraphviz-perl 2.04-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | #!/usr/bin/perl -w
#
# This small example program walks the directory tree and draws a
# directory of the files and directories in the GraphViz distribution.
#
# It also shows the use of the GraphViz::No subclass.
use strict;
use lib '../lib';
use IO::Dir;
use GraphViz;
use GraphViz::Small;
use GraphViz::No;
my $directory = '../';
my $graph = GraphViz::No->new(directed => 0, layout => 'twopi');
walk($directory);
sub walk {
my($dir, $parent) = @_;
# warn "\nwalk $dir $parent\n";
$graph->add_node($dir) unless defined $parent;
my $d = IO::Dir->new($dir);
foreach my $file ($d->read) {
next if $file =~ /^\./;
if (-f $dir . $file) {
# It's a file!
# warn "$file in $dir\n";
$graph->add_node($dir . $file, label => $file);
$graph->add_edge($dir => $dir . $file);
} elsif (-d $dir . $file) {
# It's a directory!
# warn "$file in $dir is DIR\n";
$graph->add_node($dir . $file . '/', label => $file . '/');
$graph->add_edge($dir => $dir . $file . '/');
walk($dir . $file . '/', $dir);
}
}
# warn "\n";
}
#print $graph->_as_debug;
$graph->as_png("directories.png");
|