Re: [Cascavel-pm] Módulo para utilizar "rules" em Perl5
Nelson Ferraz
nferraz em gmail.com
Quinta Março 16 09:20:07 PST 2006
> Não precisa atribuir a outra variável. Basta que o Regexp execute com
> sucesso...
>
> my $unsafe = $cgi->param( 'from-user' );
> $unsafe =~ m/^\w+$/; # its "safe", now.
Na verdade, e' preciso recuperar o valor da expressao regular:
my ($safe) = $unsafe =~ m/^(\w+)$/;
Ou, como diz a documentacao em perlsec: "Sometimes you have just to
clear your data's taintedness. Values may be untainted by using them
as keys in a hash; otherwise the only way to bypass the tainting
mechanism is by referencing subpatterns from a regular expression
match. Perl presumes that if you reference a substring using $1, $2,
etc., that you knew what you were doing when you wrote the pattern."
http://perldoc.perl.org/perlsec.html
Mais detalhes sobre a lista de discussão Cascavel-pm