-
-
Save ktat/2ef7f2610576a917c06f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use base qw/Qudo::Worker/; | |
sub import{ | |
my $class = shift; | |
if($class->split_process_from_initial_character()){ | |
no strict 'refs'; | |
my $package = $class; | |
*{"$package\::InitialLowerCase::ISA"} = [$package]; | |
*{"$package\::InitialUpperCase::ISA"} = [$package]; | |
*{"$package\::InitialNumber::ISA"} = [$package]; | |
*{"$package\::get_splited_worker_classname"} = sub { | |
my ($class , $args )= @_; | |
my $c = Kuroneco->bootstrap(); | |
my $dao = $c->dao('default'); | |
my $media_id = $args->{media_id}; | |
my $media = $dao->single('media' , {id => $media_id}); | |
my $args_hash = {map{split "=" , $_ }split("&" , $args->{args})}; | |
my $user_id = $args_hash->{$media->user_id_column_name}; | |
my $initial_uesr_id = substr($user_id , 0 , 1); | |
if($initial_uesr_id =~ /[0-9]/){ | |
return "$package\::InitialNumber"; | |
}elsif($initial_uesr_id =~ /[a-z]/){ | |
return "$package\::InitialLowerCase"; | |
}elsif($initial_uesr_id =~ /[A-Z]/){ | |
return "$package\::InitialUpperCase"; | |
}{ | |
die; | |
} | |
}; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment