From bab67afe5cff623d05040077dd4df26377e69ab9 Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Tue, 13 Jan 2009 20:58:13 +1300 Subject: [PATCH] Modifications to make NAPTR regex work and Asterisk resources to work. --- enum.agi | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/enum.agi b/enum.agi index 92da2eb..a852aa1 100644 --- a/enum.agi +++ b/enum.agi @@ -83,10 +83,12 @@ sub get_resources { $resource = $ARGV[0]; my ( $pattern, $replacement ) = ( split '!', $rr->regexp )[ 1, 2 ]; - print "$pattern, $replacement\n"; - unless ( $resource =~ s/$pattern/$replacement/ ) { - $A->verbose( "Unable to apply regexp to $ARGV[0]", 4 ); - } + $replacement =~ s/\@/\\\@/; + $resource =~ s/^\+//; + $A->verbose( "$pattern, $replacement", 4 ); + my $regexp = "\$resource =~ s/$pattern/$replacement/"; + eval "$regexp"; + $A->verbose( "new resource: $resource", 4 ); $resource =~ s/^(\w+):/\U$1\//; $records{$count} = { preference => $rr->preference, resource => $resource }; -- 2.30.2