via RT wrote:
Show quoted text
Great idea! The Heredoc restriction should be easy to implement, but
the quoted string will be harder to detect. Do you think we should just
flag strings that are too long? Hmm...
In the end, this is true, any string that is too long will disturb the
syntax layout..
it his ok in a method with no (or almost no) other code, like
sub print_help {
Show quoted text# possible an error msg ?
my $err = shift;
print <<"EOT";
foo bar
$err
option
option
....
EOT
That means 2 things to look at:
1) context
allowed in:
- global defination, in package context
- use constant
- Class:DBI like __PACKAGE__->set_sql()
- subroutine with no or limited perl code. (max statements /
complexity <3 / percentage ??? no idea)
maybe just allow as last statement / return value
all other contents are disallowed
definitions can either occur:
- before each sub declaration
- in one single location [ hard to test ]
any violating string or in-here-doc can be identified by pattern match.
.{40} => any strinfg longer than 40
^\s+(select|delete|update) => most common SQL
I don't thing there is a need to but to many patterns into the module.
Users can specify their own patterns in the config, if the need
specific cases. In that case, it could be useful to specify the allowed
context per pattern (and maybe even the wanted occurance)
Ok, that is now truly a big feature request....