comparison Lib/IMPL/Web/Application/Action.pm @ 144:b56ebc31bf18

Empty nodes no more created while transforming a post request to the DOM document minor speed improvements to the object CTOR caching Added support for a secure processing (and 'laundering' ) a CGI parameters Many minor fixes
author wizard
date Tue, 13 Jul 2010 02:05:38 +0400
parents 9f5795a10939
children 60fd224f3e3c
comparison
equal deleted inserted replaced
143:d9dd3500ead3 144:b56ebc31bf18
77 } 77 }
78 } else { 78 } else {
79 die new IMPL::InvalidArgumentException("An invalid handler supplied",$handler); 79 die new IMPL::InvalidArgumentException("An invalid handler supplied",$handler);
80 } 80 }
81 81
82 }
83
84 sub cookie {
85 my ($this,$name,$rx) = @_;
86
87 $this->_launder( $this->query->cookie($name), $rx );
88 }
89
90 sub param {
91 my ($this,$name,$rx) = @_;
92
93 $this->_launder( $this->query->param($name), $rx );
94 }
95
96 sub _launder {
97 my ($this,$value,$rx) = @_;
98
99 if ( $value ) {
100 if ($rx) {
101 if ( my @result = ($value =~ m/$rx/) ) {
102 return @result > 1 ? \@result : \@result;
103 } else {
104 return undef;
105 }
106 } else {
107 return $value;
108 }
109 } else {
110 return undef;
111 }
82 } 112 }
83 113
84 1; 114 1;
85 115
86 __END__ 116 __END__