3 =head1 NAME $RCSfile: Machines.pm,v $
5 Abstraction of machines.
13 Andrew DeFaria <Andrew@ClearSCM.com>
21 Tue Jan 8 17:24:16 MST 2008
25 $Date: 2011/11/16 19:46:13 $
31 This module handles the details of providing information about
32 machines while obscuring the mechanism for storing such information.
34 my $machines = Machines->new;
36 foreach ($machine->all) {
38 display "Machine: $machine{name}";
39 disp.ay "Owner: $machine{owner}"
44 This module provides information about machines
48 The following routines are exported:
68 my ($class, %parms) = @_;
74 Construct a new Machines object. The following OO style arguments are
79 =for html <blockquote>
85 Name of an alternate file from which to read machine information. This
86 is intended as a quick alternative.
90 =for html </blockquote>
94 =for html <blockquote>
102 =for html </blockquote>
106 my $file = $parms{file} ? $parms{file} : "$FindBin::Bin/../etc/machines";
108 error "Unable to find $file", 1 if ! -f $file;
112 foreach (ReadFile $file) {
115 # Skip commented out or blank lines
116 next if $parts[0] =~ /^#/ or $parts[0] =~ /^$/;
118 $machines{$parts[0]} = $parts[1];
122 file => $parms {file},
123 machines => \%machines,
136 Returns all known machines as an array of hashes
140 =for html <blockquote>
148 =for html </blockquote>
160 =item Array of machine hash records
164 =for html </blockquote>
168 return %{$self->{machines}};
175 =head1 CONFIGURATION AND ENVIRONMENT
177 MACHINES: If set then points to a flat file containing machine
178 names. Note this is providied as a way to quickly use an alternate
179 "machine database". As such only minimal information is support.
186 =head1 INCOMPATABILITIES
190 =head1 BUGS AND LIMITATIONS
192 There are no known bugs in this module.
194 Please report problems to Andrew DeFaria <Andrew@ClearSCM.com>.
196 =head1 LICENSE AND COPYRIGHT
198 This Perl Module is freely available; you can redistribute it and/or
199 modify it under the terms of the GNU General Public License as
200 published by the Free Software Foundation; either version 2 of the
201 License, or (at your option) any later version.
203 This Perl Module is distributed in the hope that it will be useful,
204 but WITHOUT ANY WARRANTY; without even the implied warranty of
205 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
206 General Public License (L<http://www.gnu.org/copyleft/gpl.html>) for more
209 You should have received a copy of the GNU General Public License
210 along with this Perl Module; if not, write to the Free Software Foundation,
211 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.