Acme-Hidek

 view release on metacpan or  search on metacpan

lib/Acme/Hidek.pm  view on Meta::CPAN

package Acme::Hidek;

use 5.008_001;
use utf8;
use Mouse;
use Time::Piece;
use Time::HiRes qw(sleep);

if ($^O eq 'MSWin32') {
   require 'Win32/Console/ANSI.pm';
   binmode STDOUT, ":raw :encoding(cp932)";
}
elsif($ENV{CONSOLE_ENCODING}) {
    binmode STDOUT, ":raw :encoding($ENV{CONSOLE_ENCODING})";
}

our $VERSION = '44.0';

use XSLoader;
XSLoader::load(__PACKAGE__, $VERSION);

use constant {
    BIRTH_YEAR  => 1970,
    BIRTH_MONTH => 9,
    BIRTH_DAY   => 2,
};

has agef => (
    is      => 'ro',
    isa     => 'Num',
    lazy    => 1,
    default => sub {
        my($self) = @_;
        return +(Time::Piece->localtime - $self->birthdate)->years;
    },
);

has age => (
    is      => 'ro',
    isa     => 'Int',
    lazy    => 1,
    default => sub {
        my($self) = @_;
        return int( $self->agef );
    },
);

has birthdate => (
    is       => 'ro',
    isa      => 'Object',
    lazy     => 1,
    default  => sub { Time::Piece->strptime("1970/9/2", "%Y/%m/%d") },
    init_arg => undef,
);

sub is_birthday {
    my $now = Time::Piece->new;
    return $now->mday == BIRTH_DAY && $now->mon == BIRTH_MONTH;
}

sub ossan40 {
    my @aa = (
        <<'OPPAI'
    _  ∩
  ( ゜∀゜)彡 ${WORD}
  (    | 
   |   | 
   し ⌒J

 contributed by @mattn_jp.
OPPAI
        , <<'OPPAI'
    _  ∩
  ( ゜∀゜)彡 ${WORD}
  (  ⊂彡
   |   | 
   し ⌒J

 contributed by @mattn_jp.
OPPAI
        , <<'OPPAI'
    _  
  ( ゜∀゜)  ${WORD}
  (  ⊂彡
   |   | 
   し ⌒J

 contributed by @mattn_jp.
OPPAI
    );

    my $a;
    for (1..5) {
        $a = $aa[0]; $a =~ s!\${WORD}!おっ!!;
        print "\e[2J$a"; sleep 0.1;
        $a = $aa[1]; $a =~ s!\${WORD}!おっ!!;
        print "\e[2J$a"; sleep 0.1;
        $a = $aa[2]; $a =~ s!\${WORD}!おっ!!;
        print "\e[2J$a"; sleep 0.5;

        $a = $aa[2]; $a =~ s!\${WORD}!おっさん!!;
        print "\e[2J$a"; sleep 0.1;
        $a = $aa[1]; $a =~ s!\${WORD}!おっさん!!;
        print "\e[2J$a"; sleep 0.1;
        $a = $aa[0]; $a =~ s!\${WORD}!おっさん!!;
        print "\e[2J$a"; sleep 0.5;
    }
}

sub ossan41 {
    my @aa = (
        <<'OPPAI'



( run in 0.524 second using v1.01-cache-2.11-cpan-437f7b0c052 )