<?xml version="1.0" encoding="windows-1252"?>
<node id="1382" title="chromatic" created="1999-12-24 06:10:27" updated="2012-09-28 15:44:56">
<type id="15">
user</type>
<author id="1382">
chromatic</author>
<data>
<field name="doctext">
&lt;!-- birthday:yyyy/09/08 --&gt;
&lt;!-- location:latitude=45.30.36,longitude=122.55.09 --&gt;

&lt;blockquote&gt;&lt;em&gt;"I won't aks you to grow up, but just sometime, please, aks yourself, OK, 'Who was saved?'  That's all, rill easy, 'Who was saved?'... Just in the privacy of your thotz, Zoyd.  As an exercise, li'l kinda Zen meditation.  'Who was saved?'... Here I thought you knew everything, it turns out you don't know ****."&lt;/em&gt;&lt;/blockquote&gt;

&lt;p&gt;&amp;mdash; Thomas Pynchon, &lt;em&gt;Vineland&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;Perl Resources&lt;/h2&gt;

&lt;p&gt;&lt;a href="http://www.onyxneon.com/books/modern_perl/index.html"&gt;Modern Perl: the book&lt;/a&gt; explains how Perl 5 works and how to take advantage of Perl 5.10, 5.12, and 5.14. It's from &lt;a href="http://www.onyxneon.com/"&gt;Onyx Neon&lt;/a&gt; press, an independent publisher of great technical books.&lt;/p&gt;

&lt;p&gt;I've written, edited, and contributed to other &lt;a href="http://wgz.org/chromatic/books/"&gt;technical books&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I maintain a list of &lt;a href="http://modernperl.net/"&gt;Modern Perl resources&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Other Information&lt;/h2&gt;

&lt;p&gt;I am available for &lt;a href="http://wgz.org/chromatic/work/consulting.html"&gt;development, mentoring, refactoring, and project management consulting&lt;/a&gt;. I can help your project succeed!&lt;/p&gt;

&lt;p&gt;My work includes the technical direction of &lt;a href="http://bigbluemarblellc.com/"&gt;Big Blue Marble&lt;/a&gt;, and I am the lead developer of &lt;a href="http://trendshare.org/"&gt;Trendshare&lt;/a&gt;, a site devoted to financial and investing literacy for novice investors (with a focus on value investing).&lt;/p&gt;

&lt;!-- 
&lt;p&gt;I once wrote Perl while riding a camel in the Sahara.&lt;/p&gt;

&lt;p&gt;All code posted here, unless otherwise noted, is copyright me.  You are welcome to use it for the purpose of instruction, example, or as a base for your own programs.  You are permitted to incorporate a code into programs for which you or your business receive compensation (of whatever form), provided it is clear that you found Perl Monks useful.  Add a link to the appropriate node.&lt;/p&gt;

&lt;p&gt;&lt;hr width="60%"&gt;&lt;p&gt;
&lt;!-- &lt;p&gt;Here are some reasons to use [CPAN://CGI.pm] instead of code from a book:
&lt;ul&gt;
	&lt;li&gt;Handling POST requests is different from handling GET requests.  You cannot switch between the two easily with many home-grown parsers.  Even if you can, a malicious user can possibly break your program by switching methods.  Game over.&lt;/li&gt;
	&lt;li&gt;It's non-trivial to write a decoder for the multipart/form-data encoding.  (I should know, [jlp] and I wrote one, with notes from [japhy] and Lincoln Stein.)  If you want to handle file uploads, you're going to spend a lot of time cursing.&lt;/li&gt;
	&lt;li&gt;Very few home-grown approaches handle multiple values associated with a single name.  What if you have a checkbox group, or a multiple-selection list?  Depending on how you handle input, you'll clobber all but the last parsed value.  Oops.  So that's why people only order one thing at a time.&lt;/li&gt;
	&lt;li&gt;Your server may be vulnerable to Denial of Service attacks, if you don't check the Content-length header.  (You may want to set a limit on the amount of data accepted via POST.  You'd hate for someone with a T3 to upload an entire CD worth of data in a single request, especially if you don't have that much memory available to your server.)&lt;/li&gt;
	&lt;li&gt;Even if you do check Content-length, does your handler check to see if it's received all of the data?  What happens if it encounters truncated data?  Does it recover gracefully, or does it process the request with mangled data?&lt;/li&gt;
	&lt;li&gt;Does your code handle the quirks (and downright bugs) of various web browsers?  When Netscape or IE is braindead, will your program get correct information?&lt;/li&gt;
	&lt;li&gt;Even if your code allows for multiple values with a name, does it account for scalar and list context when accessing that field?  Does it make extra work?  Does it join all values together into a string and require you to split on a character that could (by accident or malicious intent) be present in one of the values?&lt;/li&gt;
	&lt;li&gt;Does your code encode and decode URI-encoded characters correctly?&lt;/li&gt;
&lt;/ul&gt;
If you're not sure, feel free to [Seekers of Perl Wisdom|ask].  (For the sake of your skin, I recommend that you mention in your post that you want to be educated about these vulnerabilities.  If you say that you think CGI.pm is a bloated piece of trash and can't understand why anyone would use it, you'll get rather incivil results.  If you genuinely seek enlightenment and mark your code snippet as unproven and possibly broken, you'll get a better result.)
&lt;p&gt;
Feel free to link here or to [Ovid]'s &lt;a href="http://www.easystreet.com/~ovid/cgi_course"&gt;CGI course&lt;/a&gt; for more detail.
&lt;hr
[id://65781|the map is posted at nearly every street corner]--&gt;</field>
<field name="lasttime">
2013-05-21 00:39:17</field>
<field name="experience">
57100</field>
<field name="user_scratchpad">
358258</field>
<field name="imgsrc">
539852</field>
<field name="timeformat">
</field>
<field name="numwriteups">
5844</field>
<field name="location">
chromatic industries</field>
<field name="timezone">
America/Los_Angeles</field>
<field name="codewrapoff">
</field>
<field name="codewraplength">
</field>
<field name="codeautowrap">
</field>
<field name="codeprefix">
</field>
<field name="codebig">
on</field>
</data>
</node>
