1 #!/usr/local/bin/perl -w
5 use ExtUtils::Packlist;
6 use ExtUtils::Installed;
8 use vars qw($Inst @Modules);
13 instmodsh - A shell to examine installed modules
21 A little interface to ExtUtils::Installed to examine installed modules,
22 validate your packlists and even create a tarball from an installed module.
31 Available commands are:
32 f [all|prog|doc] - List installed files of a given type
33 d [all|prog|doc] - List the directories used by a module
34 v - Validate the .packlist - check for missing files
35 t <tarfile> - Create a tar archive of the module
41 print("$module cmd? ");
42 my $reply = <STDIN>; chomp($reply);
45 $reply =~ /^f\s*/ and do
47 my $class = (split(' ', $reply))[1];
48 $class = 'all' if (! $class);
50 if (eval { @files = $Inst->files($module, $class); })
52 print("$class files in $module are:\n ",
53 join("\n ", @files), "\n");
59 $reply =~ /^d\s*/ and do
61 my $class = (split(' ', $reply))[1];
62 $class = 'all' if (! $class);
64 if (eval { @dirs = $Inst->directories($module, $class); })
66 print("$class directories in $module are:\n ",
67 join("\n ", @dirs), "\n");
73 $reply =~ /^t\s*/ and do
75 my $file = (split(' ', $reply))[1];
76 my $tmp = "/tmp/inst.$$";
77 if (my $fh = IO::File->new($tmp, "w"))
79 $fh->print(join("\n", $Inst->files($module)));
81 system("tar cvf $file -I $tmp");
85 else { print("Can't open $file: $!\n"); }
90 if (my @missing = $Inst->validate($module))
92 print("Files missing from $module are:\n ",
93 join("\n ", @missing), "\n");
97 print("$module has no missing files\n");
111 ################################################################################
116 Available commands are:
117 l - List all installed modules
118 m <module> - Select a module
125 my $reply = <STDIN>; chomp($reply);
130 print("Installed modules are:\n ", join("\n ", @Modules), "\n");
133 $reply =~ /^m\s+/ and do
135 do_module((split(' ', $reply))[1]);
148 ################################################################################
150 $Inst = ExtUtils::Installed->new();
151 @Modules = $Inst->modules();
154 ################################################################################