Acme-MadokaMagica
view release on metacpan or search on metacpan
lib/Acme/MadokaMagica/TvMembers.pm view on Meta::CPAN
package Acme::MadokaMagica::TvMembers;
use strict;
use warnings;
use utf8;
use Data::Section::Simple;
use YAML::Tiny;
sub new {
my ($class, %args) = @_;
my $self = { _has_qb => undef };
my $ds = Data::Section::Simple->new($class);
my $sections = $ds->get_data_section;
for my $section_name ( keys %{$sections} ) {
my $yml = YAML::Tiny->read_string($sections->{$section_name});
my $member_info = $yml->[0];
for my $key ( keys %{$member_info} ) {
$self->{$key} = $member_info->{$key};
}
}
if (defined $args{line}) {
lib/Acme/MadokaMagica/TvMembers.pm view on Meta::CPAN
return $self->{_has_qb};
}
sub name {
my ($self) = @_;
my $line = (caller)[2];
my $limit = $self->{startline} +100;
if( $line >= $limit ) {
return undef;
}
return $self->has_qb ? $self->{witchename} : $self->lastname.' '.$self->firstname;
}
sub firstname {
my $self = shift;
my $line = (caller)[2];
my $limit = $self->{startline} +100;
if($line >= $limit ) {
return undef;
}
return $self->{firstname};
}
sub birthday {
my $self = shift;
my $line = (caller)[2];
my $limit = $self->{startline} +100;
if($line >= $limit ) {
return undef;
}
return $self->{birthday};
}
sub blood_type {
my $self = shift;
my $line = (caller)[2];
my $limit = $self->{startline} +100;
if( $line >= $limit ) {
return undef;
}
return $self->{blood_type};
}
sub lastname {
my $self = shift;
my $line = (caller)[2];
my $limit = $self->{startline} +100;
if( $line >= $limit ) {
return undef;
}
return $self->{lastname};
}
sub age {
my $self = shift;
my $line = (caller)[2];
my $limit = $self->{startline} +100;
if( $line >= $limit ) {
return undef;
}
return $self->{age};
}
sub color{
my ($self) = @_;
my $line = (caller)[2];
my $limit = $self->{startline} +100;
if( $line >= $limit ) {
return undef;
}
return $self->has_qb ? "black" : $self->{color};
}
sub qb {
my ($self) = @_;
my $line = (caller)[2];
my $limit = $self->{startline} +100;
if( $line >= $limit ) {
return undef;
}
$self->has_qb(1);
}
sub say {
my ($self) = @_;
my $line = (caller)[2];
my $limit = $self->{startline} +100;
if( $line >= $limit ) {
return undef;
}
return $self->{say};
}
sub cv {
my $self = shift;
my $line = (caller)[2];
my $limit = $self->{startline} +100;
if( $line >= $limit ) {
return undef;
}
return $self->{cv};
}
1;
t/04_soulgem.t view on Meta::CPAN
is $mami->color,undef;
};
subtest 'members_of' => sub {
my ($kyoko,) = Acme::MadokaMagica->members_of($Acme::MadokaMagica::KyoSaya);
is ref $kyoko,'Acme::MadokaMagica::TvMembers::SakuraKyoko';
is $kyoko->color,'Red';
t/04_soulgem.t view on Meta::CPAN
is $kyoko->color,undef;
};
};
done_testing;
( run in 2.943 seconds using v1.01-cache-2.11-cpan-d80b1682f3f )