The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::ACL::File - Access-lists constructed from configuration file like syntax.

SYNOPSIS

    use Net::ACL::File;

    # Construction
    $config = 'ip community-list 4 permit 65001:1¨;
    $list_hr = load Net::ACL::File($config);

    Net::ACL::File->add_knownlist('community-list', __PACKAGE__,'ip community-list');

    $list = renew Net::ACL(Type => 'community-list', Name => 4);
    $config2 = $list->asconfig; # $config2 =~ /$config/;

DESCRIPTION

This module extends the Net::ACL class with a load constructor that loads one or more objects from a cisco-like configuration file using Cisco::Reconfig.

CONSTRUCTOR

    $list_hr = load Net::ACL::File($config);

This special constructor parses a cisco-like router configuration.

The constructor takes one argument which should either be a string or a Cisco::Reconfig object.

It returns a hash reference. The hash is indexed on list-types. Currently supporting the following:

community-list, as-path-list, prefix-list, access-list

Each list-type hash value conains a new hash reference indexed on list names or numbers.

CLASS METHODS

add_knownlist()

The add_knownlist class method registers a new class of access-lists.

The first argument is the type-string of the new class. The second argument is the class to be registered. The class should be a sub-class of Net::BGP::File::Standard. Normaly this should be '__PACKAGE__'.

The third argument is used to match the lines in the configuration file using Cisco::Reconfig's all(REGEXP) method. If match argument is not defined, the type string will be used.

The forth argument is used to load the class with a "use" statement. This should only be needed if the class is located in a different package. Default is the class name from the second argument.

ACCESSOR METHODS

asconfig()

This function tries to generate a configuration matching the one the load constructer got. It can read from any access-list. The resulting configuration is returned as a string.

All ACL's which rules supports the asconfig method may be used. To do so, use:

        $conf = Net::ACL::File->asconfig($acl);

SEE ALSO

Net::ACL, Cisco::Reconfig, Net::ACL::File

AUTHOR

Martin Lorensen <bgp@martin.lorensen.dk>

1 POD Error

The following errors were encountered while parsing the POD:

Around line 109:

Non-ASCII character seen before =encoding in '65001:1¨;'. Assuming CP1252