| 1 | package Acme::BooK::Is::My::Bitch; | ||||||||||||||||||||
| 2 | { | ||||||||||||||||||||
| 3 | 2 | $Acme::BooK::Is::My::Bitch::VERSION = '0.04'; | |||||||||||||||||||
| 4 | } | ||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | 2 | ▶ | use 5.006; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 2 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 2 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | 2 | ▶ | use Acme::MetaSyntactic; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | # ###### Implementation ########### | ||||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | 1 | ▶ | sub new { shift } | ||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | 4 | ▶ | my $de_underscore = sub { map { y/_/ /; $_ } @_ }; | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 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 | 1 | ▶ | 'batman', sub { map { y/_/-/; ucfirst } @_ } | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 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 | 1 | ▶ | sub { ( my $baby = shift ) =~ s/_.*$//; $baby } | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 54 | 2 | ], | |||||||||||||||||||
| 55 | )x!! ( $Acme::MetaSyntactic::VERSION >= 1.011 ), | ||||||||||||||||||||
| 56 | ); | ||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | 2 | for my $method ( keys %methods ) { | |||||||||||||||||||
| 59 | 18 | my ( $template, $theme, $filter ) = @{ $methods{$method} }; | |||||||||||||||||||
| 60 | 4 | ▶ | $filter ||= sub {@_}; | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.1
Condition66%2/3
$filter ||= sub {
@_;
}
MC/DC0%0/2
$filter ||= sub {
@_;
}
$filter
sub {
@_;
}
Truth table66%2/3
A ||= B
A= $filterB= sub {
@_;
}
| |||||||||||||||||||||
| 61 | 18 | my $qty =()= $template =~ /%s/g; | |||||||||||||||||||
| 62 | 2 | ▶ | no strict 'refs'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 63 | 18 | *{$method} = sub { | |||||||||||||||||||
| 64 | 10 | ▶ | return sprintf $template, $filter->( metaname( $theme => $qty ) ); | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 65 | 18 | }; | |||||||||||||||||||
| 66 | } | ||||||||||||||||||||
| 67 | |||||||||||||||||||||
| 68 | 1 | ▶ | sub available_quotes { return sort keys %methods } | ||||||||||||||||||
|
Subroutine
available_quotes: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 69 | |||||||||||||||||||||
| 70 | sub random_quote { | ||||||||||||||||||||
| 71 | 1 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
random_quote: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 72 | 1 | my $method = (keys %methods)[ rand keys %methods ]; | |||||||||||||||||||
| 73 | 1 | return $self->$method(); | |||||||||||||||||||
| 74 | } | ||||||||||||||||||||
| 75 | |||||||||||||||||||||
| 76 | 2 | 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<Acme::MetaSyntactic>. 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<Acme::MetaSyntactic>, | ||||||||||||||||||||
| 205 | L<Acme::MetaSyntactic::Themes>. | ||||||||||||||||||||
| 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<< <cog@cpan.org> >> | ||||||||||||||||||||
| 230 | |||||||||||||||||||||
| 231 | =head1 MAINTAINER | ||||||||||||||||||||
| 232 | |||||||||||||||||||||
| 233 | Philippe Bruhat (BooK) C<< <book@cpan.org> >> | ||||||||||||||||||||
| 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<and> | ||||||||||||||||||||
| 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<http://perl.ismybit.ch/> | ||||||||||||||||||||
| 256 | |||||||||||||||||||||
| 257 | The T-shirt that started it all when the first YAPC Europe was organized, | ||||||||||||||||||||
| 258 | back in 2000. | ||||||||||||||||||||
| 259 | |||||||||||||||||||||
| 260 | =item L<http://schwern.ismybit.ch/> | ||||||||||||||||||||
| 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<http://greg.mccarroll.ismybit.ch/> | ||||||||||||||||||||
| 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<http://book.ismybit.ch/> | ||||||||||||||||||||
| 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<< <cog@cpan.org> >>. 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__ | ||||||||||||||||||||