Parse::CPinfo - Perl extension to parse output from cpinfo
use Parse::CPinfo; my $p = Parse::CPinfo->new(); $p->readfile('cpinfofile'); # print the section containing the fwm version string print $p->getSection('FireWall-1 Management (fwm) Version Information'); # Get a list of interfaces my @l = $p->getInterfaceList(); foreach my $int(@l) { print "Interface $int\n"; print "IP Address: " . $int->{'inetaddr'} . "\n"; }
This module parses the output from cpinfo. cpinfo is a utility provided by Check Point Software, used for diagnostic purposes.
The following are the object methods:
Create a new parser object like this: my $p = Parse::CPinfo->new();
After creating the parser object, ask it to read the cpinfo file for you: $parser->readfile('/full/path/to/cpinfofile');
Use this method to get a list of valid sections. Returns an array.
Use this method to get a section of the cpinfo file. Returns a scalar.
Use this method to get the hostname of the server. Returns a scalar.
Use this method to get a list of the active interfaces. Returns an array.
Use this method to get information about a specific interface. Takes a scalar (interface name) and returns a hash.
Check Point Software Technologies, Ltd., at http://www.checkpoint.com/
Matthew M. Lange, <mmlange@cpan.org>
This library hasn't been extensively tested. I'm sure there are bugs in the code. Please file a bug report at http://rt.cpan.org/ if you find a bug.
Copyright (C) 2007 by Matthew M. Lange
This library is released under the GNU Public License.
To install Parse::CPinfo, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Parse::CPinfo
CPAN shell
perl -MCPAN -e shell install Parse::CPinfo
For more information on module installation, please visit the detailed CPAN module installation guide.