line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# This file is part of BLAH |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# This software is Copyright (c) 2015 by Chris Weyl. |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# This is free software, licensed under: |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# The GNU Lesser General Public License, Version 2.1, February 1999 |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
package BLAH; |
11
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:RSRCHBOY'; |
12
|
|
|
|
|
|
|
# git description: 34a88a7 |
13
|
|
|
|
|
|
|
$BLAH::VERSION = '0.001'; # TRIAL |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# ABSTRACT: Business Logic Adapter Helpers |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
351147
|
use Moose; |
|
1
|
|
|
|
|
187476
|
|
|
1
|
|
|
|
|
8
|
|
18
|
1
|
|
|
1
|
|
9426
|
use namespace::autoclean 0.24; |
|
1
|
|
|
|
|
9258
|
|
|
1
|
|
|
|
|
6
|
|
19
|
1
|
|
|
1
|
|
60
|
use Moose::Exporter; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
11
|
|
20
|
1
|
|
|
1
|
|
34
|
use Moose::Util; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
21
|
1
|
|
|
1
|
|
1028
|
use MooseX::AbstractMethod; |
|
1
|
|
|
|
|
23493
|
|
|
1
|
|
|
|
|
6
|
|
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
1
|
|
11933
|
use MooseX::Util::Meta::Class; |
|
1
|
|
|
|
|
52953
|
|
|
1
|
|
|
|
|
48
|
|
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
1
|
|
666
|
use BLAH::Role::BLAH; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
151
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
with |
28
|
|
|
|
|
|
|
'MooseX::Traitor', |
29
|
|
|
|
|
|
|
; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Moose::Exporter->setup_import_methods( |
32
|
|
|
|
|
|
|
also => 'Moose', |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub init_meta { |
36
|
1
|
|
|
1
|
0
|
114
|
my $class = shift @_; |
37
|
1
|
|
|
|
|
11
|
my %args = @_; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
### $class |
40
|
|
|
|
|
|
|
### %args |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
### create metaclass and push BLAH into superclasses for: $args{for_class} |
43
|
1
|
|
|
|
|
7
|
my $meta = Moose->init_meta(@_, metaclass => 'MooseX::Util::Meta::Class'); |
44
|
1
|
|
|
|
|
5429
|
$meta->superclasses('BLAH'); |
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
|
|
23748
|
return $meta; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
abstract 'execute'; |
51
|
|
|
|
|
|
|
abstract 'name'; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
with 'BLAH::Role::BLAH'; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
56
|
|
|
|
|
|
|
!!42; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=pod |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=encoding UTF-8 |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=for :stopwords Chris Weyl |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=for :stopwords Wishlist flattr flattr'ed gittip gittip'ed |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 NAME |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
BLAH - Business Logic Adapter Helpers |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 VERSION |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
This document describes version 0.001 of BLAH - released August 26, 2015 as part of BLAH. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 SYNOPSIS |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
# Create a BLAH! |
79
|
|
|
|
|
|
|
package MyApp::BLAH::Frobnicator; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
use BLAH; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub execute { ... scary things ... } |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 DESCRIPTION |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
You have a codebase that would make a Whole Foods buyer cry with joy. It does |
88
|
|
|
|
|
|
|
things -- important things -- but perhaps in ways that don't lend itself to |
89
|
|
|
|
|
|
|
use elsewhere. And now, naturally, you need to use that business logic |
90
|
|
|
|
|
|
|
elsewhere. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Enter BLAH (Business Logic Adapter Helpers). |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
BLAH is intended to help create a thin layer to help normalize access to |
95
|
|
|
|
|
|
|
business logic in your codebase by providing a common place and structure to |
96
|
|
|
|
|
|
|
host whatever it is you need to do to invoke that bit of business logic |
97
|
|
|
|
|
|
|
elsewhere. It's designed to be as thin and flexible as possible, so at its |
98
|
|
|
|
|
|
|
core each BLAH only provide the necessary structure to normalize invoking your |
99
|
|
|
|
|
|
|
business logic, regardless of where it may reside. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Of course, providing the actual methods to invoke your logic is entirely your |
102
|
|
|
|
|
|
|
responsibility; we only seek to help keep things sane (in an insane world, |
103
|
|
|
|
|
|
|
most likely). |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 REQUIRED METHODS |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head2 execute |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This is the core of your BLAH. It should implement your command -- whether |
110
|
|
|
|
|
|
|
embedded, a simple call/delegation to some other package, or hideously |
111
|
|
|
|
|
|
|
complex -- in its entirety. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
C<execute()> should die on failure, and return otherwise. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head2 name |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
The "name" of this BLAH. BLAH implementers are left to define this on their own, |
118
|
|
|
|
|
|
|
but it is anticipated that the name here will be something like the package name with |
119
|
|
|
|
|
|
|
a namespace prefix removed; e.g. if your BLAH namespace is "Organic::Produce::BLAH" |
120
|
|
|
|
|
|
|
and the BLAH package is "Organic::Produce::BLAH::Relabel::Pesticides", then the BLAH name would be |
121
|
|
|
|
|
|
|
-- surprise! -- "Relabel::Pesticides". |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 SUBCLASSING |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
If you wish to create a subclass of this class to use as the base for your BLAH, note |
126
|
|
|
|
|
|
|
that you should B<not> make that subclass immutable unless it also implements |
127
|
|
|
|
|
|
|
the execute() method. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
(See L<MooseX::AbstractMethod> for details.) |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 SEE ALSO |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Please see those modules/websites for more information related to this module. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=over 4 |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=item * |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
L<BLAH::Role::BLAH|BLAH::Role::BLAH> |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=item * |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
L<MooseX::Traitor|MooseX::Traitor> |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=back |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 BUGS |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website |
150
|
|
|
|
|
|
|
https://github.com/RsrchBoy/blah/issues |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
153
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
154
|
|
|
|
|
|
|
feature. |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 AUTHOR |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Chris Weyl <cweyl@alumni.drew.edu> |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head2 I'm a material boy in a material world |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=begin html |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
<a href="https://gratipay.com/RsrchBoy/"><img src="http://img.shields.io/gratipay/RsrchBoy.svg" /></a> |
165
|
|
|
|
|
|
|
<a href="http://bit.ly/rsrchboys-wishlist"><img src="http://wps.io/wp-content/uploads/2014/05/amazon_wishlist.resized.png" /></a> |
166
|
|
|
|
|
|
|
<a href="https://flattr.com/submit/auto?user_id=RsrchBoy&url=https%3A%2F%2Fgithub.com%2FRsrchBoy%2Fblah&title=RsrchBoy's%20CPAN%20BLAH&tags=%22RsrchBoy's%20BLAH%20in%20the%20CPAN%22"><img src="http://api.flattr.com/button/flattr-badge-large.png" /></a> |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=end html |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Please note B<I do not expect to be gittip'ed or flattr'ed for this work>, |
171
|
|
|
|
|
|
|
rather B<it is simply a very pleasant surprise>. I largely create and release |
172
|
|
|
|
|
|
|
works like this because I need them or I find it enjoyable; however, don't let |
173
|
|
|
|
|
|
|
that stop you if you feel like it ;) |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
L<Flattr|https://flattr.com/submit/auto?user_id=RsrchBoy&url=https%3A%2F%2Fgithub.com%2FRsrchBoy%2Fblah&title=RsrchBoy's%20CPAN%20BLAH&tags=%22RsrchBoy's%20BLAH%20in%20the%20CPAN%22>, |
176
|
|
|
|
|
|
|
L<Gratipay|https://gratipay.com/RsrchBoy/>, or indulge my |
177
|
|
|
|
|
|
|
L<Amazon Wishlist|http://bit.ly/rsrchboys-wishlist>... If and *only* if you so desire. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
This software is Copyright (c) 2015 by Chris Weyl. |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
This is free software, licensed under: |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
The GNU Lesser General Public License, Version 2.1, February 1999 |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=cut |