File Coverage

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


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