Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Monitor file require/use

by bikeNomad (Priest)
on Jul 26, 2001 at 19:54 UTC ( #100026=sourcecode: print w/replies, xml ) Need Help??
Category: Miscellaneous
Author/Contact Info Ned Konz, bikeNomad,
Description: This little script will monitor the behavior of require/use in your script. It will run another Perl program and print out whatever files it's loading to STDERR.

Just run it on another program like this:

perl arg1 arg2 2>required
# Run another Perl program and print list of loaded files to STDERR
#!/usr/bin/perl -w
my $db = <<'EOF';
sub DB::postponed {
  my $glob = shift;
  $glob =~ s/.*::_<//;
  print STDERR "$glob\n";
sub DB::DB { }
($ENV{PERL5DB} = $db) =~ tr/\n/ /;
system($^X, '-d', @ARGV);
Replies are listed 'Best First'.
Re: Monitor file require/use
by khippy (Scribe) on Jul 27, 2001 at 17:15 UTC
    nice script, seems useful (untested so far).

    For my current problem, I could use a modifikation, that has the same function, but watches a cgi-script.
    As this is done by request of an external browser and executed by the local apache server,
    do you think, that your script would serve as a wrapper, and print out loaded files
    *and* variables and values being exchanged between them?

    That all together would be *very* helpful for both developing and debugging purposes!
    there are no silly questions killerhippy
      What do you mean "print out loaded files *and* variables and values being exchanged between them"? What variables? How do your required or used files exchange values with variables?

      This script uses the debugger interface. If you want to monitor a variable, you can tie it (see perltie and Tie::Scalar or Tie::Array or Tie::Hash). I'm not sure what problem you're trying to solve.

      If you just want to watch a particular CGI, just use a remote debugger like Devel::ptkdb or ActiveState's debugger.

        What I am dreaming of ;-) is an omnipotent debuggertool.
        As I only know perl -d so far, I can't imagine a convenient
        way of debugging a cgi-script with multifunctions in depth.
        So I would appreciate a tool telling me that the is currently calling passing
        variable with value to it
        The problem is, that the is invoked by Apache by browserrequest, so how can you get into that???
        there are no silly questions
Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://100026]
[LanX]: hmm could be a myth since the root of throne is Greek
[LanX]: erix : the one armed who spent his last years in Dorn castle was a prince of Oranie ;)
[erix]: why does that tell against the Kaiser-story?
[erix]: ah, of course, makes sense

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2017-12-15 16:28 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (439 votes). Check out past polls.