Device-Network-ConfigParser
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/Device/Network/ConfigParser/Linux/NetUtils.pm view on Meta::CPAN
package Device::Network::ConfigParser::Linux::NetUtils;
# ABSTRACT: Parse the output from net-utils utilities (ifconfig, route, arp, etc)
our $VERSION = '0.006'; # VERSION
use 5.006;
use strict;
use warnings;
use Modern::Perl;
use Parse::RecDescent;
use Data::Dumper;
use JSON;
use Exporter qw{import};
our @EXPORT_OK = qw{get_parser get_output_drivers parse_config post_process};
=head1 NAME
Device::Network::ConfigParser::CheckPoint::Expert - parse CheckPoint expert mode output.
=head1 VERSION
version 0.006
=head1 SYNOPSIS
This module is intended to be used in conjunction with L<Device::Network::ConfigParser>, however there's nothing stopping it being used on its own.
The module provides subroutines to parse & post-process the output from net-tools utilities such as ifconfig, route, arp, etc.
=head1 SUBROUTINES
=head2 get_parser
For more information on the subroutine, see L<Device::Network::ConfigParser/"get_parser">.
Thos module currently recognises output from the following utilities:
=over 4
=item * 'ifconfig' output
=back
=cut
sub get_parser {
return new Parse::RecDescent(q{
<autoaction: { [@item] }>
startrule: config_line(s) { $item[1] }
config_line:
ifconfig(s) { { ifconfig => $item{'ifconfig(s)'} } } |
not_parsed { $item[1] }
ifconfig:
interface encap hw_addr(?) inet(?) inet6(s?) flag(s) mtu if_metric rx_stats tx_stats rx_bytes tx_bytes {
{
interface => $item{interface},
encapsulation => $item{encap},
hw_addr => $item{'hw_addr(?)'},
inet => $item{'inet(?)'},
inet6 => $item{'inet6(s?)'},
flags => $item{'flag(s)'},
mtu => $item{mtu},
metric => $item{if_metric},
rx_stats => $item{rx_stats},
tx_stats => $item{tx_stats},
rx_bytes => $item{rx_bytes},
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.511 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )