view release on metacpan or search on metacpan
requires 'perl', '5.008001';
requires 'Class::Accessor';
requires 'DateTime';
on 'test' => sub {
requires 'Test::More', '0.98';
};
lib/Acme/2zicon.pm view on Meta::CPAN
NakamuraAkari
NemotoNagi
OkumuraNonoka
ShigematsuYuka
SuyamaEmiri
TsurumiMoe
OtsukaMiyu
YamatoAo
);
sub new {
my $class = shift;
my $self = bless {members => []}, $class;
$self->_initialize;
return $self;
}
sub members {
my ($self, $type, @members) = @_;
@members = @{$self->{members}} unless @members;
return @members unless $type;
}
sub sort {
my ($self, $type, $order, @members) = @_;
@members = $self->members unless @members;
# order by desc if $order is true
if ($order) {
return sort {$b->$type <=> $a->$type} @members;
}
else {
return sort {$a->$type <=> $b->$type} @members;
}
}
sub select {
my ($self, $type, $number, $operator, @members) = @_;
$self->_die('invalid operator was passed in')
unless grep {$operator eq $_} qw(== >= <= > <);
@members = $self->members unless @members;
my $compare = eval "(sub { \$number $operator \$_[0] })";
return grep { $compare->($_->$type) } @members;
}
sub _initialize {
my $self = shift;
for my $member (@members) {
my $module_name = 'Acme::2zicon::'.$member;
eval qq|require $module_name;|;
push @{$self->{members}}, $module_name->new;
}
return 1;
}
sub _die {
my ($self, $message) = @_;
Carp::croak($message);
}
1;
__END__
=encoding utf-8
=head1 NAME
lib/Acme/2zicon/Base.pm view on Meta::CPAN
family_name_en
nick
birthday
age
blood_type
hometown
introduction
twitter
));
sub new {
my $class = shift;
my $self = bless {}, $class;
$self->_initialize;
return $self;
}
sub _initialize {
my $self = shift;
my %info = $self->info;
$self->{$_} = $info{$_} for keys %info;
$self->{name_ja} = $self->family_name_ja.$self->first_name_ja;
$self->{name_en} = $self->first_name_en.' '.$self->family_name_en;
$self->{age} = $self->_calculate_age;
$self->{introduction} = $self->_introduction($info{introduction});
return 1;
}
sub _calculate_age {
my $self = shift;
my $today = DateTime->today;
if (($today->month - $self->birthday->month) >= 0) {
if (($today->day - $self->birthday->day ) >= 0) {
return $today->year - $self->birthday->year;
} else {
return ($today->year - $self->birthday->year) - 1;
}
} else {
return ($today->year - $self->birthday->year) - 1;
}
}
sub _datetime_from_date {
my ($self, $date) = @_;
my ($year, $month, $day) = ($date =~ /(\d{4})\.(\d{2})\.(\d{2})/);
DateTime->new(
year => $year,
month => $month,
day => $day,
);
}
sub _introduction {
my ($self, $introduction) = @_;
$introduction =~ s/\[(\w+)\]/$self->{$1}/g;
return $introduction;
}
1;
__END__
=head1 NAME
lib/Acme/2zicon/MatobaKarin.pm view on Meta::CPAN
package Acme::2zicon::MatobaKarin;
use strict;
use warnings;
use base qw(Acme::2zicon::Base);
our $VERSION = '0.7';
sub info {
my $self = shift;
return (
first_name_ja => 'è¯é´',
family_name_ja => 'çå ´',
first_name_en => 'Karin',
family_name_en => 'Matoba',
nick => [qw(ããã ããããã¾)],
birthday => $self->_datetime_from_date('2000.12.30'),
blood_type => 'A',
hometown => 'å¼çç',
lib/Acme/2zicon/NakamuraAkari.pm view on Meta::CPAN
package Acme::2zicon::NakamuraAkari;
use strict;
use warnings;
use base qw(Acme::2zicon::Base);
our $VERSION = '0.7';
sub info {
my $self = shift;
return (
first_name_ja => 'æ±é',
family_name_ja => 'ä¸æ',
first_name_en => 'Akari',
family_name_en => 'Nakamura',
nick => [qw(ãããã)],
birthday => $self->_datetime_from_date('1998.01.30'),
blood_type => 'B',
hometown => 'åèç',
lib/Acme/2zicon/NemotoNagi.pm view on Meta::CPAN
package Acme::2zicon::NemotoNagi;
use strict;
use warnings;
use base qw(Acme::2zicon::Base);
our $VERSION = '0.7';
sub info {
my $self = shift;
return (
first_name_ja => 'åª',
family_name_ja => 'æ ¹æ¬',
first_name_en => 'Nagi',
family_name_en => 'Nemoto',
nick => [qw(ãã)],
birthday => $self->_datetime_from_date('1999.03.15'),
blood_type => 'B',
hometown => 'è¨åç',
lib/Acme/2zicon/OkumuraNonoka.pm view on Meta::CPAN
package Acme::2zicon::OkumuraNonoka;
use strict;
use warnings;
use base qw(Acme::2zicon::Base);
our $VERSION = '0.7';
sub info {
my $self = shift;
return (
first_name_ja => 'éä¹è±',
family_name_ja => '奥æ',
first_name_en => 'Nonoka',
family_name_en => 'Okumura',
nick => [qw(ã®ã®ã)],
birthday => $self->_datetime_from_date('2001.01.04'),
blood_type => 'O',
hometown => 'æ±äº¬é½',
lib/Acme/2zicon/OtsukaMiyu.pm view on Meta::CPAN
package Acme::2zicon::OtsukaMiyu;
use strict;
use warnings;
use base qw(Acme::2zicon::Base);
our $VERSION = '0.7';
sub info {
my $self = shift;
return (
first_name_ja => 'æç±',
family_name_ja => '大å¡',
first_name_en => 'Miyu',
family_name_en => 'Otsuka',
nick => [qw(ãã¦ãã¦)],
birthday => $self->_datetime_from_date('2000.12.20'),
blood_type => 'O',
hometown => 'ãã¤ã',
lib/Acme/2zicon/ShigematsuYuka.pm view on Meta::CPAN
package Acme::2zicon::ShigematsuYuka;
use strict;
use warnings;
use base qw(Acme::2zicon::Base);
our $VERSION = '0.7';
sub info {
my $self = shift;
return (
first_name_ja => 'ä½ä½³',
family_name_ja => 'éæ¾',
first_name_en => 'Yuka',
family_name_en => 'Shigematsu',
nick => [qw(ããã¡ã¼)],
birthday => $self->_datetime_from_date('1996.05.20'),
blood_type => 'B',
hometown => 'ç¦å²¡ç',
lib/Acme/2zicon/SuyamaEmiri.pm view on Meta::CPAN
package Acme::2zicon::SuyamaEmiri;
use strict;
use warnings;
use base qw(Acme::2zicon::Base);
our $VERSION = '0.7';
sub info {
my $self = shift;
return (
first_name_ja => 'æµå®é',
family_name_ja => 'é¶å±±',
first_name_en => 'Emiri',
family_name_en => 'Suyama',
nick => [qw(ãã¿ãã)],
birthday => $self->_datetime_from_date('1999.05.26'),
blood_type => 'O',
hometown => 'æ±äº¬é½',
lib/Acme/2zicon/TsurumiMoe.pm view on Meta::CPAN
package Acme::2zicon::TsurumiMoe;
use strict;
use warnings;
use base qw(Acme::2zicon::Base);
our $VERSION = '0.7';
sub info {
my $self = shift;
return (
first_name_ja => 'è',
family_name_ja => '鶴è¦',
first_name_en => 'Moe',
family_name_en => 'Tsurumi',
nick => [qw(ãã)],
birthday => $self->_datetime_from_date('1996.12.05'),
blood_type => 'A',
hometown => 'æ±äº¬é½',
lib/Acme/2zicon/YamatoAo.pm view on Meta::CPAN
package Acme::2zicon::YamatoAo;
use strict;
use warnings;
use base qw(Acme::2zicon::Base);
our $VERSION = '0.7';
sub info {
my $self = shift;
return (
first_name_ja => 'ææ¡',
family_name_ja => '大å',
first_name_en => 'Ao',
family_name_en => 'Yamato',
nick => [qw(ããã¡ãã)],
birthday => $self->_datetime_from_date('2002.05.23'),
blood_type => 'B',
hometown => 'æ±äº¬é½',
view all matches for this distributionview release on metacpan - search on metacpan