Acme-MorningMusume-ShinMember

 view release on metacpan or  search on metacpan

lib/Acme/MorningMusume/ShinMember.pm  view on Meta::CPAN

package Acme::MorningMusume::ShinMember;

use warnings;
use strict;
use Acme::MorningMusume;
use Acme::BloodType;
use utf8;
use base 'Acme::MorningMusume::Base';

=head1 NAME

Acme::MorningMusume::ShinMember - Create random Morning Musume!

=head1 VERSION

Version 0.01

lib/Acme/MorningMusume/ShinMember.pm  view on Meta::CPAN

=cut

sub info {    
    my $musume = Acme::MorningMusume->new;
    my @musume = $musume->select('age', 0, '<'); # all of 'em!
    my ($mom, $dad) = @musume[rand(@musume), rand(@musume)];
    
    my %attributes;
    $attributes{first_name_en} = $mom->first_name_en;
    $attributes{first_name_ja} = $mom->first_name_ja;
    utf8::decode($attributes{first_name_ja});
    $attributes{family_name_en}  = $dad->family_name_en;
    $attributes{family_name_ja}  = $dad->family_name_ja;
    utf8::decode($attributes{family_name_ja});
    $attributes{nick} = [substr($attributes{first_name_ja}, 0, 1).'っちゃん'];
    $attributes{birthday} = $mom->birthday - rand($mom->birthday - 
						  $dad->birthday);
    $attributes{blood_type} = Acme::BloodType->new(
				     {phenotype => $mom->blood_type} 
						  )->cross(
			      Acme::BloodType->new(
				     {phenotype => $dad->blood_type}))
			       ->get_bloodtype;
    
    $attributes{hometown} = (rand 1 < 0.5 ? $mom : $dad)->hometown;
    utf8::decode($attributes{hometown});

    $attributes{graduate_date} = undef;
    $attributes{class} = int ($mom->class - rand($mom->class - $dad->class));
    $attributes{emoticon} = [(@{$dad->emoticon||()}, 
			       @{$mom->emoticon||()})[0..rand 2]];
    utf8::decode($_) for @{$attributes{emoticon}};
    return %attributes;
}

=head1 AUTHOR

Jonathan Rockway, C<< <jrockway at cpan.org> >>

=head1 BUGS

Please report any bugs or feature requests to



( run in 1.290 second using v1.01-cache-2.11-cpan-49f99fa48dc )