Permalink
Browse files

Make sure data_name is alphanum only (foo.contains -> foo_contains)

  • Loading branch information...
1 parent 3603027 commit 28045d0c1750d0f91ec7f7ee9bd4a511aaaeda50 Steven Haryanto (on PC) committed Nov 7, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/Dist/Zilla/Plugin/Rinci/Validate.pm
@@ -121,10 +121,11 @@ sub munge_file {
my $gen_arg = sub {
my $meta = $metas->{$sub_name};
+ my $dn = $arg; $dn =~ s/\W+/_/g;
my $cd = $plc->compile(
schema => $meta->{args}{$arg}{schema},
err_term => '$arg_err',
- data_name => $arg,
+ data_name => $dn,
data_term => $var,
return_type => 'str',
comment => 0,
@@ -154,10 +155,11 @@ sub munge_file {
}
my $s = $meta->{args}{$arg}{schema};
if ($s) {
+ my $dn = $arg; $dn =~ s/\W+/_/g;
my $cd = $plc->compile(
schema => $s,
err_term => '$arg_err',
- data_name => $arg,
+ data_name => $dn,
data_term => $kvar,
return_type => 'str',
comment => 0,

0 comments on commit 28045d0

Please sign in to comment.