line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
6172385
|
use 5.014; # because we use the 'non-destructive substitution' feature (s///r) |
|
1
|
|
|
|
|
29
|
|
2
|
1
|
|
|
1
|
|
19
|
use utf8; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
54
|
|
3
|
1
|
|
|
1
|
|
58
|
use strict; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
60
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
296
|
|
5
|
|
|
|
|
|
|
package Banal::Dist::Zilla::Role::Text::Template::Selfish; |
6
|
|
|
|
|
|
|
# vim: set ts=2 sts=2 sw=2 tw=115 et : |
7
|
|
|
|
|
|
|
# ABSTRACT: A role that gives you a 'fill_in_string' method with \$self included in the stash (as $o and $self). |
8
|
|
|
|
|
|
|
# KEYWORDS: author bundle distribution tool |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.198'; |
11
|
|
|
|
|
|
|
# AUTHORITY |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
556
|
use Moose::Role; |
|
1
|
|
|
|
|
491840
|
|
|
1
|
|
|
|
|
7
|
|
14
|
|
|
|
|
|
|
requires qw( _extra_args payload ); |
15
|
|
|
|
|
|
|
with |
16
|
|
|
|
|
|
|
'Dist::Zilla::Role::TextTemplate', # Gives us simple string templating for free (Ã la Text::Template) |
17
|
|
|
|
|
|
|
; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
6573
|
use Dist::Zilla::Util; |
|
1
|
|
|
|
|
2912
|
|
|
1
|
|
|
|
|
15
|
|
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
43
|
use Scalar::Util qw(refaddr); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
86
|
|
23
|
1
|
|
|
1
|
|
6
|
use List::Util 1.45 qw(first all any none pairs uniq); |
|
1
|
|
|
|
|
23
|
|
|
1
|
|
|
|
|
117
|
|
24
|
1
|
|
|
1
|
|
579
|
use List::MoreUtils qw(arrayify); |
|
1
|
|
|
|
|
13885
|
|
|
1
|
|
|
|
|
8
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# TABULO : a custom 'has' to save some typing and lines ... :-) |
28
|
|
|
|
|
|
|
# The '*' in the prototype allows bareword attribute names. |
29
|
3
|
|
|
3
|
0
|
7
|
sub haz (*@) { my $name=shift; has ( $name => ( is => 'ro', init_arg => undef, lazy => 1, @_)); } |
|
3
|
|
|
|
|
12
|
|
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
1
|
|
1603
|
use namespace::autoclean; |
|
1
|
|
|
|
|
8112
|
|
|
1
|
|
|
|
|
5
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
haz template_delim_start => ( |
34
|
|
|
|
|
|
|
isa => 'Str', |
35
|
|
|
|
|
|
|
default => sub { my $o = $_[0]; eval { $o->payload->{delim_start} } // '{{' }, |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
haz template_delim_end => ( |
39
|
|
|
|
|
|
|
isa => 'Str', |
40
|
|
|
|
|
|
|
default => sub { my $o = $_[0]; eval { $o->payload->{delim_end} } // '}}' }, |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
haz template_delim => ( |
44
|
|
|
|
|
|
|
isa => 'ArrayRef', |
45
|
|
|
|
|
|
|
default => sub { [ $_[0]->template_delim_start, $_[0]->template_delim_end ] }, |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
has +delim => ( |
50
|
|
|
|
|
|
|
default => sub { $_[0]->template_delim }, |
51
|
|
|
|
|
|
|
); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# Wrap the 'fill_in_string' method, so that it |
56
|
|
|
|
|
|
|
around fill_in_string => sub { |
57
|
|
|
|
|
|
|
my $orig = shift; |
58
|
|
|
|
|
|
|
my ($self, $string, $stash, $args) = ( shift, shift, shift, shift); |
59
|
|
|
|
|
|
|
my $zilla = eval { $self->zilla }; # In case we have a zilla object available. |
60
|
|
|
|
|
|
|
$stash //= +{}; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
local $_ = \$self; # TODO: Test this. If it works, we will have a shorthand for $self within the template. |
63
|
|
|
|
|
|
|
# NOTE: Text::Template requires objects to be passed with additional referencing. |
64
|
|
|
|
|
|
|
$stash = +{ o=>\$self, self=>\$self, %$stash, SELF=>\$self}; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
$self->$orig($string, $stash, $args, @_); |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
}; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=pod |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=encoding UTF-8 |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 NAME |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Banal::Dist::Zilla::Role::Text::Template::Selfish - A role that gives you a 'fill_in_string' method with \$self included in the stash (as $o and $self). |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 VERSION |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
version 0.198 |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 SYNOPSIS |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
In your F<dist.ini>: |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
[...] |
93
|
|
|
|
|
|
|
year=2018 |
94
|
|
|
|
|
|
|
msg = May {{year}} bring you happiness. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 DESCRIPTION |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=for stopwords TABULO |
99
|
|
|
|
|
|
|
=for stopwords GitHub DZIL |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
This is a practical utility role that gives you a 'fill_in_string' method with \$self (== $o) included in the stash stash. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head2 WARNING |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Please note that, although this module needs to be on CPAN for obvious reasons, |
106
|
|
|
|
|
|
|
it is really intended to be a collection of personal preferences, which are |
107
|
|
|
|
|
|
|
expected to be in great flux, at least for the time being. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Therefore, please do NOT base your own distributions on this one, since anything |
110
|
|
|
|
|
|
|
can change at any moment without prior notice, while I get accustomed to dzil |
111
|
|
|
|
|
|
|
myself and form those preferences in the first place... |
112
|
|
|
|
|
|
|
Absolutely nothing in this distribution is guaranteed to remain constant or |
113
|
|
|
|
|
|
|
be maintained at this point. Who knows, I may even give up on dzil altogether... |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
You have been warned. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 SEE ALSO |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=over 4 |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=item * |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
L<Dist::Zilla::PluginBundle::Author::TABULO> |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=back |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 SUPPORT |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Dist-Zilla-PluginBundle-Author-TABULO> |
130
|
|
|
|
|
|
|
(or L<bug-Dist-Zilla-PluginBundle-Author-TABULO@rt.cpan.org|mailto:bug-Dist-Zilla-PluginBundle-Author-TABULO@rt.cpan.org>). |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 AUTHOR |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Tabulo <tabulo@cpan.org> |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
This software is copyright (c) 2018 by Tabulo. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
141
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=cut |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
__END__ |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
#region pod |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
#endregion pod |