Perl and the Power of Web Portals
by Ed Stephenson
With GabTown.com, Any Site Can Be a Portal
Three years ago, it was big news in the tech world when companies such as Netscape and Microsoft entered the Web portal business. A fair amount of technical savvy was required, after all, to build a site with enough services so visitors would use it as a major starting point when connecting to the Web. Now, any Webmaster can provide services such as online forums, chatrooms, personal home pages, and Webmail to keep visitors coming back on a regular basis. And they can do it without spending a dime.
That's the promise Tom Tessier offers with a unique Perl-based application at GabTown.com. Tessier, president and chief developer of an application service provider known as Gab Internet eCommunities in Edmonton, Alberta, will provide any small business or group with online community modules, integrate those modules into the business's Web site, provide database connectivity, and then handle all the bandwidth and hosting expenses. And nothing is required in return, other than registering for the services.
What's the catch? GabTown.com is a form of "viral marketing," a technique Tessier hopes will lure corporate users to Gab Internet's $12,000 customized "powerhouse solution." Yet, with more than 1,000 free customers, such as SolStar Media, providing free forums, Web-based email, and home pages to their visitors, courtesy of his company, Tessier also sounds an egalitarian note. "We've put the power back into the hands of those who made the Internet what it is today," he asserts. "Anyone can add portal-like community features to their Web site."
Appropriate, then, that the application behind GabTown.com is built entirely on an open source foundation. Developed under Red Hat Linux, GabTown.com's application runs on FreeBSD servers with mod_perl on the Web front end, and MySQL as the back-end database. A variety of Perl scripts seamlessly integrate them with the Apache Web server, sendmail, and NFS, an open operating system that allows network users to access shared files. Perl scripts also operate maintenance processes under the server, such as directing incoming mail provided by sendmail to the appropriate user locations.
Faith in Perl
"Programming the application in Perl proved a godsend," remarks Tessier, a Perl user for seven years who founded Gab Internet in July 1999. "Java was considered for GabTown.com, as well as pure C. However, the development time of Perl outweighed any minor benefits the other two may have offered. If Java or C had been used, I'm sure we'd still be in the alpha stages."
Visit perl.oreilly.com for a complete list of O'Reilly's books on Perl.
In fact, Tessier's team completed the GabTown.com application in just ten months, crediting not just Perl's development speed over compiled languages, but also the proliferation of modules available on CPAN. "Our corporate, static site is itself simply a user account on GabTown.com," Tessier remarks, demonstrating his faith "in the robustness of the technology so heavily based upon Perl."
Tessier's goal with both his free and corporate solutions is to help organizations improve their Web site's "visitor liquidity" and increase Web site revenue. Plenty of companies now offer Web-based drive space--with personal home pages and the ability to store files on remote servers via the Web---but Tessier considers GabTown.com unique because of its "permission-based" user system, which enables Webmasters to decide who can post messages to forums, while allowing a site's users to control access to their personal home pages.
"Users can exchange business plans or create Web pages for their favorite stocks," Tessier points out, "and they can control exactly who has access to their data."
With GabTown.com, Webmasters can also permit users to "rehost" or display personal home pages on other sites. Rehosting is an important part of viral marketing, the popular Internet strategy that turns a company's customers into its best salespeople. The small price that GabTown.com's free customers pay is an unobtrusive message ("courtesy of GabTown") on screens that display forums, home pages or Webmail, with a link to the Gab Internet site. As GabTown.com's free customers grow, so do links to Gab Internet, along with examples of its handiwork--spreading, Tessier says, "like a virus."
Solving Database Integration
Of course, he points out, any company that employs viral marketing must be able to cope with a sudden increase in demand. That's why Tessier chose MySQL, a database that would facilitate proper load scaling as the number of GabTown.com customers increased. GabTown.com not only accommodates thousands of user mail files and forum messages, but through its long-term storage feature, users can turn GabTown.com into a remote network drive by using Upload Helper, a Windows 98/2000 utility, to upload files to their personal home page from the Windows Explorer shell.
Tessier designed his application so that user data and file locations are stored in the database, while actual user mail and user file data are stored in raw form on the FreeBSD file system. But doing that caused an integration problem between MySQL and Perl. "When you wish to send or receive data directly from a Web server to a Web browser you must write to STDOUT and read from STDIN," Tessier explains. "While the C API for MySQL allows one to do this, the Perl DBD/DBI interface to MySQL does not support direct input of data from STDIN to the database nor direct output of data from the database to STDOUT."
If a user uploaded a 10-megabyte file, for example, that file would first be read from STDOUT and stored on the file system, and then read from the file system and stored in the database, a total of 20MBs handled internally. Data output would require the same process in reverse.
"Obviously such load-doubling could quickly bring a system to its knees," Tessier explains. "So in the end, we chose to store the raw mail and user files on the file system with numeric names, while the MySQL database served as a quick indexing and look-up engine controlled by SQL routines encapsulated in Perl. Since data from a file can be read directly to STDOUT via Perl, and data from STDIN can be written directly to disk, this proved to be an appropriate solution."
Payoff for Free Technology
Gab Internet's payoff for the free technology and services it provides to small customers is the chance to build custom portals for corporate users. Custom turnkey portals include a dedicated database, bandwidth and computing power, items that are shared by GabTown's free clients. Gab Internet also custom-codes the interface that the site needs to connect to the database, so that current members need not reregister.
InvestorBBS and Investments Canada, both owned by Gab Internet, are examples of the company's corporate sites. "If an organization contracts us to develop a site from scratch, we'll lean towards the layout of those two example sites, as they resize to all browser resolutions," Tessier explains. "If a company already has a well-established Web presence, we will customize the community portions to suit their site directly."
The expense and trouble Gab Internet has gone through to market its premier product doesn't worry Tessier. By using Perl and other open source tools to develop the GabTown application, he has avoided paying thousands of dollars in licensing fees. "Gab Internet was never meant to be one of those flame-out dot-coms indebted to Oracle and Microsoft, with the business-sinking costs that such relationships entail," he insists.
Instead, in the spirit of open source, he has helped to make Web portals an open domain, rather than an exclusive one.
Learn how large and small companies are putting Perl to work by reading other Perl Success Stories.