Re: Uninstalling Perl modules
- From: Ron Savage <ron@xxxxxxxxxxxxx>
- Date: Sat, 13 Jan 2007 10:21:58 +1100
On Fri, 12 Jan 2007 20:36:47 +1100, rahed wrote:
Hi
Whenever I rarely use the utitily I want to fix it but haven't
found time.
I found it (Note: tabs = 4 spaces):
-----><8-----
#!/usr/bin/perl
use strict;
use warnings;
use IO::Dir;
use ExtUtils::Packlist;
use ExtUtils::Installed;
# -----------------------------------------------
sub emptydir($)
{
my($dir) = @_;
my($dh) = IO::Dir->new($dir) || return(0);
my(@count) = $dh->read();
$dh->close();
return (@count == 2 ? 1 : 0);
}
# -----------------------------------------------
die "Usage: $0 A::B ...\n" if (! @ARGV);
print("Finding all installed modules...\n");
my($installed) = ExtUtils::Installed->new();
for my $module (grep(!/^Perl$/, $installed -> modules() ) )
{
last if (! @ARGV);
my $version = $installed -> version($module) || '?';
if ($ARGV[0] eq $module)
{
print "Deleting $module. \n";
shift @ARGV;
# Remove all the files
for my $file (sort $installed -> files($module) )
{
print("rm $file\n");
unlink($file);
}
my($pf) = $installed -> packlist($module) -> packlist_file();
print("rm $pf\n");
unlink($pf);
for my $dir (sort $installed -> directory_tree($module) )
{
if (emptydir($dir) )
{
print("rmdir $dir\n");
rmdir($dir);
}
}
}
}
-----><8-----
.
- References:
- Uninstalling Perl modules
- From: Mumia W. (on aioe)
- Re: Uninstalling Perl modules
- From: rahed
- Re: Uninstalling Perl modules
- From: Ron Savage
- Re: Uninstalling Perl modules
- From: rahed
- Uninstalling Perl modules
- Prev by Date: Re: Uninstalling Perl modules
- Next by Date: Re: XML::Twig produces double encoded UTF-8
- Previous by thread: Re: Uninstalling Perl modules
- Next by thread: PayPal Reporting API
- Index(es):
Relevant Pages
|
|