Acme-HidamariSketch

 view release on metacpan or  search on metacpan

eg/characters.pl  view on Meta::CPAN

binmode(STDOUT, ":utf8");

use Acme::HidamariSketch;

my $hidamari = Acme::HidamariSketch->new;
my @characters = $hidamari->characters;

# みんなの情報が見たい放題
foreach my $character (@characters) {
    printf "-----------------------\n";
    my $name     = $character->{name_ja}  ? $character->{name_ja}  : "undef";
    my $birthday = $character->{birthday} ? $character->{birthday} : "undef";
    my $sign     = $character->{sign}     ? $character->{sign}     : "undef";
    my $color    = $character->{color}    ? $character->{color}    : "undef";
    printf "name:        " . $name     . "\n";
    printf "birthday:    " . $birthday . "\n";
    printf "sign:        " . $sign     . "\n";
    printf "color:       " . $color    . "\n";
    printf "room_number:\n{\n";
    my $room_number = $character->{room_number};
    for my $year (qw/before first second third/) {
        if (defined $room_number->{$year}) {
            printf '  ' . $year . ': ' . $room_number->{$year} . "\n";
        }
        else {
            printf '  ' . $year . ": undef\n";
        };
    }
    printf "}\n";
}

lib/Acme/HidamariSketch/Apartment.pm  view on Meta::CPAN

    }, $class;

    return $self;
}

sub knock {
    my ($self, $knock_room) = @_;
 
    if (!defined $knock_room) {
        # 部屋が存在しない
        return undef;
    }

    for my $tenant (@{$self->{tenants}}) {
        my $room_number = $tenant->{room_number}->{$self->{year}};
        if (defined $room_number and $knock_room == $room_number) {
            return $tenant;
        };
    }

    # 存在しない部屋番号
    return undef;
}

lib/Acme/HidamariSketch/Hiro.pm  view on Meta::CPAN

our $VERSION = '0.05';


sub info {
    return (
        name_ja     => 'ヒロ',
        name_en     => 'hiro',
        nickname    => 'ヒロ',
        birthday    => '6/15',
        voice_by    => '後藤 邑子',
        room_number => {before => 203, first => 101, second => 101, third => undef},
        sign        => '双子座',
        color       => '#FFC0CB',    # ピンク
        course      => '美術科',
    );
}

1;

lib/Acme/HidamariSketch/Matsuri.pm  view on Meta::CPAN


use base qw/Acme::HidamariSketch::Base/;

our $VERSION = '0.05';


sub info {
    return ( 
        name_ja     => '茉里',
        name_en     => 'matsuri',
        nickname    => undef,
        birthday    => undef,
        voice_by    => undef,
        room_number => {before => undef, first => undef, second => undef, third => 101},
        sign        => undef,
        color       => undef,
        course      => '美術科',
    );
}

1;

lib/Acme/HidamariSketch/Misato.pm  view on Meta::CPAN


use base qw/Acme::HidamariSketch::Base/;

our $VERSION = '0.05';


sub info {
    return (
        name_ja     => 'みさと',
        name_en     => 'misato',
        nickname    => undef,
        birthday    => undef,
        voice_by    => '小清水 亜美',
        room_number => {before => 201, first => undef, second => undef, third => undef},
        sign        => undef,
        color       => undef,
        course      => '美術科',
    );
}

1;

lib/Acme/HidamariSketch/Miyako.pm  view on Meta::CPAN

our $VERSION = '0.05';


sub info {
    return (
        name_ja     => '宮子',
        name_en     => 'miyako',
        nickname    => '宮ちゃん',
        birthday    => '10/10',
        voice_by    => '水橋 かおり',
        room_number => {before => undef, first => 202, second => 202, third => 202},
        sign        => '天秤座',
        color       => '#FFFF00',   # イエロー
        course      => '美術科',
    );
}

1;

lib/Acme/HidamariSketch/Nazuna.pm  view on Meta::CPAN

our $VERSION = '0.05';


sub info {
    return (
        name_ja     => 'なずな',
        name_en     => 'nazuna',
        nickname    => 'なずな殿',
        birthday    => '1/7',
        voice_by    => '小見川 千明',
        room_number => {before => undef, first => undef, second => 203, third => 203},
        sign        => '山羊座',
        color       => '#F5F5F5',    # ホワイト
        course      => '普通科',
    );
}

