line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CPANPLUS::Shell::Default::Plugins::Changes; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
780
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
57
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
956
|
use CPANPLUS::Error; |
|
1
|
|
|
|
|
45540
|
|
|
1
|
|
|
|
|
88
|
|
7
|
1
|
|
|
1
|
|
14
|
use Locale::Maketext::Simple Class => 'CPANPLUS', Style => 'gettext'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
8
|
1
|
|
|
1
|
|
1580
|
use DirHandle; |
|
1
|
|
|
|
|
660
|
|
|
1
|
|
|
|
|
39
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
7
|
use vars qw[$VERSION]; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
715
|
|
11
|
|
|
|
|
|
|
$VERSION = '0.02'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
### Regex to match the names of the changes files |
14
|
|
|
|
|
|
|
my $changes_re = qr/change(?:s|log)|news/i; |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
0
|
1460
|
sub plugins { return (changes => 'changes'); } |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub changes { |
19
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
20
|
0
|
|
|
|
|
|
my $shell = shift; |
21
|
0
|
|
|
|
|
|
my $cb = shift; |
22
|
0
|
|
|
|
|
|
my $cmd = shift; |
23
|
0
|
|
0
|
|
|
|
my $input = shift || ''; |
24
|
0
|
|
0
|
|
|
|
my $opts = shift || {}; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
### Get the module name and (optionally) the version. |
27
|
0
|
|
|
|
|
|
my $mod_name; |
28
|
0
|
|
|
|
|
|
($mod_name = $input) =~ /\S+/; |
29
|
0
|
0
|
|
|
|
|
if (not $mod_name) { |
30
|
0
|
|
|
|
|
|
error( loc("No module supplied") ); |
31
|
0
|
|
|
|
|
|
return; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
### Fetch module and unpack. |
35
|
0
|
|
|
|
|
|
my $obj = $cb->parse_module(module => $mod_name); |
36
|
0
|
0
|
|
|
|
|
unless ($obj) { |
37
|
0
|
|
|
|
|
|
error( loc("Couldn't create module object") ); |
38
|
0
|
|
|
|
|
|
return; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
$obj->fetch |
41
|
0
|
0
|
|
|
|
|
or error( loc("Could not fetch '%1'", $obj->package) ), return; |
42
|
0
|
0
|
|
|
|
|
my $path = $obj->extract |
43
|
|
|
|
|
|
|
or error( loc("Could not extract '%1'", $obj->package) ), return; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
### Search for a changes file. |
46
|
0
|
|
|
|
|
|
my $changes_file; |
47
|
0
|
|
|
|
|
|
my $dh = DirHandle->new($path); |
48
|
0
|
0
|
|
|
|
|
if (defined $dh) { |
49
|
0
|
0
|
|
|
|
|
($changes_file) = grep { -f && m/$changes_re/ } |
|
0
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
map { File::Spec->catfile($path, $_) } $dh->read; |
51
|
|
|
|
|
|
|
} |
52
|
0
|
|
|
|
|
|
undef $dh; |
53
|
|
|
|
|
|
|
|
54
|
0
|
0
|
|
|
|
|
unless ($changes_file) { |
55
|
0
|
|
|
|
|
|
error( loc("Could not find a changes file") ); |
56
|
0
|
|
|
|
|
|
return; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
### Read the changes file. |
60
|
0
|
0
|
|
|
|
|
open my $changes_fh, "<", $changes_file |
61
|
|
|
|
|
|
|
or error( loc("Could not open file '$changes_file': $!") ), return; |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
my $changes; |
64
|
|
|
|
|
|
|
{ |
65
|
0
|
|
|
|
|
|
local $/ = undef; |
|
0
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
$changes = <$changes_fh>; |
67
|
|
|
|
|
|
|
} |
68
|
0
|
|
|
|
|
|
close $changes_fh; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
## Display the changes. |
71
|
0
|
0
|
|
|
|
|
$shell->_pager_open if $changes =~ tr/\n/\n/ > $shell->_term_rowcount; |
72
|
0
|
|
|
|
|
|
print $changes; |
73
|
0
|
|
|
|
|
|
$shell->_pager_close; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub changes_help { |
78
|
0
|
|
|
0
|
0
|
|
return loc( |
79
|
|
|
|
|
|
|
" /changes\n" . |
80
|
|
|
|
|
|
|
" Shows the Changes file (or ChangeLog, etc. as appropriate). " |
81
|
|
|
|
|
|
|
); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 NAME |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
CPANPLUS::Shell::Default::Plugins::Changes - View a module's Changes file from the CPANPLUS shell |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 SYNOPSIS |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
### View Changes file of CPANPLUS |
93
|
|
|
|
|
|
|
CPAN Terminal> /changes CPANPLUS |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 DESCRIPTION |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
This plugin allows you to display the Changes (or Changelog, ChangeLog, |
98
|
|
|
|
|
|
|
etc.) file of a module to get an overview of what (according to the |
99
|
|
|
|
|
|
|
maintainer) has changed. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 AUTHOR |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Module written by Arjen Laarhoven Earjen@cpan.orgE. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 COPYRIGHT |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Copyright (c) 2006 Arjen Laarhoven Earjen@cpan.orgE. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This library is free software; you may redistribute and/or modify it |
110
|
|
|
|
|
|
|
under the same terms as Perl itself. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 SEE ALSO |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
L, |
115
|
|
|
|
|
|
|
L, |
116
|
|
|
|
|
|
|
L |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |