After spending some time looking for an excuse to try out the "Dave's Quick Search Deskbar Search Wizard" (Verdict: very cool!) i decided to build a search for the online perldoc repository (located at http://www.perldoc.com/ not surprisingly.) Which allows you to search the built in functions in Perl by version number, something which saves me having a bundle of different documentation packages installed on all my machines.
In the doc examples I've shown something i thought would save a couple of keystrokes, the version number can be anything from a verbose "/perl5.6.0" to a terse and more perlish "/56" I've attached a working draft of the search but i have a couple of questions for the list: 1. Should this kind of search live in the Computers->programming section or the Computer->reference section? The existing language references (PHP and Javascript) live in programming so I've done the same but i thought i should ask. 2. I've used a bundle of separate cases in the switch statement, is there a better way of doing this in Javascript such as maybe regexps in the case statements? The search itself has been working fine for me but while i was putting it together i had some problems with the javascript switch/case statements, it seemed to be matching strings like 'perl5.6' at the case perl5.6.1 code, presumably it matched the substring and stopped there so I've altered the order of the statement around a bit and its working but it seems a bit kludgy. If any one knows a better way to do this I'd appreciate the feedback. HTH and thanks for keeping DQSD such a valuable tool. Dean -- Profanity is the one language all programmers understand --- Anon
<search function="perldoc"> <name>Perldoc Search</name> <category>Computers<category>Programming</category></category> <contributor>Dean Wilson</contributor> <link>http://perldoc.com/</link> <email>dean dot wilson3 at virgin dot net</email> <description> Search the online documentation for builtin functions from any released version of Perl. Defaults to version 5.8.0 (The newest release as of May 25 2003) <div class="helpboxDescLabels">Switches:</div> <table class="helpboxDescTable"> <tr><td>/perl5.8.0</td><td> - </td><td>Search within Perl version 5.8.0</td></tr> <tr><td>/perl5.6.1</td><td> - </td><td>Search within Perl version 5.6.1</td></tr> <tr><td>/perl5.6.0</td><td> - </td><td>Search within Perl version 5.6.0</td></tr> <tr><td>/perl5.005_03</td><td> - </td><td>Search within Perl version 5.005_03</td></tr> <tr><td>/perl5.004_05</td><td> - </td><td>Search within Perl version 5.004_05</td></tr> </table> <div class="helpboxDescLabels">Examples:</div> <table class="helpboxDescTable"> <tr><td>perldoc fileno</td></tr> <tr><td>perldoc opendir /perl5.6.1</td></tr> <tr><td>perldoc closedir /561</td></tr> <tr><td>perldoc readdir /56</td></tr> </table> </description> <form name="perldocf" method="get" action="http://perldoc.com/cgi-bin/htsearch"> <input type="hidden" name="words" value="" /> <input type="hidden" name="restrict" value="" /> </form> <script><![CDATA[ function perldoc(q) { if( nullArgs("perldoc", q) ) return; var args = parseArgs(q, "perl5.6, perl5.8.0, perl5.6.1, perl5.6.0, perl5.005_03, perl5.004_05, perl5.8, perl58, 5.8.0, 580, 58, perl56, 5.6.0, 560, 56, perl561, 5.6.1, 561, 5.005_03, 5.004_05"); if ( args.switches.length == 1) { switch( args.switches[0].name ) { //basic catches, these are identical to params passed to the cgi case "perl5.6": document.perldocf.restrict.value = "perl5.6"; break; case "perl5.8.0": document.perldocf.restrict.value = "perl5.8.0"; break; case "perl5.6.1": document.perldocf.restrict.value = "perl5.6.1"; break; case "perl5.6.0": document.perldocf.restrict.value = "perl5.6"; break; case "perl5.005_03": document.perldocf.restrict.value = "perl5.005_03"; break; case "perl5.004_05": document.perldocf.restrict.value = "perl5.004_05"; break; // shorthand catches for the lazy, and me. case "perl5.8": document.perldocf.restrict.value = "perl5.8.0"; break; case "perl58": document.perldocf.restrict.value = "perl5.8.0"; break; case "5.8.0": document.perldocf.restrict.value = "perl5.8.0"; break; case "580": document.perldocf.restrict.value = "perl5.8.0"; break; case "58": document.perldocf.restrict.value = "perl5.8.0"; break; case "perl56": document.perldocf.restrict.value = "perl5.6"; break; case "5.6.0": document.perldocf.restrict.value = "perl5.6"; break; case "560": document.perldocf.restrict.value = "perl5.6"; break; case "56": document.perldocf.restrict.value = "perl5.6"; break; case "perl561": document.perldocf.restrict.value = "perl5.6.1"; break; case "5.6.1": document.perldocf.restrict.value = "perl5.6.1"; break; case "561": document.perldocf.restrict.value = "perl5.6.1"; //56 calls this break; //these are old, less used and have a verbose version number. //if your still using them you deserve pain. :) case "5.005_03": document.perldocf.restrict.value = "perl5.005_03"; break; case "5.004_05": document.perldocf.restrict.value = "perl5.004_05"; break; default: document.perldocf.restrict.value = "perl5.8.0"; break; } } else { document.perldocf.restrict.value = "perl5.8.0"; } document.perldocf.words.value = args.q; submitForm(perldocf); } ]]></script> <copyright> The following applies if this file is included and distributed with Dave's Quick Search Deskbar: Copyright (c) 2002 David Bau; Distributed under the terms of the GNU Public License, Version 2 (http://www.gnu.org/copyleft/gpl.txt) </copyright> <created_by> This search file was initially created on 05/24/03 at 12:53:16 by Dave's Quick Search Deskbar Search Wizard version 1.0.1 , Copyright (c) 2002 Glenn Carr; Distributed under the terms of the GNU General Public License, Version 2 </created_by> </search>