1;

lib/Acme/HidamariSketch/Nori.pm  view on Meta::CPAN

our $VERSION = '0.05';


sub info {
    return (
        name_ja     => '乃莉',
        name_en     => 'nori',
        nickname    => qw/のりっぺ ノリスケ ノリコさん/,
        birthday    => '2/6',
        voice_by    => '原田 ひとみ',
        room_number => {before => undef, first => undef, second => 103, third => 103},
        sign        => '水瓶座',
        color       => '#89CEEB',   # ブルー
        course      => '美術科',
    );
}

1;

lib/Acme/HidamariSketch/Riri.pm  view on Meta::CPAN


use base qw/Acme::HidamariSketch::Base/;

our $VERSION = '0.05';


sub info {
    return (
        name_ja     => 'リリ',
        name_en     => 'riri',
        nickname    => undef,
        birthday    => undef,
        voice_by    => '白石 涼子',
        room_number => {before => 101, first => undef, second => undef, third => undef},
        sign        => undef,
        color       => undef,
        course      => '美術科',
    );
}

1;

lib/Acme/HidamariSketch/Sae.pm  view on Meta::CPAN

our $VERSION = '0.05';


sub info {
    return (
        name_ja     => '沙英',
        name_en     => 'sae',
        nickname    => 'さえ',
        birthday    => '11/3',
        voice_by    => '新谷 良子',
        room_number => {before => 102, first => 102, second => 102, third => undef},
        sign        => '蠍座',
        color       => '#800080',   # パープル
        course      => '美術科',
    );
}

1;

lib/Acme/HidamariSketch/Yuno.pm  view on Meta::CPAN

our $VERSION = '0.05';


sub info {
    return ( 
        name_ja     => 'ゆの',
        name_en     => 'yuno',
        nickname    => 'ゆのっち',
        birthday    => '5/5',
        voice_by    => '阿澄 佳奈',
        room_number => {before => undef, first => 201, second => 201, third => 201},
        sign        => '射手座',
        color       => '#FFA500',   # オレンジ
        course      => '美術科',
    );
}

1;

