ACL-Regex

 view release on metacpan or  search on metacpan

t/test_acl.pl  view on Meta::CPAN

#!/usr/bin/perl
#use warnings;
use strict;
use lib( "../lib" );
use ACL::Regex;
use Data::Dumper;

my $accept_acl = ACL::Regex->new->
	generate_required( 'required.txt' )->
	parse_acl_from_file( { Filename => "acl.permit.txt" } );

my $reject_acl = ACL::Regex->new->
	generate_required( 'required.txt' )->
	parse_acl_from_file( { Filename => "acl.reject.txt" } );

my @actions;

# Read an action
while( <> ){
	chomp;
	push( @actions, $_ );
}

ACTION: for my $action ( @actions ){
	print "Action: $action\n";
	# Check against the reject
	my ($rc,$regex,$comment) = $reject_acl->match( $action );
	if( $rc ){
		print "\t! Rejected against $regex\n";
		print "\t: Reason: $comment\n";
		next ACTION;
	}
	($rc,$regex,$comment) = $accept_acl->match( $action );
	if( $rc ){
		print "\t* Accepted against $regex\n";
		print "\t: Reason: $comment\n";
		next ACTION;
	}

	print "\t? No ACLs matched\n";

}

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

( run in 1.769 second using v1.00-cache-2.02-grep-82fe00e-cpan-d29e8ade9f55 )