#!/usr/bin/perl
our
$VERSION
=
'0.01'
;
exit
main();
sub
main {
my
$help
;
my
$recursive
;
my
$recursion_filter
;
my
$hide_methods
;
my
$text_out
;
my
$graph_out
;
my
$graph_type
=
'png'
;
GetOptions(
'help|h'
=> \
$help
,
'recursive|r'
=> \
$recursive
,
'filter|b=s'
=> \
$recursion_filter
,
'hide-methods'
=> \
$hide_methods
,
'text|t'
=> \
$text_out
,
'graph|g=s'
=> \
$graph_out
,
'graph_type=s'
=> \
$graph_type
,
) or pod2usage;
pod2usage
if
$help
;
my
$sniff_class
=
shift
@ARGV
;
pod2usage
if
not
$sniff_class
;
$text_out
= 1
if
not (
$graph_out
or
$text_out
);
my
$mo
= Module::Overview->new({
module_name
=>
$sniff_class
,
recursive
=>
$recursive
,
recursion_filter
=>
$recursion_filter
,
hide_methods
=>
$hide_methods
,
});
print
$mo
->text_simpletable
if
$text_out
;
if
(
$graph_out
) {
my
$graph
=
$mo
->graph;
foreach
my
$module_name
(
@ARGV
) {
$mo
->graph(
$module_name
,
$graph
);
}
open
my
$DOT
,
'|dot -T'
.
$graph_type
.
' -o '
.
$graph_out
or
die
(
"Cannot open pipe to dot: $!"
);
print
$DOT
$graph
->as_graphviz;
close
$DOT
;
}
return
0;
}