[ic] Allow hyphens in CodeDef patch

Richard Templet richard at endpoint.com
Thu Jul 2 22:02:24 UTC 2009


I ran across an issue where I wanted to use a hyphen in an ActionMap for SEO reasons but couldn't do it as long as my ActionMap used a CodeDef to define the routine to call.  If I inlined the code in the ActionMap it worked just fine.  What I found was that any name after CodeDef had the hyphens converted to underscores and then checked to make sure it  didn't have any non-word characters in it.  In knowing how nice hyphens are for SEO reasons and how nice it is to have your ActionMap routines in perl modules for syntax checking etc, I figured it would be handy to change it so that just hyphen, underscore and non-word characters were allowed.

To test this change I created both ActionMaps and Filters named test-123 and test_123 tested them using ITL, [perl] ,[calc] and inside a global perl module and didn't have any issues with errors or loss of functionality.



--- a/interchange/lib/Vend/Config.pm
+++ b/interchange/lib/Vend/Config.pm
@@ -4936,8 +4936,7 @@ sub parse_mapped_code {
        # Canonicalize
        $p = $tagCanon{lc $p} || ''
                or ::logDebug("bizarre mapped code line '$value'");
-       $tag =~ tr/-/_/;
-       $tag =~ s/\W//g
+       $tag =~ s/[^-_\w]+//g
                and config_warn("Bad characters removed from '%s'.", $tag);

        my $repos = $C ? ($C->{CodeDef} ||= {}) : ($Global::CodeDef ||= {});

-- 

Richard Templet
End Point Corp.
(919) 300-7303




More information about the interchange-users mailing list