### ### Copyright 2000-2007 University of Illinois Board of Trustees ### All rights reserved. ### ### PSGConf::Action::GenerateFile::printcap - action to generate /etc/printcap ### ### Campus Information Technologies and Educational Services ### University of Illinois at Urbana-Champaign ### package PSGConf::Action::GenerateFile::printcap; use strict; use PSGConf::Action::GenerateFile; our @ISA = qw(PSGConf::Action::GenerateFile); ############################################################################### ### generate method ############################################################################### sub generate { my ($self, $fh, $psgconf) = @_; my ($printers, $printer); $printers = $self->{printers}; foreach $printer (keys %$printers) { print $fh "lp|" if ($self->{default_printer} eq $printer); print $fh "$printer"; print $fh "|$printers->{$printer}->{description}" if (defined($printers->{$printer}->{description})); print $fh ":\\\n\t"; print $fh ":rm=$printers->{$printer}->{remotehost}" if (defined($printers->{$printer}->{remotehost})); if (defined($printers->{$printer}->{remotequeue})) { print $fh ":rp=$printers->{$printer}->{remotequeue}"; } else { print $fh ":rp=$printer"; } print $fh ":sd=$printers->{$printer}->{spooldir}" if (defined($printers->{$printer}->{spooldir})); print $fh ":lf=$printers->{$printer}->{logfile}" if (defined($printers->{$printer}->{logfile})); print $fh ":$printers->{$printer}->{options}" if (defined($printers->{$printer}->{options})); print $fh ":\n"; } return 1; } ############################################################################### ### documentation ############################################################################### 1; __END__ =head1 NAME PSGConf::Action::GenerateFile::printcap - generate /etc/printcap file =head1 SYNOPSIS use PSGConf::Action::GenerateFile::printcap; $psgconf->register_actions( PSGConf::Action::GenerateFile::printcap->new( 'name' => '/etc/printcap', 'default_printer' => 'lp', 'printers' => { '...', }, ... ), ... ); =head1 DESCRIPTION The B module provides a B action class for generating the F file. The B class is derived from the B class, but it defines/overrides the following methods: =over 4 =item generate() Generate the F file. =back In addition to the attributes supported by the B class, the B class supports the following attributes: =over 4 =item I A hash that contains the entries for each printer. The hash key is the name of the print queue, and the hash value is an anonymous hash containing the settings for that print queue. The following settings are supported: =over 4 =item I The name of the host the printer is attached to. =item I The name of the queue on the remote host. =item I A description of the printer. =item I The location to store the intermediate print files before sending to the I. =item I The location to log print request and results. =item I Any other options that are needed for the queue setup. =back =back =head1 SEE ALSO printcap(5) L L L =cut