TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Facebook Perl source code from 2005

85 pointsby philfreoover 11 years ago

11 comments

mstover 11 years ago
Eeeek. That code would&#x27;ve been terrible practice in 2000 when I first started writing Perl :(<p>The Mysql module was deprecated in favour of the unified DBI interface, cgi-lib.pl was a <i>perl4</i> library that was replaced by a module called CGI (shipped with perl5 itself from 5.4+).<p>Calling functions with &amp; is a perl4-ism and almost always the wrong thing to do in perl5, and C-style for is silly in most cases in Perl - for example; the loops in there would likely be better redone as foreach loops, or possibly just a grep.<p>And, of course, YAY not using placeholders in the SQL.<p><i>sigh</i>
评论 #6650834 未加载
评论 #6650895 未加载
评论 #6653018 未加载
jrockwayover 11 years ago
No wonder they wouldn&#x27;t let me use the username &quot;jrockway&#x2F;..&#x2F;..&#x2F;..&#x2F;..&#x2F;..&#x2F;etc&#x2F;passwd&quot;.
0x0over 11 years ago
Wow, the database connection ip and dbname were taken from http cookies!
philfreoover 11 years ago
This is different code than the 2007 PHP code here: <a href="https://gist.github.com/nikcub/3833406" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;nikcub&#x2F;3833406</a>
评论 #6650345 未加载
general_failureover 11 years ago
What&#x27;s funny is the kind of interview questions they ask at Facebook. They act is if they are rocket scientists creating major breakthrough algorithms.
dkochover 11 years ago
At least they had &quot;use strict&quot; turned on. Not sure why they weren&#x27;t using DBI and placeholders to prevent SQL injection attacks in 2005.
jakejakeover 11 years ago
It&#x27;s surprising to me how &quot;old school&quot; this code is for 2005. It looks similar to Perl code from the late 90&#x27;s when CGI scripts and form mailers were all the rage.
dmazinover 11 years ago
Would someone be so kind as to explain the following:<p><pre><code> sub morph { my ($number) = @_; return ((((($number % 7) * 13) % 17) * 19) % 23); } </code></pre> It appears to be some sort of quick authorization check (there is a later `$code == &amp;morph($user)` comparison).
评论 #6651130 未加载
评论 #6651703 未加载
elwellover 11 years ago
db user &quot;mark&quot;!
csenseover 11 years ago
Sadly, Facebook was way better in 2005 than it is now.<p>(I quit sometime around &#x27;08 or &#x27;09, after they started going downhill.)
评论 #6652241 未加载
bonemachineover 11 years ago
Precious.