[ic] Allow hyphens in CodeDef patch
Gert van der Spoel
gert at 3edge.com
Fri Jul 3 07:14:59 UTC 2009
> -----Original Message-----
> From: interchange-users-bounces at icdevgroup.org [mailto:interchange-
> users-bounces at icdevgroup.org] On Behalf Of Richard Templet
> Sent: Friday, July 03, 2009 1:02 AM
> To: interchange-users at icdevgroup.org
> Subject: [ic] Allow hyphens in CodeDef patch
>
> 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 ||=
> {});
Hi Richard,
Thanks for the patch. As we'd like some more people to have a look at it and
test it we have for now created a ticket in RT for it to track this patch:
http://rt.icdevgroup.org/Ticket/Display.html?id=290
As _ is already part of \w the following should probably suffice:
+ $tag =~ s/[^-\w]+//g
CU,
Gert
More information about the interchange-users
mailing list