spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / perl / tutorial / 4

Developer News
Get Ready for Microsoft's 'Oslo' Modeling Tool
Latest Linux Hits Networking Flaws
Metasploit 3.2 Offers More 'Evil Deeds'

Yahasp, a PerlHoo Alternative

A note from Jonathan

I'd like to personally thank Laurence Gold who has effectively duplicated the functionality of PerlHoo using an ASP VBscript app. While I still use Perl for most of my programming tasks (not just Web development), I think it's important to provide alternatives. Yahasp will also provide a basis for a side-by-side comparison of VBscript for ASP, and Perl for CGI which will be done at the end of the PerlHoo series.

Abstract

Our friend Jonathan Eisenzopf has done a brilliant job building a Yahoo like directory in PERL. The problem though is that I run NT, and IIS. I tried to install PERL and all the necessary files, but was not able to get it to work. Than I remembered one of the criteria was it had to be developed in less than a week.

I thought it should be easy maybe even easier to write the same Yahoo like directory in ASP. ASP happens to be Microsoft's Server Side Scripting language for their Web server IIS. However, before I go into the code let us first look at the criteria.

  1. Organizes information hierarchically
  2. Contains information about resources on the Internet
  3. Allows users to suggest new resources
  4. Allows editors to modify the directory content
  5. Is simple to maintain
  6. Takes less than 1 week to develop
  7. Exports and imports directory content from/to multiple sources

Jonathan is on version II of Perlhoo so this article will catch up that to version. I have also attempted to keep the same structure so it may not be typical ASP programming. I have also decided to keep the same Open Source Licensing. Thus, maybe some other ASP programmers will make it better. Therefore, this version I will attempt to answer 1, 2, 3, 4 and 5 for the most part.

Catching up to PerlHoo, Part I

First, I agree with Jonathan, there is no need to spend time modeling a database when there is a perfectly good directory. I also use a text file to store links. This will easily allow us to accomplish #1 and #5, which is to organize the information hierarchically and is simple to maintain. Note that I have an extra field in the text file, this is the window frame name. I did this just in case I wanted to use this in a frame format.

The Subroutine YAHASP is what accomplished this task. I use the Scripting.FileSystemObject (line 45, 66 and 67) to get the directory from the operating system, using a simple loop (lines 68-76) to traverse through the directories and print them out. Please note I often mix ASP and HTML to make it easier to read. For speed purposes, it is faster to create the whole file in ASP. I again use the Scripting.FileSystemObject but the OpenTextFile (lines 89-90) method to read from the text file. Lines 93 through 103 loops through the text file reading the lines and parsing them. ASP Parsing is a little different than PERL, I use the Mid string function to get rid of the starting and ending quotes. Next I create a variable with the string '","' (that is double quote - comma - double quote). This string is used to parse the line with the "Split" Command. Finally, I close the file once done reading it.

yahasp2.asp View source
This script implements a simple Yahoo-like Web directory using an ASP VBscript program. It's a nice alternative for those of you who have to work for the evil empire. Beyond a few minor differences in sytax, it effectively duplicates PerlHoo in every way.


home / experts / perl / tutorial / 4

http://www.internet.com

Written by Laurence Gold
Produced by Jonathan Eisenzopf and

JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Microsoft Article: Will Hyper-V Make VMware This Decade's Netscape?
Microsoft Article: BitLocker Encryption on Windows Server 2008
Go Parallel Article: Intel Thread Checker, Meet 20 Million LOC
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
Avaya Article: Call Control XML - Powerful, Standards-Based Call Control
Tripwire Whitepaper: Seven Practical Steps to Mitigate Virtualization Security Risks
Internet.com eBook: The Pros and Cons of Outsourcing
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
Go Parallel Article: James Reinders on the Intel Parallel Studio Beta Program
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Go Parallel Article: Getting Started with TBB on Windows
HP eBook: Storage Networking , Part 1
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Go Parallel Video: Intel(R) Threading Building Blocks: A New Method for Threading in C++
HP Video: Is Your Data Center Ready for a Real World Disaster?
Microsoft Partner Portal Video: Microsoft Gold Certified Partners Build Successful Practices
HP On Demand Webcast: Virtualization in Action
Go Parallel Video: Performance and Threading Tools for Game Developers
Rackspace Hosting Center: Customer Videos
Intel vPro Developer Virtual Bootcamp
HP Disaster-Proof Solutions eSeminar
HP On Demand Webcast: Discover the Benefits of Virtualization
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Microsoft Download: Silverlight 2 Software Development Kit Beta 2
30-Day Trial: SPAMfighter Exchange Module
Red Gate Download: SQL Toolbelt
Iron Speed Designer Application Generator
Microsoft Download: Silverlight 2 Beta 2 Runtime
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
IBM IT Innovation Article: Green Servers Provide a Competitive Advantage
Microsoft Article: Expression Web 2 for PHP Developers--Simplify Your PHP Applications
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES
webref The latest from WebReference.com Browse >
Anatomy of an Ajax Application · Popular JavaScript Framework Libraries: An Overview · Controllers: Programming Application Logic - Part 2
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
MS Access and MySQL · Cisco AutoQoS: VoIP QoS for Mere Mortals · While VoIP Adoption Explodes in Enterprise, Carrier Spending Lags


Created: June 16, 1999
Revised: June 16, 1999

URL: http://www.webreference.com/perl/tutorial/4/