diff options
| author | fukachan <fukachan> | 2001-01-28 13:08:15 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-01-28 13:08:15 +0000 |
| commit | 653d890ecebb2827e05836fc50f75678c01bac93 (patch) | |
| tree | 2be0e74cc27eaa2e26b547e348e18561495792db /fml/lib/IO/MapAdapter.pm | |
| parent | b9397db8eec7bf2f61cb3974dd1fb39dbc31a2f4 (diff) | |
| download | fml8-653d890ecebb2827e05836fc50f75678c01bac93.tar.gz fml8-653d890ecebb2827e05836fc50f75678c01bac93.tar.bz2 fml8-653d890ecebb2827e05836fc50f75678c01bac93.zip | |
move initialization codes on NIS and etc/group to each subclass
Diffstat (limited to 'fml/lib/IO/MapAdapter.pm')
| -rw-r--r-- | fml/lib/IO/MapAdapter.pm | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/fml/lib/IO/MapAdapter.pm b/fml/lib/IO/MapAdapter.pm index d5dcc40c..63fdc553 100644 --- a/fml/lib/IO/MapAdapter.pm +++ b/fml/lib/IO/MapAdapter.pm @@ -103,30 +103,19 @@ sub new } else { if ($map =~ /file:(\S+)/ || $map =~ m@^(/\S+)@) { - $pkg = 'IO::Adapter::File'; $me->{_file} = $1; $me->{_type} = 'file'; + $pkg = 'IO::Adapter::File'; } elsif ($map =~ /unix\.group:(\S+)/) { - $pkg = 'IO::Adapter::Array'; $me->{_name} = $1; $me->{_type} = 'unix.group'; - - # emulate an array on memory - my (@x) = getgrnam( $me->{_name} ); - my (@members) = split ' ', $x[3]; - $me->{_array_reference} = \@members; + $pkg = 'IO::Adapter::UnixGroup'; } elsif ($map =~ /nis\.group:(\S+)/) { - my $key = $1; - $pkg = 'IO::Adapter::Array'; - $me->{_name} = $key; + $me->{_name} = $1; $me->{_type} = 'nis.group'; - - # emulate an array on memory - my (@x) = `ypmatch $key group.byname`; - my (@members) = split ',', $x[3]; - $me->{_array_reference} = \@members; + $pkg = 'IO::Adapter::NIS'; } elsif ($map =~ /(ldap|mysql|postgresql):(\S+)/) { $me->{_type} = $1; @@ -135,13 +124,13 @@ sub new } else { my $s = "IO::MapAdapter::new: args='$map' is unknown."; - print STDERR $s, "\n"; _error_reason($me, $s); } } unshift(@ISA, $pkg); eval qq{ require $pkg; $pkg->import();}; + $pkg->configure($me) if $pkg->can('configure'); _error_reason($me, $@) if $@; return bless $me, $type; |
