[RFC] Devel::Dependencies

[RFC] Devel::Dependencies

am 04.01.2006 16:47:23 von Jean-Louis Leroy

Hello,

after reading my article "A Timely Start"
(http://www.perl.com/pub/a/2005/12/21/a_timely_start.html) some people
have expressed the wish to see the Devel::Depencencies module make it
to CPAN.

The module helps you find what all the modules a perl file (program or
module) loads via the 'use' directive. It also gives an approximation
of how many directory lookup this implies; this may help you
troubleshoot slow program startup times.

For example, given a small program ftp.pl that just contains "use
Net::FTP", you can find out what modules it loads with:

$ perl -c -MDevel::Dependencies=origin ftp.pl
Devel::Dependencies 23 dependencies:
/build/LIB/UTILS!11.151/ftpstuff/Net/libnet.cfg
/build/LIB/UTILS!11.151/ftpstuff/Net/libnet.cfg (6)
Carp.pm /build/LIB/PERL!5.6.1.1.39/lib/Carp.pm (38)
Config.pm /build/LIB/PERL!5.6.1.1.39/lib/PA-RISC2.0/Config.pm (37)
Errno.pm /build/LIB/PERL!5.6.1.1.39/lib/PA-RISC2.0/Errno.pm (37)
Exporter.pm /build/LIB/PERL!5.6.1.1.39/lib/Exporter.pm (38)
Exporter/Heavy.pm /build/LIB/PERL!5.6.1.1.39/lib/Exporter/Heavy.pm
(38)
IO.pm /build/LIB/PERL!5.6.1.1.39/lib/PA-RISC2.0/IO.pm (37)
IO/Handle.pm /build/LIB/PERL!5.6.1.1.39/lib/PA-RISC2.0/IO/Handle.pm
(37)
IO/Socket.pm /build/LIB/PERL!5.6.1.1.39/lib/PA-RISC2.0/IO/Socket.pm
(37)
IO/Socket/INET.pm /build/LIB/PERL!5.6.1.1.39/lib/IO/Socket/INET.pm
(38)
IO/Socket/UNIX.pm /build/LIB/PERL!5.6.1.1.39/lib/IO/Socket/UNIX.pm
(38)
Net/Cmd.pm /build/LIB/UTILS!11.151/ftpstuff/Net/Cmd.pm (6)
Net/Config.pm /build/LIB/UTILS!11.151/ftpstuff/Net/Config.pm (6)
Net/FTP.pm /build/LIB/UTILS!11.151/ftpstuff/Net/FTP.pm (6)
SelectSaver.pm /build/LIB/PERL!5.6.1.1.39/lib/SelectSaver.pm (38)
Socket.pm /build/LIB/PERL!5.6.1.1.39/lib/PA-RISC2.0/Socket.pm (37)
Symbol.pm /build/LIB/PERL!5.6.1.1.39/lib/Symbol.pm (38)
Time/Local.pm /build/LIB/PERL!5.6.1.1.39/lib/Time/Local.pm (38)
XSLoader.pm /build/LIB/PERL!5.6.1.1.39/lib/PA-RISC2.0/XSLoader.pm
(37)
strict.pm /build/LIB/PERL!5.6.1.1.39/lib/strict.pm (38)
vars.pm /build/LIB/PERL!5.6.1.1.39/lib/vars.pm (38)
warnings.pm /build/LIB/PERL!5.6.1.1.39/lib/warnings.pm (38)
warnings/register.pm
/build/LIB/PERL!5.6.1.1.39/lib/warnings/register.pm (38)
Total directory searches: 739
ftp.pl syntax OK

(end of output)

Do you find this CPANworthy? Do you think the name is well chosen?
Thanks for your comments...
--
Jean-Louis Leroy
Europerl - http://www.europerl.be
a division of Sound Object Logic - http://www.soundobjectlogic.com

Re: [RFC] Devel::Dependencies

am 05.01.2006 19:33:24 von Mark Clements

Jean-Louis Leroy wrote:
> Hello,
>
> after reading my article "A Timely Start"
> (http://www.perl.com/pub/a/2005/12/21/a_timely_start.html) some people
> have expressed the wish to see the Devel::Depencencies module make it
> to CPAN.
>
> The module helps you find what all the modules a perl file (program or
> module) loads via the 'use' directive. It also gives an approximation
> of how many directory lookup this implies; this may help you
> troubleshoot slow program startup times.
>
> For example, given a small program ftp.pl that just contains "use
> Net::FTP", you can find out what modules it loads with:
>
> $ perl -c -MDevel::Dependencies=origin ftp.pl
> Devel::Dependencies 23 dependencies:
> /build/LIB/UTILS!11.151/ftpstuff/Net/libnet.cfg
> /build/LIB/UTILS!11.151/ftpstuff/Net/libnet.cfg (6)
> Carp.pm /build/LIB/PERL!5.6.1.1.39/lib/Carp.pm (38)
> Config.pm /build/LIB/PERL!5.6.1.1.39/lib/PA-RISC2.0/Config.pm (37)
> Errno.pm /build/LIB/PERL!5.6.1.1.39/lib/PA-RISC2.0/Errno.pm (37)



> (end of output)
>
> Do you find this CPANworthy? Do you think the name is well chosen?
> Thanks for your comments...

I'd probably have a use for it, if only as an alternative to B::Xref.
You won't really be able to judge how much of a market there is for it
until you release it and people start playing with it.

As for the name: I'd suggest Devel::ModuleDependencies, if only to make
it clear exactly what type of dependencies it displays, though it might
be obvious enough already. The original name is fine, though.

regards,

Mark

Re: [RFC] Devel::Dependencies

am 05.01.2006 20:14:26 von thundergnat

Jean-Louis Leroy wrote:
> Hello,
>
> after reading my article "A Timely Start"
> (http://www.perl.com/pub/a/2005/12/21/a_timely_start.html) some people
> have expressed the wish to see the Devel::Depencencies module make it
> to CPAN.
>
> The module helps you find what all the modules a perl file (program or
> module) loads via the 'use' directive. It also gives an approximation
> of how many directory lookup this implies; this may help you
> troubleshoot slow program startup times.
>

>
> Do you find this CPANworthy? Do you think the name is well chosen?
> Thanks for your comments...


Sounds interesting, though I have to say, it also sounds remarkably
similar to Module::ScanDeps, which I have used in the past and is
already in CPAN.

http://search.cpan.org/~autrijus/Module-ScanDeps-0.52/lib/Mo dule/ScanDeps.pm

Re: Devel::Dependencies

am 06.01.2006 10:00:16 von Jean-Louis Leroy

> Sounds interesting, though I have to say, it also sounds remarkably
> similar to Module::ScanDeps, which I have used in the past and is
> already in CPAN.

After a quick look at Module::ScanDeps, I have the impression that it
is quite different both in intent and in implementation. My goal is to
help troubleshoot slow loading programs by gathering information on the
cost of loading modules in presence of long @INC or PERL5LIB;
Module::ScanDeps seems to be a tool for packaging programs.

Also, the implementation of Module::ScanDeps is a lot more complex and
perhaps less robust. It does look nice though, and it's good to know
that it exists, thanks for pointing it out.
--
Jean-Louis Leroy
Europerl - http://www.europerl.be
a division of Sound Object Logic - http://www.soundobjectlogic.com

Re: [RFC] Devel::Dependencies

am 17.01.2006 17:48:27 von Dominique Dumont

"Jean-Louis Leroy" writes:

> $ perl -c -MDevel::Dependencies=origin ftp.pl
> Devel::Dependencies 23 dependencies:
> /build/LIB/UTILS!11.151/ftpstuff/Net/libnet.cfg
> /build/LIB/UTILS!11.151/ftpstuff/Net/libnet.cfg (6)
> Carp.pm /build/LIB/PERL!5.6.1.1.39/lib/Carp.pm (38)
[...]
> Total directory searches: 739
> ftp.pl syntax OK

What is the meaning of (38) in the Carp line ?

How do you compute the number of directory searches ?

Thanks

--
Dominique Dumont
"Delivering successful solutions requires giving people what they
need, not what they want." Kurt Bittner