t/02_characters.t  view on Meta::CPAN

    subtest 'ゆの' => sub {
        is $characters[0]->{name_ja},     'ゆの';
        is $characters[0]->{name_en},     'yuno';
        is $characters[0]->{nickname},    'ゆのっち';
        is $characters[0]->{voice_by},    '阿澄 佳奈';
        is $characters[0]->{birthday},    '5/5';
        is $characters[0]->{sign},        '射手座';
        is $characters[0]->{color},       '#FFA500';
        is_deeply 
            $characters[0]->{room_number}, {
                before => undef,
                first  => 201,
                second => 201,
                third  => 201,
            }
        ;
    };
    
    subtest '宮子' => sub {
        is $characters[1]->{name_ja},     '宮子';
        is $characters[1]->{name_en},     'miyako';
        is $characters[1]->{nickname},    '宮ちゃん';
        is $characters[1]->{voice_by},    '水橋 かおり';
        is $characters[1]->{birthday},    '10/10';
        is $characters[1]->{sign},        '天秤座';
        is $characters[1]->{color},       '#FFFF00';
        is_deeply 
            $characters[1]->{room_number}, {
                before => undef,
                first  => 202,
                second => 202,
                third  => 202,
            }
        ;
    };

    subtest 'ヒロ' => sub {
        is $characters[2]->{name_ja},     'ヒロ';
        is $characters[2]->{name_en},     'hiro';
        is $characters[2]->{nickname},    'ヒロ';
        is $characters[2]->{voice_by},    '後藤 邑子';
        is $characters[2]->{birthday},    '6/15';
        is $characters[2]->{sign},        '双子座';
        is $characters[2]->{color},       '#FFC0CB';
        is_deeply 
            $characters[2]->{room_number}, {
                before => 203, 
                first  => 101,
                second => 101,
                third  => undef,
            }
        ;
    };

    subtest '沙英' => sub {
        is $characters[3]->{name_ja},     '沙英';
        is $characters[3]->{name_en},     'sae';
        is $characters[3]->{nickname},    'さえ';
        is $characters[3]->{voice_by},    '新谷 良子';
        is $characters[3]->{birthday},    '11/3';
        is $characters[3]->{sign},        '蠍座';
        is $characters[3]->{color},       '#800080';
        is_deeply 
            $characters[3]->{room_number}, {
                before => 102, 
                first  => 102,
                second => 102,
                third  => undef,
            }
        ;
    };

    subtest '乃莉' => sub {
        is $characters[4]->{name_ja},        '乃莉';
        is $characters[4]->{name_en},        'nori';
        eq_array $characters[4]->{nickname},  qw/のりっぺ ノリスケ ノリコさん/;
        is $characters[4]->{voice_by},       '原田 ひとみ';
        is $characters[4]->{birthday},       '2/6';
        is $characters[4]->{sign},           '水瓶座';
        is $characters[4]->{color},          '#89CEEB';
        is_deeply 
            $characters[4]->{room_number}, {
                before => undef, 
                first  => undef,
                second => 103,
                third  => 103,
            }
        ;
    };

    subtest 'なずな' => sub {
        is $characters[5]->{name_ja},     'なずな';
        is $characters[5]->{name_en},     'nazuna';
        is $characters[5]->{nickname},    'なずな殿';
        is $characters[5]->{voice_by},    '小見川 千明';
        is $characters[5]->{birthday},    '1/7';
        is $characters[5]->{sign},        '山羊座';
        is $characters[5]->{color},       '#F5F5F5';
        is_deeply 
            $characters[5]->{room_number}, {
                before => undef, 
                first  => undef, 
                second => 203,
                third  => 203,
            }
        ;
    };

    subtest '茉里' => sub {
        is $characters[6]->{name_ja},     '茉里';
        is $characters[6]->{name_en},     'matsuri';
        is $characters[6]->{nickname},    undef;
        is $characters[6]->{voice_by},    undef;
        is $characters[6]->{birthday},    undef;
        is $characters[6]->{sign},        undef;
        is $characters[6]->{color},       undef;
        is_deeply 
            $characters[6]->{room_number}, {
                before => undef,
                first  => undef,
                second => undef, 
                third  => 101,
            }
        ;
    };

    subtest 'リリ' => sub {
        is $characters[7]->{name_ja},     'リリ';
        is $characters[7]->{name_en},     'riri';
        is $characters[7]->{nickname},    undef;
        is $characters[7]->{voice_by},    '白石 涼子';
        is $characters[7]->{birthday},    undef;
        is $characters[7]->{sign},        undef;
        is $characters[7]->{color},       undef;
        is_deeply 
            $characters[7]->{room_number}, {
                before => 101,
                first  => undef,
                second => undef, 
                third  => undef,
            }
        ;
    };

    subtest 'みさと' => sub {
        is $characters[8]->{name_ja},     'みさと';
        is $characters[8]->{name_en},     'misato';
        is $characters[8]->{nickname},    undef;
        is $characters[8]->{voice_by},    '小清水 亜美';
        is $characters[8]->{birthday},    undef;
        is $characters[8]->{sign},        undef;
        is $characters[8]->{color},       undef;
        is_deeply 
            $characters[8]->{room_number}, {
                before => 201,
                first  => undef,
                second => undef, 
                third  => undef,
            }
        ;
    };
};


done_testing;

t/03_apartment.t  view on Meta::CPAN

    my $yuno   = Acme::HidamariSketch::Yuno->new;
    my $miyako = Acme::HidamariSketch::Miyako->new;
    my $nori   = Acme::HidamariSketch::Nori->new;
    my $nazuna = Acme::HidamariSketch::Nazuna->new;

    is_deeply $apartment->knock(201), $yuno,   'ゆのがお出迎え'  ;
    is_deeply $apartment->knock(202), $miyako, '宮子がお出迎え'  ;
    is_deeply $apartment->knock(203), $nazuna, 'なずながお出迎え';
    is_deeply $apartment->knock(103), $nori,   '乃莉がお出迎え'  ;

    is $apartment->knock,      undef;
    is $apartment->knock(104), undef;
};


done_testing;



( run in 2.420 seconds using v1.01-cache-2.11-cpan-d80b1682f3f )