Device-Network-ConfigParser

 view release on metacpan or  search on metacpan

lib/Device/Network/ConfigParser/Cisco/ASA.pm  view on Meta::CPAN

package Device::Network::ConfigParser::Cisco::ASA;
# ABSTRACT: Parse Cisco ASA Configuration
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::Cisco::ASA - parse Cisco ASA configuration.

=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 Cisco ASA configuration, and output the structured data in a number of formats.

=head1 SUBROUTINES

=head2 get_parser

For more information on the subroutine, see L<Device::Network::ConfigParser/"get_parser">.

This module currently recognised the following parts of Cisco ASA configuration:

=over 4

=item * Hostname and domain name

=item * Name aliases

=item * Routes

=item * Access lists

=item * NATs

=item * Objects

=item * Object groups

Any other lines within the file are classified as 'unrecognised'.

=back

=cut

# This function is used with the (?) RecDescent operator, which returns an ARRAYREF.
# If there's an array member, it's returned.
# If not, the empty string is returned.
sub Parse::RecDescent::_zero_or_one {
    my ($array_ref, $action, $return) = @_;

    $return //= '';
    $action //= sub { return $_[0]->[0] }; # By default, return the first member

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.473 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )