NiftyPortal is a hierarchical dynamic site construction framework designed for sites (and series of sites) with similar functionality, but widely different designs or looks and feels. The term "similar" is relative; measure is made for overrides of "standard" functionality so that other sites at the same installation can have different code running for different purposes.
NiftyPortal is designed to securely factor reused code among as many different sites as possible. It uses a combination of SpeedyCGI (available on CPAN) and Template Toolkit (also on CPAN) to achieve fast response times, while still maintaining a great deal of flexibility for all maintainers.
Why did I write it? I was looking for a way to reduce the workload during development of a number of "virtual" sites for a non-profit organization I'm a part of, and wasn't able to find an existing framework that was able to do what I needed to do.
You might find NiftyPortal useful if you:
- find yourself creating complex systems of CGI scripts to run your site, and worry more and more about factoring code that's re-used,
- like some of PHP's features, but have a large amount of Perl code you need to maintain,
- have out-grown SSI,
- are creating a large number of sites that need to share code in the back end (such as for a common authentication routine),
- are creating "branded" sites with similar functionality, but different templates or design, along with the ability to override specific templates as necessary,
- need to integrate other Perl code into your site easily and effectively (you're hacking pre-existing forum software),
- think SlashCode is too large, complex, or slow,
- you've rolled your own quasi-templating system, but now need more flexibility,
- can't use mod_perl, or just prefer not to operate within its restrictions
- have used Template Toolkit before, but want to combine true Perl with it easily and in an organized fashion.
For most of the first year of development, this project was hosted on a Pentium MMX 233. Needless to say, performance was a very important consideration! I'm happy to say that performance is quite respectable on decent hardware. The ApacheBench stats shown below were taken while running on a dual Xeon 2.4Ghz with 1GB of RAM, on a fairly havily loaded server.
With SpeedyCGI
sh@root #] ab -n 1200 -c 60 http://www.redwire.net/ This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0 Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/ Benchmarking www.redwire.net (be patient) Completed 120 requests Completed 240 requests Completed 360 requests Completed 480 requests Completed 600 requests Completed 720 requests Completed 840 requests Completed 960 requests Completed 1080 requests Finished 1200 requests Server Software: Apache/2.0.51 Server Hostname: www.redwire.net Server Port: 80 Document Path: / Document Length: 13767 bytes Concurrency Level: 60 Time taken for tests: 11.529194 seconds Complete requests: 1200 Failed requests: 0 Write errors: 0 Total transferred: 16702800 bytes HTML transferred: 16520400 bytes Requests per second: 104.08 [#/sec] (mean) Time per request: 576.460 [ms] (mean) Time per request: 9.608 [ms] (mean, across all concurrent requests) Transfer rate: 1414.76 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 3 19.3 0 121 Processing: 148 554 60.7 546 691 Waiting: 146 552 61.4 544 690 Total: 221 558 54.8 547 779 Percentage of the requests served within a certain time (ms) 50% 547 66% 569 75% 590 80% 607 90% 619 95% 632 98% 684 99% 689 100% 779 (longest request)
NiftyPortal is pretty heavy. You'll need the following Perl modules installed (an installation script using the CPAN module is included which installs all of these, their pre-requisites, and a few more optional modules [see the docs]).
- DBI
- database module
- DBD::mysql
- database driver
- CGI::Minimal
- for lightweight CGI form processing
- CGI::Carp
- for nice CGI error messages
- CGI::SpeedyCGI
- runs perl persistently
- Template
- the Template Toolkit system
- Time::HiRes
- used in benchmarking
- Digest::MD5
- for password encrpytion
- Clone
- data manipulation
- Config::Tiny
- configuration file parsing
- HTTP::Lite
- a lightweight alternative to LWP
- Mail::Sendmail
- easy outgoing mail handling
- XML::Simple
- used by web services
- Data::Dumper
- for debugging output
- CGI::PathInfo
- an alternate query parser
- DateTime
- comprehensive date package (opt.)
- DateTime::Locale
- international date issues (opt.)
- Authen::Radius
- authentication module (opt.)
- Apache::Htpasswd
- authentication module (opt.)
- Net::FTP
- authentication module (opt.)
- Net::POP3
- authentication module (opt.)
- vpopmail
- authentication module (opt.)
If you plan on using a user database (strongly recommended -- in fact, this may become a requirement at some point), you'll need a database. In theory, any SQL compliant DB should be usable, as long as you have the appropriate DBD driver for it, but I've only tested with MySQL. SQLite support is probably what I'll work on next, with PostgreSQL coming soon after.
Download the latest version here: NiftyPortal 1.0b17 (Oct 9, 2005)
Note: Some of these sites are running older versions of the framework or are in various stages of disrepair...
- RedWire Broadband, Inc. - Main website
- Western District general website, including an automated gallery
- San Diego State University chapters of Kappa Kappa Psi/Tau Beta Sigma
Note that these two sites are running out of the same code base, but look different.- Classof96.net, sample installation
Because I haven't announced this project to anyone yet and I'm too busy rapidly revising the code =) If you somehow find this page and actually want to start using this, shoot me an email and I'll help you out.