Re: need help with a cart I inherited, need to increase number oftotal characters allowed

Re: need help with a cart I inherited, need to increase number oftotal characters allowed

am 22.10.2007 08:13:16 von Uri Guttman

this is wrong on so many levels i can't even count that high with 64 bit
ints. first off it is perl4 code which is deader than W's
brane. secondly it is VERY BAD CODE.

and also pasting the entire program (2k+ lines) here is dumber than
hell. you really think someone will wade through that fugly mess and add
a feature for free?? read the group guidelines which are posted
regularly.

even if you offered to pay a large sum of money (and anything less than
5 digits is not worth even acknowledging), no one in their right mind
would tackle that. if you are making money from this then you will need
to sign over your revenue stream for several years to get someone to
hack this mess.

and wtf does your subject even mean?? what are characters in a shopping
cart? this is such a wonderful posting for so many fun reasons. i will
use its code for years of training in how not to code in perl. i hope it
is copyrighted or something so i am stealing it too. it will be fun to
be sued over this pile of crap.

this is my favorite sub i found from a very quick scan (i did it for the
giggles :).

# SUBROUTINE number check #
# *********************** #
sub not_a_number {
local($thisnum) = @_;
local($len, $lenchk);
$thisnum =~ tr/$//d;
$thisnum =~ tr/.//d;
$thisnum =~ tr/,//d;
$len = length $thisnum;
$thisnum =~ tr/a-z//d; $thisnum =~ tr/A-Z//d;
$thisnum =~ tr/\-//d; $thisnum =~ tr/\=//d; $thisnum =~ tr/\\//d;
$thisnum =~ tr/-//d;
$thisnum =~ tr/\[//d; $thisnum =~ tr/\]//d; $thisnum =~ tr/;//d;
$thisnum =~ tr/'//d;
$thisnum =~ tr/\///d;
$lenchk = length $thisnum;

if ( $len ne $lenchk ) {
return(1);
}
return(0);
}

that is some of the worst perl code (or any lang code) i have ever
seen. the algorithm is hysterical and the implementation even dumber. it
doesn't even check for all sorts of other characters! the final
comparison even uses the wrong op.

i should make up a lightning talk on the worst perl code i have
seen. this is the lead item (or the last one as it can't be beat!)

uri

--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org