line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Build::CleanInstall; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
46617
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
103
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
122
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.05'; |
7
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
1910
|
use parent 'Module::Build'; |
|
2
|
|
|
|
|
745
|
|
|
2
|
|
|
|
|
12
|
|
10
|
2
|
|
|
2
|
|
282269
|
use ExtUtils::Installed; |
|
2
|
|
|
|
|
302484
|
|
|
2
|
|
|
|
|
537
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub ACTION_uninstall { |
13
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
14
|
0
|
|
|
|
|
0
|
my $module = $self->module_name; |
15
|
|
|
|
|
|
|
|
16
|
0
|
0
|
|
|
|
0
|
if ( my $packlist = $self->_get_packlist($module) ) { |
17
|
0
|
|
|
|
|
0
|
print "Removing old copy of $module\n"; |
18
|
0
|
|
|
|
|
0
|
$self->_uninstall($packlist); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub ACTION_install { |
23
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
24
|
0
|
|
|
|
|
0
|
$self->depends_on('uninstall'); |
25
|
0
|
|
|
|
|
0
|
$self->SUPER::ACTION_install; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _get_packlist { |
29
|
2
|
|
|
2
|
|
747
|
my $self = shift; |
30
|
2
|
|
|
|
|
5
|
my ($module) = @_; |
31
|
|
|
|
|
|
|
|
32
|
2
|
|
|
|
|
22
|
my $installed = ExtUtils::Installed->new; |
33
|
2
|
|
|
|
|
425669
|
my $packlist = eval { $installed->packlist($module)->packlist_file }; |
|
2
|
|
|
|
|
22
|
|
34
|
|
|
|
|
|
|
|
35
|
2
|
|
100
|
|
|
3990
|
return $packlist || ''; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub _uninstall { |
39
|
1
|
|
|
1
|
|
3
|
my $self = shift; |
40
|
1
|
|
|
|
|
3
|
my ($packlist, $dont_execute) = @_; |
41
|
|
|
|
|
|
|
|
42
|
1
|
|
|
|
|
1532
|
require ExtUtils::Install; |
43
|
1
|
|
|
|
|
15040
|
ExtUtils::Install::uninstall( $packlist, 1, !!$dont_execute ); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 NAME |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Module::Build::CleanInstall - Subclass of Module::Build which removes the old module before installing the new one |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 SYNOPSIS |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
use strict; |
55
|
|
|
|
|
|
|
use warnings; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
use Module::Build::CleanInstall; |
58
|
|
|
|
|
|
|
my $builder = Module::Build::CleanInstall->new( |
59
|
|
|
|
|
|
|
... # same as Module::Build |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
$builder->create_build_script; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 DESCRIPTION |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
L is a subclass of L with one additional feature, before upgrading the module from and old version to a new one, it first removes the files installed by the previous version. This is useful especially when the new version will not contain some files that the old one did, and it is necessary that those files do not remain in place. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Since it is a subclass of L it is used exactly like that module. This module does provide an additional action C, but it need not be called separately; the action C will call it when invoked. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
The uninstalling is done by removing the files in the installed module's L which is created when the module is first installed. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 SEE ALSO |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=over |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item L |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item L |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=back |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 SOURCE REPOSITORY |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
L |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 AUTHOR |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Joel Berger, Ejoel.a.berger@gmail.comE |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Copyright (C) 2012 by Joel Berger |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
94
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |