File Coverage

blib/lib/Acme/MorningMusume/ShinMember.pm
Criterion Covered Total %
statement 18 41 43.9
branch 0 6 0.0
condition n/a
subroutine 6 7 85.7
pod 1 1 100.0
total 25 55 45.4


line stmt bran cond sub pod time code
1             package Acme::MorningMusume::ShinMember;
2              
3 1     1   46587 use warnings;
  1         2  
  1         40  
4 1     1   6 use strict;
  1         2  
  1         37  
5 1     1   1288 use Acme::MorningMusume;
  1         218900  
  1         38  
6 1     1   1041 use Acme::BloodType;
  1         507  
  1         23  
7 1     1   5 use utf8;
  1         3  
  1         7  
8 1     1   22 use base 'Acme::MorningMusume::Base';
  1         2  
  1         1007  
9              
10             =head1 NAME
11              
12             Acme::MorningMusume::ShinMember - Create random Morning Musume!
13              
14             =head1 VERSION
15              
16             Version 0.01
17              
18             =cut
19              
20             our $VERSION = '0.01';
21              
22             =head1 SYNOPSIS
23              
24             Creates a random morning musume member that's "based on" two random
25             parent members:
26              
27             use Acme::MorningMusume::ShinMember;
28              
29             my $member = Acme::MorningMusume::ShinMember->new;
30             print "I created ". $member->name_en. "!\n";
31             # etc..
32              
33             The C<$member> can then be used like any C
34             object. See C for an example.
35              
36             =head1 FUNCTIONS
37              
38             =head2 info
39              
40             Called by Acme::MorningMusume::Base::new to make the Musume.
41              
42             =cut
43              
44             sub info {
45 0     0 1   my $musume = Acme::MorningMusume->new;
46 0           my @musume = $musume->select('age', 0, '<'); # all of 'em!
47 0           my ($mom, $dad) = @musume[rand(@musume), rand(@musume)];
48            
49 0           my %attributes;
50 0           $attributes{first_name_en} = $mom->first_name_en;
51 0           $attributes{first_name_ja} = $mom->first_name_ja;
52 0           utf8::decode($attributes{first_name_ja});
53 0           $attributes{family_name_en} = $dad->family_name_en;
54 0           $attributes{family_name_ja} = $dad->family_name_ja;
55 0           utf8::decode($attributes{family_name_ja});
56 0           $attributes{nick} = [substr($attributes{first_name_ja}, 0, 1).'っちゃん'];
57 0           $attributes{birthday} = $mom->birthday - rand($mom->birthday -
58             $dad->birthday);
59 0           $attributes{blood_type} = Acme::BloodType->new(
60             {phenotype => $mom->blood_type}
61             )->cross(
62             Acme::BloodType->new(
63             {phenotype => $dad->blood_type}))
64             ->get_bloodtype;
65            
66 0 0         $attributes{hometown} = (rand 1 < 0.5 ? $mom : $dad)->hometown;
67 0           utf8::decode($attributes{hometown});
68              
69 0           $attributes{graduate_date} = undef;
70 0           $attributes{class} = int ($mom->class - rand($mom->class - $dad->class));
71 0 0         $attributes{emoticon} = [(@{$dad->emoticon||()},
  0 0          
72 0           @{$mom->emoticon||()})[0..rand 2]];
73 0           utf8::decode($_) for @{$attributes{emoticon}};
  0            
74 0           return %attributes;
75             }
76              
77             =head1 AUTHOR
78              
79             Jonathan Rockway, C<< >>
80              
81             =head1 BUGS
82              
83             Please report any bugs or feature requests to
84             C, or through the web interface at
85             L.
86             I will be notified, and then you'll automatically be notified of progress on
87             your bug as I make changes.
88              
89             =head1 SEE ALSO
90              
91             Want the real Mornon
92              
93             =head1 ACKNOWLEDGEMENTS
94              
95             C<#perl>.
96              
97             =head1 COPYRIGHT & LICENSE
98              
99             Copyright 2006 Jonathan Rockway, all rights reserved.
100              
101             This program is free software; you can redistribute it and/or modify it
102             under the same terms as Perl itself.
103              
104             =cut
105              
106             1; # End of Acme::MorningMusume::ShinMember