File Coverage

blib/lib/Acme/BooK/Is/My/Bitch.pm
Criterion Covered Total %
statement 21 21 100.0
branch n/a
condition n/a
subroutine 9 9 100.0
pod 3 3 100.0
total 33 33 100.0


line stmt bran cond sub pod time code
1             package Acme::BooK::Is::My::Bitch;
2             {
3             $Acme::BooK::Is::My::Bitch::VERSION = '0.04';
4             }
5              
6 2     2   247360 use 5.006;
  2         9  
  2         268  
7 2     2   14 use warnings;
  2         5  
  2         65  
8 2     2   12 use strict;
  2         20  
  2         101  
9              
10 2     2   5317 use Acme::MetaSyntactic;
  2         136557  
  2         16  
11              
12             # ###### Implementation ###########
13              
14 1     1 1 17 sub new { shift }
15              
16             my $de_underscore = sub { map { y/_/ /; $_ } @_ };
17              
18             my %methods = (
19             'tell_the_truth' => [
20             'You know, my favorite pornstar is definitely %s.',
21             'pornstars', $de_underscore
22             ],
23             'thats_nothing' => [
24             'Oh, that\'s nothing! You should\'ve seen what I auctioned in %s!',
25             'yapc', $de_underscore
26             ],
27             'code' => [
28             'You know, I wrote some code for the %s space mission, but it was rejected for its lack of clarity...',
29             'space_missions', $de_underscore
30             ],
31             'next_talk' => [
32             'My next lightning talk will be called "%s! %s!! %s!!!"',
33             'batman', sub { map { y/_/-/; ucfirst } @_ }
34             ],
35             'next_yapc' => [
36             'I think the next YAPC should be on %s!',
37             'planets', ],
38             'sql' => [
39             'I think we can solve that with a %s %s %s',
40             'sql', ],
41             'twisted_perl' => [
42             'I\'m pretty sure I could do that just by using %s and %s',
43             'opcodes',
44             ],
45             'words_of_wisdom' => [
46             'My grandfather once told me: ' . join( " ", ('%s') x 7 ),
47             'loremipsum',
48             ],
49             ( # quotes that need a theme/category
50             'baby_girl' => [
51             'You know we considered naming our baby girl %s?',
52             'pornstars/female',
53             sub { ( my $baby = shift ) =~ s/_.*$//; $baby }
54             ],
55             )x!! ( $Acme::MetaSyntactic::VERSION >= 1.011 ),
56             );
57              
58             for my $method ( keys %methods ) {
59             my ( $template, $theme, $filter ) = @{ $methods{$method} };
60             $filter ||= sub {@_};
61             my $qty =()= $template =~ /%s/g;
62 2     2   1716 no strict 'refs';
  2         4  
  2         1652  
63             *{$method} = sub {
64 10     10   2262 return sprintf $template, $filter->( metaname( $theme => $qty ) );
65             };
66             }
67              
68 1     1 1 2086 sub available_quotes { return sort keys %methods }
69              
70             sub random_quote {
71 1     1 1 285 my $self = shift;
72 1         9 my $method = (keys %methods)[ rand keys %methods ];
73 1         8 return $self->$method();
74             }
75              
76             1; # Magic true value required at end of module
77              
78              
79              
80             =pod
81              
82             =encoding iso-8859-1
83              
84             =head1 NAME
85              
86             Acme::BooK::Is::My::Bitch - BooK is my Bitch
87              
88             =head1 VERSION
89              
90             version 0.04
91              
92             =head1 SYNOPSIS
93              
94             use Acme::BooK::Is::My::Bitch;
95              
96             my $bitch = Acme::BooK::Is::My::Bitch->new();
97              
98             my $quote = $bitch->random_quote();
99              
100             =head1 DESCRIPTION
101              
102             Acme::BooK::Is::My::Bitch has a great story behind it.
103              
104             At YAPC::EU::2006, in Birmingham, England, BooK auctioned the right
105             for someone to pick a module from CPAN and have that module's name
106             (temporarily) tattoed in his arm for all the conferences BooK would go
107             to during 2007.
108              
109             Cog asked if the module had to exist by that time, and BooK said "No."
110              
111             BIG MISTAKE!
112              
113             =head1 INTERFACE
114              
115             =head2 Program Interface
116              
117             =head3 new
118              
119             Creates a new Acme::BooK::Is::My::Bitch object.
120              
121             my $bitch = Acme::BooK::Is::My::Bitch->new();
122              
123             Since all methods are actually class methods, the following line
124             is exactly equivalent to the above one (and shorter!):
125              
126             my $bitch = 'Acme::BooK::Is::My::Bitch';
127              
128             =head3 available_quotes
129              
130             Returns the list of available quote methods.
131              
132             =head2 Module Interface
133              
134             =head3 baby_girl
135              
136             BooK has no imagination for naming his kids.
137              
138             my $baby_girl_quote = $bitch->baby_girl();
139              
140             =head3 code
141              
142             BooK is really clever.
143              
144             my $code_quote = $bitch->code();
145              
146             =head3 next_talk
147              
148             BooK is known to auto-generate the names of his lightning talks.
149              
150             my $next_talk_quote = $bitch->next_talk();
151              
152             =head3 next_yapc
153              
154             BooK has something to say about the place the next YAPC::EU is going to be.
155              
156             my $next_yapc_quote = $bitch->next_yapc();
157              
158             =head3 sql
159              
160             BooK claims he's not an SQL guru.
161              
162             my $sql_quote = $bitch->sql();
163              
164             =head3 tell_the_truth
165              
166             BooK has the pornstars theme on L. There must be a reason.
167              
168             my $tell_the_truth_quote = $bitch->tell_the_truth();
169              
170             =head3 thats_nothing
171              
172             BooK has the craziest ideas ever for auctions.
173              
174             my $thats_nothing_quote = $bitch->thats_nothing();
175              
176             =head3 twisted_perl
177              
178             BooK is known to write very obfuscated code.
179              
180             my $twisted_perl_quote = $bitch->twisted_perl();
181              
182             =head3 words_of_wisdom
183              
184             BooK claims he got a lot of wisdom from his grandfather.
185              
186             my $words_of_wisdom_quote = $bitch->words_of_wisdom();
187              
188             =head3 random_quote
189              
190             To tell you the truth, no one really knows what BooK is going to say next.
191              
192             my $random_quote_quote = $bitch->random_quote();
193              
194             =head1 CONFIGURATION AND ENVIRONMENT
195              
196             Acme-BooK-Is-My-Bitch requires no configuration files or environment variables.
197              
198             =head1 DEPENDENCIES
199              
200             =over
201              
202             =item *
203              
204             L,
205             L.
206              
207             =back
208              
209             =head1 FUTURE
210              
211             =over
212              
213             =item *
214              
215             BooK is still growing. This module will evolve as BooK's arms grow.
216              
217             =back
218              
219             =head1 INCOMPATIBILITIES
220              
221             None reported.
222              
223             =head1 BUGS AND LIMITATIONS
224              
225             All reported bugs have been fixed, all requested features have been added.
226              
227             =head1 AUTHOR
228              
229             José Castro C<< >>
230              
231             =head1 MAINTAINER
232              
233             Philippe Bruhat (BooK) C<< >>
234              
235             =head1 ACKNOWLEDGEMENTS
236              
237             BooK actually wrote part of the code for this module and suggested
238             some of the ideas that were turned into methods.
239              
240             This module is not about Cog mocking BooK; it's rather about Cog B
241             BooK making fun of themselves.
242              
243             We spent a very funny afternoon in a mini-hackathon in Birmingham
244             starting up this module. We finished its first version while at the
245             Old Joint pub with some more YAPC attendees.
246              
247             =head1 $_ IS MY BITCH
248              
249             The phrase "I<...> is my bitch" has been thrown around a lot during past
250             YAPC Europe conferences. This tradition has thankfully been lost, but some
251             artifacts remain:
252              
253             =over 4
254              
255             =item L
256              
257             The T-shirt that started it all when the first YAPC Europe was organized,
258             back in 2000.
259              
260             =item L
261              
262             Schwern worked for Belfast.pm, and all he got was this lousy T-shirt.
263             One of those shirts was auctioned at the Amsterdam YAPC in 2001.
264              
265             =item L
266              
267             Dave Cross bought an obfuscation by BooK at the Amsterdam YAPC auction.
268             The code was revelead during the Paris YAPC auction in 2003, and the
269             crowd bid (and won) against Greg to see it run.
270              
271             =item L
272              
273             The temporary tatoo alluded to above, at the Vienna YAPC in 2007.
274              
275             =back
276              
277             =head1 LICENCE AND COPYRIGHT
278              
279             Copyright (c) 2006, Jose Castro C<< >>. All rights reserved.
280              
281             This module is free software; you can redistribute it and/or
282             modify it under the same terms as Perl itself.
283              
284             =head1 DISCLAIMER OF WARRANTY
285              
286             BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
287             FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
288             OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
289             PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
290             EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
291             WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
292             ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
293             YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
294             NECESSARY SERVICING, REPAIR, OR CORRECTION.
295              
296             IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
297             WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
298             REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE
299             LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
300             OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
301             THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
302             RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
303             FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
304             SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
305             SUCH DAMAGES.
306              
307             =cut
308              
309              
310             __END__