###
### Copyright 2000-2007 University of Illinois Board of Trustees
### All rights reserved.
###
### PSGConf::Action::GenerateFile::netmasks - action to generate /etc/netmasks
###
### Campus Information Technologies and Educational Services
### University of Illinois at Urbana-Champaign
###
package PSGConf::Action::GenerateFile::netmasks;
use strict;
use PSGConf::Action::GenerateFile;
our @ISA = qw(PSGConf::Action::GenerateFile);
###############################################################################
### generate method
###############################################################################
sub generate
{
my ($self, $fh, $psgconf) = @_;
map {
print $fh "$_\t";
if (ref($self->{networks}->{$_}) eq 'HASH')
{
print $fh "$self->{networks}->{$_}->{mask}\t"
. "# $self->{networks}->{$_}->{comment}\n";
}
else
{
print $fh "$self->{networks}->{$_}\n";
}
} sort keys (%{$self->{networks}});
return 1;
}
###############################################################################
### documentation
###############################################################################
1;
__END__
=head1 NAME
PSGConf::Action::GenerateFile::netmasks - generate /etc/netmasks file
=head1 SYNOPSIS
use PSGConf::Action::GenerateFile::netmasks;
$psgconf->register_actions(
PSGConf::Action::GenerateFile::netmasks->new(
'name' => '/etc/netmasks',
'networks' => { ... },
...
),
...
);
=head1 DESCRIPTION
The B<PSGConf::Action::GenerateFile::netmasks> module provides a B<PSGConf>
action class for generating the Solaris F</etc/netmasks> file.
The B<PSGConf::Action::GenerateFile::netmasks> class is derived from the
B<PSGConf::Action::GenerateFile> class, but it defines/overrides the
following methods:
=over 4
=item generate()
Generates the F</etc/netmasks> file.
=back
In addition to the attributes supported by
the B<PSGConf::Action::GenerateFile> class, the
B<PSGConf::Action::GenerateFile::netmasks> class supports the following
attributes:
=over 4
=item I<networks>
A hash containing the networks for which entries should be added. The
key is the network address. The value can be either a scalar, in which
case it is assumed to be the netmask for the network, or a reference to
a hash, in which case the sub-hash should contain the fields I<mask>,
which is the netmask, and I<comment>, which is a one-line comment for
the entry.
=back
=head1 SEE ALSO
L<perl>
L<PSGConf>
L<PSGConf::Action::GenerateFile>
=cut
syntax highlighted by Code2HTML, v. 0.9.1