| 1 | package Acme::NoTalentAssClown; | ||||||||||||||||||||
| 2 | 2 | ▶ | use Lyrics::Fetcher; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | |||||||||||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 2 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 0 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||
| 8 | 0 | my ( $class, %options ) = @_; | |||||||||||||||||||
| 9 | 0 | ▶ | $class = ref($class) || $class; | ||||||||||||||||||
|
Condition0%0/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table0%0/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||
| 10 | my $self = { | ||||||||||||||||||||
| 11 | agent => $options{agent}, | ||||||||||||||||||||
| 12 | 0 | entire_collection => [ | |||||||||||||||||||
| 13 | "That's What Love Is All About", | ||||||||||||||||||||
| 14 | "The Dock Of The Bay", | ||||||||||||||||||||
| 15 | "Soul Provider", | ||||||||||||||||||||
| 16 | "How Am I Supposed To Live Without You", | ||||||||||||||||||||
| 17 | "How Can We Be Lovers", | ||||||||||||||||||||
| 18 | "When I'm Back On My Feet Again", | ||||||||||||||||||||
| 19 | "Georgia On My Mind", | ||||||||||||||||||||
| 20 | "Time, Love And Tenderness", | ||||||||||||||||||||
| 21 | "When A Man Loves A Woman", | ||||||||||||||||||||
| 22 | "Missing You Now", | ||||||||||||||||||||
| 23 | "Steel Bars", | ||||||||||||||||||||
| 24 | "Said I Loved You...But I Lied", | ||||||||||||||||||||
| 25 | "Can I Touch You...There?", | ||||||||||||||||||||
| 26 | "I Promise You", | ||||||||||||||||||||
| 27 | "I Found Someone", | ||||||||||||||||||||
| 28 | "A Love So Beautiful", | ||||||||||||||||||||
| 29 | "This River" | ||||||||||||||||||||
| 30 | ] | ||||||||||||||||||||
| 31 | }; | ||||||||||||||||||||
| 32 | 0 | $Lyrics::Fetcher::gid = $options{gid}; | |||||||||||||||||||
| 33 | 0 | bless( $self, $class ); | |||||||||||||||||||
| 34 | 0 | return ($self); | |||||||||||||||||||
| 35 | } | ||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | =head1 NAME | ||||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | Acme::NoTalentAssClown - Get some Bolton Lyrics! | ||||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | =head1 VERSION | ||||||||||||||||||||
| 42 | |||||||||||||||||||||
| 43 | Version 0.01 | ||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | =head1 SYNOPSIS | ||||||||||||||||||||
| 46 | |||||||||||||||||||||
| 47 | use Acme::NoTalentAssClown; | ||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | #Defaults to use Lyrics::Fetcher::Google, but any Lyrics::Fetcher | ||||||||||||||||||||
| 50 | #plugin will work as specified by agent=>'bar' | ||||||||||||||||||||
| 51 | my $nta = Acme::NoTalentAssClown->new(gid=>'yourGoogleApi_ID'); | ||||||||||||||||||||
| 52 | print $nta->grammys(); #finds a greatest hit | ||||||||||||||||||||
| 53 | print $nta->grammys('When a Man Loves a Woman'); #For my money, it doesn't get any better | ||||||||||||||||||||
| 54 | ... | ||||||||||||||||||||
| 55 | |||||||||||||||||||||
| 56 | =head1 METHODS | ||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | =over 4 | ||||||||||||||||||||
| 59 | |||||||||||||||||||||
| 60 | =item new | ||||||||||||||||||||
| 61 | |||||||||||||||||||||
| 62 | Initializes Acme::NoTalentAssClown and loads lyric loader depending on agent | ||||||||||||||||||||
| 63 | |||||||||||||||||||||
| 64 | =item grammys | ||||||||||||||||||||
| 65 | |||||||||||||||||||||
| 66 | Returns the result of a search for a random greatest hit, or a hit you specify | ||||||||||||||||||||
| 67 | |||||||||||||||||||||
| 68 | =back | ||||||||||||||||||||
| 69 | |||||||||||||||||||||
| 70 | =cut | ||||||||||||||||||||
| 71 | |||||||||||||||||||||
| 72 | |||||||||||||||||||||
| 73 | 2 | our $VERSION = '0.01'; | |||||||||||||||||||
| 74 | |||||||||||||||||||||
| 75 | 0 | ▶ | sub grammys { | ||||||||||||||||||
|
Subroutine
grammys: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||
| 76 | 0 | my $self = shift; | |||||||||||||||||||
| 77 | 0 | my ($suggestion) = @_; | |||||||||||||||||||
| 78 | $suggestion ||= | ||||||||||||||||||||
| 79 | $self->{entire_collection} | ||||||||||||||||||||
| 80 | 0 | ▶ | [ rand( scalar( @{ $self->{entire_collection} } ) ) ]; | ||||||||||||||||||
|
Condition0%0/3
$suggestion ||= $self->{"entire_collection"}[rand scalar @{$self->{"entire_collection"};}]
MC/DC0%0/2
$suggestion ||= $self->{"entire_collection"}[rand scalar @{$self->{"entire_collection"};}]
$suggestion
$self->{"entire_collection"}[rand scalar @{$self->{"entire_collection"};}]
Truth table0%0/3
A ||= B
A= $suggestionB= $self->{"entire_collection"}[rand scalar @{$self->{"entire_collection"};}]
| |||||||||||||||||||||
| 81 | return Lyrics::Fetcher->fetch( | ||||||||||||||||||||
| 82 | $suggestion, | ||||||||||||||||||||
| 83 | "Michael Bolton", | ||||||||||||||||||||
| 84 | 0 | ▶ | $self->{agent} || "Google" | ||||||||||||||||||
|
Condition0%0/2
$self->{'agent'} || 'Google'
MC/DC0%0/1
$self->{'agent'} || 'Google'
$self->{'agent'}
Truth table0%0/2
A
A= $self->{'agent'}
| |||||||||||||||||||||
| 85 | ); | ||||||||||||||||||||
| 86 | } | ||||||||||||||||||||
| 87 | |||||||||||||||||||||
| 88 | =head1 AUTHOR | ||||||||||||||||||||
| 89 | |||||||||||||||||||||
| 90 | John Lifsey, C<< <nebulous@crashed.net> >> | ||||||||||||||||||||
| 91 | |||||||||||||||||||||
| 92 | =head1 BUGS | ||||||||||||||||||||
| 93 | |||||||||||||||||||||
| 94 | I'm sure there are plenty of bugs. | ||||||||||||||||||||
| 95 | But why should I change it? | ||||||||||||||||||||
| 96 | He's the one who sucks. | ||||||||||||||||||||
| 97 | |||||||||||||||||||||
| 98 | Please report any bugs or feature requests to | ||||||||||||||||||||
| 99 | C<bug-acme-notalentassclown@rt.cpan.org>, or through the web interface at | ||||||||||||||||||||
| 100 | L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Acme-NoTalentAssClown>. | ||||||||||||||||||||
| 101 | I will be notified, and then you'll automatically be notified of progress on | ||||||||||||||||||||
| 102 | your bug as I make changes. | ||||||||||||||||||||
| 103 | |||||||||||||||||||||
| 104 | =head1 COPYRIGHT & LICENSE | ||||||||||||||||||||
| 105 | |||||||||||||||||||||
| 106 | Copyright 2005 John Lifsey, all rights reserved. | ||||||||||||||||||||
| 107 | |||||||||||||||||||||
| 108 | This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||
| 109 | under the same terms as Perl itself. | ||||||||||||||||||||
| 110 | |||||||||||||||||||||
| 111 | =cut | ||||||||||||||||||||
| 112 | |||||||||||||||||||||
| 113 | 2 | 1; # End of Acme::NoTalentAssClown | |||||||||||||||||||