[Chicago-talk] canonical is_tainted()?
Mike Fragassi
frag at ripco.com
Wed Aug 4 11:06:07 CDT 2004
On Wed, 4 Aug 2004, Jim Thomason wrote:
> Looks like somebody decided to whip up a one liner. It's the same code.
>
> The one Andy had was (roughly):
>
> sub is_tainted {
> my $value = shift;
> my $substr = substr($value, 0, 0); #empty, possibly tainted string
> local $@; #don't clobber $@
> eval {eval "# $substr"};
> return 1 if $@;
> }
>
> So I guess it was too deemed too wordy and got crunched down.
Almost the same; the one above only operates on one incoming scalar,
and localizes $@.
> On Wed, 4 Aug 2004 10:21:09 -0500 (CDT), Mike Fragassi <frag at ripco.com> wrote:
> >
> > sub is_tainted {
> > return ! eval { eval("#" . substr(join("", @_), 0, 0)); 1 };
> > }
More information about the Chicago-talk
mailing list