We have hundreds of perl scripts being used. It's hard to debug and
don't know the flow like which one is calling which. Is there any tool
that creates a flow chart like giving a visual view of multiple perl
scripts.
This is a messy solution, but you've already got a messy problem so it
can only help...
Write a bit of code to add a line to each of the Perl scripts that are
in your execution paths. Since you don't know for sure what's called
by what you need the line in all scripts.
That line needs to append a trace message to a single file that you
define using a date/time stamp and the name of the running program,
plus its passed in arguments. You might even want to dump the
environment too if you suspect there's significant information being
used there too.
Something like this (untested line) should work...
1 and open (my $__LOG, '>>', '/absolute/path/to/writable/log'),
print $__LOG scalar(localtime),"\t","$0 @ARGV\n",
close($__LOG);
(I wrapped the line to help it survive formatting by news browsers so
unwrap it into a single line.)
You can insert that line into your scripts by running something like
this untested and simplistic code...
#!/usr/bin/perl
use warnings;
use strict;
my $code = q{
1 and open (my $__LOG, '>>', '/absolute/path/to/writable/log'),
print $__LOG scalar(localtime),"\t$0 @ARGV\n",
close($__LOG);
};
foreach (@ARGV)
{
if ( open( my $FI, '<', $_ ) && open( my $FO, '>', "$_.new" ) )
{
while (<$FI>)
{
print $FO $code, "\n" if ( $. == 2 );
print $FO $_;
}
}
close $FO;
close $FI;
rename $_, "$_.old";
rename "$_.new", $_;
}
Then, as the application runs each script will update the log file
showing when they were called and what their parameters were.
You'll have a starting point to track down the execution flow then.
As you get things figured out or don't want something writing to the
log, change the leading 1 to a 0 in the code files you understand and
that file will 'gnore the log statement.
Just be very aware that this can create a very large log file in a
very short time, depending on the activity and structure of the
overall application.
Greg