- my $templ = $self->as_string;
- my @vars = $templ =~ /{(.+?)}/g;
- $templ =~ s/{.+?}/(.+?)/g;
- my @matches = $uri =~ /$templ/;
+ if( !$self->{ deparse_re } ) {
+ my $templ = $self->as_string;
+ $self->{ vars_list } = [ $templ =~ /{(.+?)}/g ];
+ $templ =~ s/{.+?}/(.+?)/g;
+ $self->{ deparse_re } = qr/$templ/;
+ }
+
+ my @matches = $uri =~ $self->{ deparse_re };