I'm trying to use Devel::Symdump to document code, but Perl
is choking when it hits (what appears to me to be) autoloadable
stuff. I'd like to know how to invoke (or patch, or whatever) Perl in
such a way so as to ignore such problems (or perhaps merely warn/carp
about them), or how to run Devel::Symdump under Apache.

I've started working on a project that has several 10**4 lines of cgi
Perl currently running on a Netscape server. We're porting it to
mod_perl on Apache, and meanwhile trying to document the code, learn
more about it, and better structure it. (The code is pretty much just
one big collection of subroutines.) Note that the mod_perl code is
currently running in a development environment (separate database,
webserver, etc).

Among the data I'd like to acquire, for each user-defined subroutine
in each source file, are

1 a list of the variables used within the subroutine

2 a list of all the user-defined subroutines called within the
  subroutine

I've checked out all the source files into an offline directory (not
in Apache space). I've got a tags script that will get a list of all
the subroutines defined in each file, as well as do (1), but not
(2). Symdump seems like it should provide both. However, before I can
use it I've got to get Perl to load the code, hence the problem.

To learn more about Symdump I've written a driver, sub_scanner.pl, and
an auxilliary Loader.pm. Loader merely require's all our scripts.
sub_scanner require's Loader and Devel::Symdump, then tries to use the
latter as illustrated in the Symdump POD:

> @packs = qw(Loader);
> # $obj = Devel::Symdump->new(@packs);        # no recursion
> $obj = Devel::Symdump->rnew(@packs);       # with recursion

> # Methods
> @packages = $obj->packages;
> @scalars = $obj->scalars;
> @arrays = $obj->arrays;
> @hashes = $obj->hashes;
> @functions = $obj->functions;
> @ios = $obj->ios;
> @unknowns = $obj->unknowns;

> @todo = (\@packages,
>          \@scalars,
>          \@arrays,
>          \@hashes,
>          \@functions,
>          \@ios,
>          \@unknowns);

> foreach $ref (@todo) {
>   foreach $item (@$ref) {
>     print STDOUT "$item\n";
>   }
>   print STDOUT "\n";
> }

Unfortunately Loader, or rather Perl, is having a problem with
Apache::DBI.pm. The first source file require's OK. The second source
file, GetDBs.pm, use's Apache::DBI(), line 202 of which is

> ) if ($INC{'Apache.pm'} and Apache->module('Apache::Status'));

When I do 'perl sub_scanner.pl' (or just 'perl Loader.pm') I get

> Can't locate object method "module" via package "Apache" at
> /external/apps/perl5/lib/site_perl/5.005/Apache/DBI.pm line 202.
> BEGIN failed--compilation aborted at
> /external/apps/apache/mod_perl/dev/GetDBs.pm line 7.

Yet this same code runs under mod_perl, so I assume its interpreter must
be
doing something differently. Is there a way to get my "normal" Perl to
behave similarly, and load the code for Symdump to do its thing? Is
there a way Symdump can access the Apache interpreter's symbol table?
Is there some entirely different way to do what I'm trying to do?

Please reply directly to me as well as the list/group, and TIA,
[EMAIL PROTECTED]

Reply via email to