TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Facebook Perl source code from 2005

85 点作者 philfreo超过 11 年前

11 条评论

mst超过 11 年前
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 未加载
jrockway超过 11 年前
No wonder they wouldn&#x27;t let me use the username &quot;jrockway&#x2F;..&#x2F;..&#x2F;..&#x2F;..&#x2F;..&#x2F;etc&#x2F;passwd&quot;.
0x0超过 11 年前
Wow, the database connection ip and dbname were taken from http cookies!
philfreo超过 11 年前
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_failure超过 11 年前
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.
dkoch超过 11 年前
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.
jakejake超过 11 年前
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.
dmazin超过 11 年前
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 未加载
elwell超过 11 年前
db user &quot;mark&quot;!
csense超过 11 年前
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 未加载
bonemachine超过 11 年前
Precious.