<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl -w
#
# Return all modules in the @IRC path
# that match the regexp given on the command line, case-insensitive
#
# Copyright (C) Bek Oberin, 1998.  Artistic licence, like Perl.
# Be nice.
#
# Arkuat &lt;arkuat@idiom.com&gt; helped.
#
# Last updated by gossamer on Fri Nov  6 13:33:14 EST 1998
#

=pod

=head findmod

     findmod some_regexp

=head1 DESCRIPTION

  B&lt;findmod&gt; looks through your modules and returns the module
  names of all those that match (case-insensitive) the regexp
  given.  For example, all modules C&lt;findmod SQL&gt; on my system
  returns:

     DBD::mysql
     Mysql

=head1 AUTHOR

   Gossamer &lt;gossamer@tertius.net.au&gt;

=head1 PREREQUISITES
File::Find
=head1 SCRIPT CATEGORIES
Perl
=cut
#


use strict;
use File::Find;

my @modules;

# return only matching modules
sub wanted { 
   /^.*\.pm$/ &amp;&amp; /$ARGV[0]/i &amp;&amp; push @modules, $File::Find::name;
}

# look in the @IRC dirs that exist
find(\&amp;wanted, grep { -r and -d } @INC);

# de-dupe
my %saw;
@modules = grep(!$saw{$_}++, @modules);

# strip extraneous directories off the modules
for my $prefix ( sort { length $b &lt;=&gt; length $a } @INC ) {
   for (@modules) { 
      next if s/^\Q$prefix// 
   }
}

# nice printout
foreach (@modules) {
   s#^/(.*)\.pm$#$1#;
   s#/#::#;
   print "$_\n";
}

#
# End.
#
</pre></body></html>