| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Module::Install::PadrePlugin; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
871
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
39
|
|
|
4
|
1
|
|
|
1
|
|
905
|
use Module::Install::Base; |
|
|
1
|
|
|
|
|
2552
|
|
|
|
1
|
|
|
|
|
33
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
8
|
use vars qw{$VERSION @ISA}; |
|
|
1
|
|
|
|
|
14
|
|
|
|
1
|
|
|
|
|
68
|
|
|
7
|
|
|
|
|
|
|
BEGIN { |
|
8
|
1
|
|
|
1
|
|
2
|
$VERSION = '0.01'; |
|
9
|
1
|
|
|
|
|
3567
|
@ISA = qw{Module::Install::Base}; |
|
10
|
|
|
|
|
|
|
} |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 NAME |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Module::Install::PadrePlugin - Module::Install support for Padre plugins |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
To add two useful "make" targets to your Padre plugin, just add the |
|
19
|
|
|
|
|
|
|
C line to your C. |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
use inc::Module::Install; |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
name 'Padre::Plugin::Foo'; |
|
24
|
|
|
|
|
|
|
all_from 'lib/Padre/Plugin/Foo.pm'; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
is_padre_plugin; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
WriteAll; |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
This module adds one directive to Module::Install |
|
33
|
|
|
|
|
|
|
related to creating and installing Padre plugins as .par files and two |
|
34
|
|
|
|
|
|
|
C targets. |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head2 is_padre_plugin |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
If you add this directive to your C, two new C targets become |
|
39
|
|
|
|
|
|
|
available to the user, see below. |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub is_padre_plugin { |
|
44
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
45
|
0
|
|
|
|
|
|
my $class = ref($self); |
|
46
|
0
|
|
|
|
|
|
my $inc_class = join('::', @{$self->_top}{qw(prefix name)}); |
|
|
0
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
my $version = $self->version; |
|
49
|
0
|
|
|
|
|
|
my $distname = $self->name; |
|
50
|
0
|
0
|
|
|
|
|
$distname =~ s/^Padre-Plugin-// |
|
51
|
|
|
|
|
|
|
or die "This is not a Padre plugin The namespace doesn't start with Padre::Plugin::!"; |
|
52
|
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
my $file = $distname; |
|
54
|
0
|
|
|
|
|
|
$file .= '.par'; |
|
55
|
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
$self->postamble(<<"END_MAKEFILE"); |
|
57
|
|
|
|
|
|
|
# --- $class section: |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
$file: all test |
|
60
|
|
|
|
|
|
|
\t\$(NOECHO) \$(PERL) "-M$inc_class" -e "make_padre_plugin(q($distname),q($file),q($version))" |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
plugin :: $file |
|
63
|
|
|
|
|
|
|
\t\$(NOECHO) \$(NOOP) |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
installplugin :: $file |
|
66
|
|
|
|
|
|
|
\t\$(NOECHO) \$(PERL) "-M$inc_class" -e "install_padre_plugin(q($file))" |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
END_MAKEFILE |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 NEW MAKE TARGETS |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 plugin |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
To generate a .par file from the Padre plugin at hand which |
|
77
|
|
|
|
|
|
|
can be easily installed (see also below) into your Padre user |
|
78
|
|
|
|
|
|
|
directory, you can simply type: |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
perl Makefile.PL |
|
81
|
|
|
|
|
|
|
make plugin |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Now you should have a shiny new C file. |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 installplugin |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
To install the Padre plugin at hand as a single PAR file into your |
|
88
|
|
|
|
|
|
|
Padre user/plugins directory, you can simply type: |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
perl Makefile.PL |
|
91
|
|
|
|
|
|
|
make installplugin |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Running C in between those two command isn't necessary, |
|
94
|
|
|
|
|
|
|
it's run by C if necessary. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub make_padre_plugin { |
|
99
|
0
|
|
|
0
|
0
|
|
my ($self, $distname, $file, $version) = @_; |
|
100
|
0
|
0
|
|
|
|
|
unlink $file if -f $file; |
|
101
|
|
|
|
|
|
|
|
|
102
|
0
|
0
|
|
|
|
|
unless ( eval { require PAR::Dist; PAR::Dist->VERSION >= 0.17 } ) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
warn "Please install PAR::Dist 0.17 or above first."; |
|
104
|
0
|
|
|
|
|
|
return; |
|
105
|
|
|
|
|
|
|
} |
|
106
|
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
return PAR::Dist::blib_to_par( |
|
108
|
|
|
|
|
|
|
name => $distname, |
|
109
|
|
|
|
|
|
|
version => $version, |
|
110
|
|
|
|
|
|
|
dist => $file, |
|
111
|
|
|
|
|
|
|
); |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub install_padre_plugin { |
|
115
|
0
|
|
|
0
|
0
|
|
my ($self, $file) = @_; |
|
116
|
0
|
0
|
|
|
|
|
if (not -f $file) { |
|
117
|
0
|
|
|
|
|
|
warn "Cannot find plugin file '$file'."; |
|
118
|
0
|
|
|
|
|
|
return; |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
|
require Padre; |
|
122
|
0
|
|
|
|
|
|
my $plugin_dir = Padre::Config->default_plugin_dir; |
|
123
|
|
|
|
|
|
|
|
|
124
|
0
|
|
|
|
|
|
require File::Copy; |
|
125
|
0
|
|
|
|
|
|
return File::Copy::copy($file, $plugin_dir); |
|
126
|
|
|
|
|
|
|
} |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
1; |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 AUTHOR |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Steffen Mueller |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Copyright (c) 2008. Steffen Mueller |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
139
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
See L |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=cut |