### ### Copyright 2000-2007 University of Illinois Board of Trustees ### All rights reserved. ### ### PSGConf::Action::GenerateFile::hosts - action to generate /etc/hosts ### ### Campus Information Technologies and Educational Services ### University of Illinois at Urbana-Champaign ### package PSGConf::Action::GenerateFile::hosts; use strict; use PSGConf::Action::GenerateFile; our @ISA = qw(PSGConf::Action::GenerateFile); ############################################################################### ### generate method ############################################################################### sub generate { my ($self, $fh, $psgconf) = @_; map { print $fh "$_\t"; print $fh join("\t", @{$self->{ip_addrs}->{$_}}); print $fh "\n"; } sort keys %{$self->{ip_addrs}}; return 1; } ############################################################################### ### documentation ############################################################################### 1; __END__ =head1 NAME PSGConf::Action::GenerateFile::hosts - generate /etc/hosts file =head1 SYNOPSIS use PSGConf::Action::GenerateFile::hosts; $psgconf->register_actions( PSGConf::Action::GenerateFile::hosts->new( 'name' => '/etc/hosts', 'ip_addrs' => { 'A.B.C.D' => [ ... ], ... }, ... ), ... ); =head1 DESCRIPTION The B module provides a B action class for generating the F table. The B class is derived from the B class, but it defines/overrides the following methods: =over 4 =item generate() Generates the F table. =back In addition to the attributes supported by the B class, the B class supports the following attributes: =over 4 =item I A hash mapping IP addresses to a list of host names. =back =head1 SEE ALSO L L L =cut