On Wed, Apr 24, 2002 at 10:09:49AM +0530, sharan wrote:
> Hello,
> 
> How to find the module dependencies? I have used many modules in  my tool
> development, and i given all the modules used with my tool package. But when
> the tool is installed on Windows at the customer places they are getting
> problems as some of the module use some depenedent modules. Is there any way
> to find out what are all the modules that are dependent.

If you know that you're 'use'ing all your modules at the beginning and
don't load any modules during the execution using 'require' and
'import', then it should be sufficient to dump %INC.

    ---------- snip ----------
    #!/usr/bin/perl

    use strict;
    use warnings;
    use Data::Dumper;

    print Dumper(\%INC);
    ---------- snip ----------

will give you

    ---------- snip ----------
    nijushiho:~$ perl check.pl 
        $VAR1 = {
          'Exporter.pm' => '/usr/share/perl/5.6.1/Exporter.pm',
          'Carp.pm' => '/usr/share/perl/5.6.1/Carp.pm',
          'XSLoader.pm' => '/usr/lib/perl/5.6.1/XSLoader.pm',
          'strict.pm' => '/usr/share/perl/5.6.1/strict.pm',
          'warnings/register.pm' => '/usr/share/perl/5.6.1/warnings/register.pm',
          'warnings.pm' => '/usr/share/perl/5.6.1/warnings.pm',
          'overload.pm' => '/usr/share/perl/5.6.1/overload.pm',
          'Data/Dumper.pm' => '/usr/lib/perl/5.6.1/Data/Dumper.pm'
        };
    nijushiho:~$ 
    ---------- snip ----------

Of course in this case they are all core modules, but you could filter
that list by looking for 'site_perl' in the path.

PS: I've made the mistake to install quite a handful of modules via
Debian packages instead of CPAN and they are *NOT* installed in
'site_perl' but somewhere in '/usr/local/share' and are also *NOT*
registered in perllocal.  That's *NOT* funny, Debians!

I've not verified this, but I guess that could be a problem with other
Linux distros too.

-- 
                       If we fail, we will lose the war.

Michael Lamertz                        |      +49 221 445420 / +49 171 6900 310
Nordstr. 49                            |                       [EMAIL PROTECTED]
50733 Cologne                          |                 http://www.lamertz.net
Germany                                |               http://www.perl-ronin.de 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to