CodeSOD: Join or Die

This post was originally published on this site

The Daily WTF

Seuf sends us some old code, which entered production in 2011. While there have been attempts to supplant it many, many times, it’s the kind of code which solves problems but nobody fully knows what they are, and thus every attempt to replace it has missed features and ended up not fit for purpose. That the tool is unmaintainable, buggy, and slow? Well, so it goes.

Today’s snippet is Perl:

my $query = “SELECT id FROM admin_networks WHERE id=’8′ or id=’13’ or id=’14’ or id=’16’ or id=’22’ or id=’26’ or id=’27’ or id=’23’ or id=’40’ or id=’39’ or id=’33’ or id=’31′”; my $sth = $dbh->prepare($query); $sth->execute or die “Error : $DBI::errstrn”; while(my $id_network=$sth->fetchrow_array()){ my $query2 = “SELECT name FROM admin_routeurs where networkid=’$id_network'”; my $sth2 = $dbh->prepare($query2); $sth2->execute or die “Error : $DBI::errstrn”; while(my $name=$sth2->fetchrow_array()){ print LOG “name : $namen”; print FACTION “$namen”; } }

Now, I have to be

To read the full article click on the 'post' link at the top.