1 #!/usr/local/bin/perl -w
5 use ExtUtils::Packlist;
6 use ExtUtils::Installed;
8 use vars qw($Inst @Modules);
10 ################################################################################
16 Available commands are:
17 f [all|prog|doc] - List installed files of a given type
18 d [all|prog|doc] - List the directories used by a module
19 v - Validate the .packlist - check for missing files
20 t <tarfile> - Create a tar archive of the module
26 print("$module cmd? ");
27 my $reply = <STDIN>; chomp($reply);
30 $reply =~ /^f\s*/ and do
32 my $class = (split(' ', $reply))[1];
33 $class = 'all' if (! $class);
35 if (eval { @files = $Inst->files($module, $class); })
37 print("$class files in $module are:\n ",
38 join("\n ", @files), "\n");
44 $reply =~ /^d\s*/ and do
46 my $class = (split(' ', $reply))[1];
47 $class = 'all' if (! $class);
49 if (eval { @dirs = $Inst->directories($module, $class); })
51 print("$class directories in $module are:\n ",
52 join("\n ", @dirs), "\n");
58 $reply =~ /^t\s*/ and do
60 my $file = (split(' ', $reply))[1];
61 my $tmp = "/tmp/inst.$$";
62 if (my $fh = IO::File->new($tmp, "w"))
64 $fh->print(join("\n", $Inst->files($module)));
66 system("tar cvf $file -I $tmp");
70 else { print("Can't open $file: $!\n"); }
75 if (my @missing = $Inst->validate($module))
77 print("Files missing from $module are:\n ",
78 join("\n ", @missing), "\n");
82 print("$module has no missing files\n");
96 ################################################################################
101 Available commands are:
102 l - List all installed modules
103 m <module> - Select a module
110 my $reply = <STDIN>; chomp($reply);
115 print("Installed modules are:\n ", join("\n ", @Modules), "\n");
118 $reply =~ /^m\s+/ and do
120 do_module((split(' ', $reply))[1]);
133 ################################################################################
135 $Inst = ExtUtils::Installed->new();
136 @Modules = $Inst->modules();
139 ################################################################################