Commit ddbd9a67 authored by IKEDA Soji's avatar IKEDA Soji
Browse files

Small refactoring.

parent 72bf0603
...@@ -32,6 +32,8 @@ use Sympa::Log; ...@@ -32,6 +32,8 @@ use Sympa::Log;
my $log = Sympa::Log->instance; my $log = Sympa::Log->instance;
# Sympa::Aliases is the proxy class of subclasses.
# The constructor may be overridden by _new() method.
sub new { sub new {
my $class = shift; my $class = shift;
my $type = shift; my $type = shift;
...@@ -44,7 +46,7 @@ sub new { ...@@ -44,7 +46,7 @@ sub new {
# - "External" module is used for full path to program. # - "External" module is used for full path to program.
# - However, "Template" module is used instead of obsoleted program # - However, "Template" module is used instead of obsoleted program
# alias_manager.pl. # alias_manager.pl.
return bless {} => $class if $type eq 'none'; return $class->_new if $type eq 'none';
if ($type eq Sympa::Constants::SBINDIR() . '/alias_manager.pl') { if ($type eq Sympa::Constants::SBINDIR() . '/alias_manager.pl') {
$type = 'Sympa::Aliases::Template'; $type = 'Sympa::Aliases::Template';
...@@ -64,12 +66,19 @@ sub new { ...@@ -64,12 +66,19 @@ sub new {
); );
return undef; return undef;
} }
return bless {%options} => $type; return $type->_new(%options);
} }
return undef; return undef;
} }
sub _new {
my $class = shift;
my %options = @_;
return bless {%options} => $class;
}
sub check {0} sub check {0}
sub add {0} sub add {0}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment