Allow using perltidy's default side comments (i.e. ## VERSION as well as # VERSION).
Ian Sealy
7 years ago
88 | 88 |
our $VERSION = '0.1.0'; # VERSION: generated by DZP::OurPkgVersion
|
89 | 89 |
...
|
90 | 90 |
|
|
91 |
you can also use perltidy's default static side comments (##)
|
|
92 |
|
|
93 |
...
|
|
94 |
## VERSION
|
|
95 |
...
|
|
96 |
|
|
97 |
becomes
|
|
98 |
|
|
99 |
...
|
|
100 |
our $VERSION = '0.1.0'; ## VERSION
|
|
101 |
...
|
|
102 |
|
91 | 103 |
Also note, the package line is not in any way significant, it will insert the
|
92 | 104 |
`our $VERSION` line anywhere in the file before `# VERSION` as many times as
|
93 | 105 |
you've written `# VERSION` regardless of whether or not inserting it there is
|
|
0 |
use strict;
|
|
1 |
use warnings;
|
|
2 |
package DZT7;
|
|
3 |
## VERSION
|
|
4 |
# ABSTRACT: my abstract
|
|
5 |
1;
|
58 | 58 |
stopwords = OurPkgVersion
|
59 | 59 |
stopwords = ini
|
60 | 60 |
stopwords = executables
|
|
61 |
stopwords = perltidy
|
61 | 62 |
|
62 | 63 |
[PruneFiles]
|
63 | 64 |
filenames = dist.ini
|
46 | 46 |
my $version_regex
|
47 | 47 |
= q{
|
48 | 48 |
^
|
49 | |
(\s*) # capture all whitespace before comment
|
|
49 |
(\s*) # capture all whitespace before comment
|
50 | 50 |
(
|
51 | |
\#\s*VERSION # capture # VERSION
|
52 | |
\b # and ensure it ends on a word boundary
|
53 | |
[ # conditionally
|
54 | |
[:print:] # all printable characters after VERSION
|
55 | |
\s # any whitespace including newlines see GH #5
|
56 | |
]* # as many of the above as there are
|
|
51 |
\#\#?\s*VERSION # capture # VERSION or ## VERSION
|
|
52 |
\b # and ensure it ends on a word boundary
|
|
53 |
[ # conditionally
|
|
54 |
[:print:] # all printable characters after VERSION
|
|
55 |
\s # any whitespace including newlines - GH #5
|
|
56 |
]* # as many of the above as there are
|
57 | 57 |
)
|
58 | |
$ # until the EOL}
|
|
58 |
$ # until the EOL}
|
59 | 59 |
;
|
60 | 60 |
|
61 | 61 |
my $munged_version = 0;
|
|
175 | 175 |
our $VERSION = '0.1.0'; # VERSION: generated by DZP::OurPkgVersion
|
176 | 176 |
...
|
177 | 177 |
|
|
178 |
you can also use perltidy's default static side comments (##)
|
|
179 |
|
|
180 |
...
|
|
181 |
## VERSION
|
|
182 |
...
|
|
183 |
|
|
184 |
becomes
|
|
185 |
|
|
186 |
...
|
|
187 |
our $VERSION = '0.1.0'; ## VERSION
|
|
188 |
...
|
|
189 |
|
178 | 190 |
Also note, the package line is not in any way significant, it will insert the
|
179 | 191 |
C<our $VERSION> line anywhere in the file before C<# VERSION> as many times as
|
180 | 192 |
you've written C<# VERSION> regardless of whether or not inserting it there is
|
19 | 19 |
my $lib_4 = $tzil->slurp_file('build/lib/DZT4.pm');
|
20 | 20 |
my $lib_5 = $tzil->slurp_file('build/lib/DZT5.pm');
|
21 | 21 |
my $lib_6 = $tzil->slurp_file('build/lib/DZT6.pm');
|
|
22 |
my $lib_7 = $tzil->slurp_file('build/lib/DZT7.pm');
|
22 | 23 |
my $tst_0 = $tzil->slurp_file('build/t/basic.t' );
|
23 | 24 |
|
24 | 25 |
# e short for expected files
|
|
84 | 85 |
1;
|
85 | 86 |
END LIB6
|
86 | 87 |
|
|
88 |
my $elib_7 = <<'END LIB7';
|
|
89 |
use strict;
|
|
90 |
use warnings;
|
|
91 |
package DZT7;
|
|
92 |
our $VERSION = '0.1.0'; ## VERSION
|
|
93 |
# ABSTRACT: my abstract
|
|
94 |
1;
|
|
95 |
END LIB7
|
|
96 |
|
87 | 97 |
my $etst_0 = <<'END TST0';
|
88 | 98 |
#!/usr/bin/perl
|
89 | 99 |
# VERSION
|
|
97 | 107 |
is ( $lib_4, $elib_4, 'check DZT4.pm' );
|
98 | 108 |
is ( $lib_5, $elib_5, 'check DZT5.pm' );
|
99 | 109 |
is ( $lib_6, $elib_6, 'check DZT6.pm' );
|
|
110 |
is ( $lib_7, $elib_7, 'check DZT7.pm' );
|
100 | 111 |
is ( $tst_0, $etst_0, 'check basic.t' );
|
101 | 112 |
|
102 | 113 |
for my $file ( qw/DZT2 DZT3/ ) {
|
20 | 20 |
my $lib_3 = $tzil->slurp_file('build/lib/DZT3.pm');
|
21 | 21 |
my $lib_4 = $tzil->slurp_file('build/lib/DZT4.pm');
|
22 | 22 |
my $lib_5 = $tzil->slurp_file('build/lib/DZT5.pm');
|
|
23 |
my $lib_7 = $tzil->slurp_file('build/lib/DZT7.pm');
|
23 | 24 |
my $tst_0 = $tzil->slurp_file('build/t/basic.t' );
|
24 | 25 |
|
25 | 26 |
# e short for expected files
|
|
77 | 78 |
1;
|
78 | 79 |
END LIB5
|
79 | 80 |
|
|
81 |
my $elib_7 = <<'END LIB7';
|
|
82 |
use strict;
|
|
83 |
use warnings;
|
|
84 |
package DZT7;
|
|
85 |
our $VERSION = '0.1.0'; ## TRIAL VERSION
|
|
86 |
# ABSTRACT: my abstract
|
|
87 |
1;
|
|
88 |
END LIB7
|
|
89 |
|
80 | 90 |
my $etst_0 = <<'END TST0';
|
81 | 91 |
#!/usr/bin/perl
|
82 | 92 |
# VERSION
|
|
89 | 99 |
is ( $lib_3, $elib_3, 'check DZT3.pm' );
|
90 | 100 |
is ( $lib_4, $elib_4, 'check DZT4.pm' );
|
91 | 101 |
is ( $lib_5, $elib_5, 'check DZT5.pm' );
|
|
102 |
is ( $lib_7, $elib_7, 'check DZT7.pm' );
|
92 | 103 |
is ( $tst_0, $etst_0, 'check basic.t' );
|
93 | 104 |
|
94 | 105 |
for my $file ( qw/DZT2 DZT3/ ) {
|