http://www.perlmonks.org?node_id=1003923


in reply to Re: OOP: How to construct multiple instances of a class at once
in thread OOP: How to construct multiple instances of a class at once

Scrubbing for Bobby Tables issues? No, the SQL needs to be written for those issues.

my $sql = 'SELECT user_id, user_name FROM users WHERE user_id IN (' . +join(',', ('?') x @ids) . ')'; #... $sth->execute(@ids);
Especially since perl makes this so trivially easy, as compared to, say, C.

Replies are listed 'Best First'.
Re^3: OOP: How to construct multiple instances of a class at once
by runrig (Abbot) on Nov 15, 2012 at 16:18 UTC
    If the ids were strings, I might use map $dbh->quote($_), @ids, but since they're probably integers, validating that they're /^\d+$/ is probably good enough. Either is also easy.