##BEGIN preparse #makes use of experimental code evaluation regexp features in perl my @link_names; $$file =~ s/<%[ ]*link_name[ ]*([^ ]*)[ ]*%>(?{push(@link_names,$1);})/<% link_name $1%>/g; #printStruct(\@link_names); #debugging #now map link names to actual variables my $sql; foreach my $link_name (@link_names){ $link_name=$dbh->quote($link_name); $sql="SELECT template_id FROM template_table where template_name=$link_name"; #print "SQL is $sql \n"; #if success do another regexp find and replace with real url #otherwise replace template tag with HTML code comment indicating error }#end foreach ##END preparse