From: Andrew Ruthven Date: Tue, 13 Jan 2009 07:58:13 +0000 (+1300) Subject: Modifications to make NAPTR regex work and Asterisk resources to work. X-Git-Tag: debian-0.2-1~18 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bab67afe5cff623d05040077dd4df26377e69ab9;p=asterisk-agi-enum.git Modifications to make NAPTR regex work and Asterisk resources to work. --- 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 };