### ### Copyright 2000-2007 University of Illinois Board of Trustees ### All rights reserved. ### ### NameServiceSwitch.pm - Name Service Switch control module for psgconf ### ### Campus Information Technologies and Educational Services ### University of Illinois at Urbana-Champaign ### package PSGConf::Control::NameServiceSwitch; use strict; use PSGConf::Action::GenerateFile::nsswitch_conf; use PSGConf::Data::String; use PSGConf::Data::Hash; ############################################################################### ### constructor ############################################################################### sub new { my ($class, $psgconf) = @_; my ($self); $self = {}; bless($self, $class); $self->{name} = 'name_service'; $psgconf->register_data( name_service_conf_path => PSGConf::Data::String->new( 'value_abspath' => 1, value => '/etc/nsswitch.conf' ), name_service_switch => PSGConf::Data::Hash->new( value_type => 'ARRAY' ), name_service_delimiter => PSGConf::Data::String->new( value => ":\t" ), name_service_seperator => PSGConf::Data::String->new( value => ' ' ), ); return $self; } ############################################################################### ### decide() method ############################################################################### sub decide { my ($self, $psgconf) = @_; return if (! $psgconf->data_obj('name_service_switch')->count()); $psgconf->register_actions( PSGConf::Action::GenerateFile::nsswitch_conf->new( name => $psgconf->data_obj('name_service_conf_path')->get(), description => 'name service switch config file', name_service_switch => $psgconf->data_obj('name_service_switch')->get(), name_service_delimiter => $psgconf->data_obj('name_service_delimiter')->get(), name_service_seperator => $psgconf->data_obj('name_service_seperator')->get() ) ); } ############################################################################### ### documentation ############################################################################### 1; __END__ =head1 NAME PSGConf::Control::NameServiceSwitch - psgconf control class for nsswitch config =head1 SYNOPSIS In F: Control PSGConf::Control::NameServiceSwitch =head1 DESCRIPTION The B module provides a B control object for configuring name service lookups. It supports the following methods: =over 4 =item new() The constructor. Its parameter is a reference to the B object. It registers the following data objects: =over 4 =item I A B object containing information on which name services to use for each type. The hash key is the type of name service. The value is an array containing the ordered list of services to use for that type of name service. =item I A B object that contains the name of the file of the name service switch config file. It defaults to F. =item I The character used to seperate the name service from the services to use. Defaults to ":\t". =item I The character used to seperate the names of the services to use. Defaults to ' '. =back =item decide() If I is set, instantiates and registers a B object to create F. =back =head1 SEE ALSO L nsswitch.conf(5) L L L L L =cut