On Thu, 14 Sep 2000, Justin wrote:

> Can anyone tell me the easiest slickest way of determining
> what was responsible for requesting a module, having discovered
> that it has been loaded when viewing perl-status?

override the builtin require with CORE::GLOBAL::require.  something like
the below prints a stacktrace to tell you where the require is called
from.  the two eval's are used to handle both "Foo.pm" and the bareword
form of 'use Foo'.

use Carp ();

BEGIN {
    sub My::require {
        my $thing = shift;
        Carp::cluck($thing);
        eval {
            CORE::require($thing);
        } or eval "CORE::require($thing)";
        die $@ if $@;
    }
    *CORE::GLOBAL::require = \&My::require;
}

sub blah {
    require Foo;
}

blah();
 
> and while I've got the podium:
> I would like to congratulate Doug and 
> everyone involved in modperl.. by checking
> pcdataonline.com, I found our entirely modperl site is
> now #1850 in the top 10,000 websites, with over 10 million
> *entirely dynamic* pages pushed out a month.. to half a 
> million unique users. This is a single Dell 2300 box with
> two PII 450s cpus and a gig of memory.. (the mysql server
> is on another box). Most pages are built between 20-100ms
> of user time.. the same box runs backend and frontend
> servers, serves images as well, plus a hunk of other
> processes.

great to hear, thanks for sharing that.
 
> modperl is the best kept secret on the net. Shame!

seems to generate plenty of list traffic for a "secret" ;)

Reply via email to