Dano Utilities

Perl CGI Helper Scripts & Web Development Tools

Dano is a collection of miscellaneous Perl utilities and helper functions designed to simplify common CGI programming tasks. These modular tools were created to work alongside the main script archive, providing reusable functionality for form processing, data validation, file handling, and more.

Free Download
Utility Library
Perl 5

Overview

Dano is a collection of miscellaneous Perl utilities that were developed to support CGI script development in the 1990s. Rather than being a single application, it's a toolkit of reusable subroutines and helper scripts that address common web development needs.

The collection includes utilities for:

  • Form data parsing and validation
  • Environment variable handling
  • File I/O with proper locking
  • Data formatting and display
  • Security and input sanitization
  • Date and time formatting
Quick Info
  • Language: Perl 5
  • Type: Library / Utility Collection
  • Dependencies: None (standard Perl)
  • License: Free for use
  • Compatibility: Perl 5.x

Included Utilities

Form Parser

Parse GET and POST form data into associative arrays. Handles URL encoding and multipart forms.

%FORM = &parse_form();
Input Sanitizer

Clean and validate user input to prevent injection attacks and data corruption.

$safe = &sanitize($input);
File Locking

Safe file operations with proper locking to prevent data corruption from concurrent access.

&lock_file($fh);
Date Formatter

Format dates and times in various styles for display in web pages.

$date = &format_date($time);
Email Validator

Basic email address format validation using regular expressions.

if (&valid_email($addr)) { }
HTML Encoder

Escape HTML entities to safely display user-submitted content.

$safe_html = &html_escape($text);

Historical Context

In the mid-1990s, web developers didn't have modern frameworks, package managers, or standard libraries. CGI scripts were often written from scratch, and common tasks like form parsing had to be reimplemented repeatedly.

"Before CPAN became widely adopted, CGI script archives provided not just complete applications, but also reusable utility libraries that developers could include in their own projects."

Why Utility Libraries Mattered
  • No Package Manager: CPAN existed but wasn't widely used on shared hosting
  • Code Reuse: Developers needed tested, working solutions for common problems
  • Learning Resource: Reading library code taught best practices (and sometimes bad habits)
  • Compatibility: Libraries worked across different hosting environments
The CGI Era
1993CGI specification introduced
1995Perl becomes dominant CGI language
1995-1999Golden era of CGI script archives
1995CGI.pm released by Lincoln Stein
1999mod_perl gains popularity
2000+PHP begins to dominate web scripting
Did You Know?

The original CGI.pm module by Lincoln Stein became so popular it was eventually included in Perl's core distribution.

In 1996, CPAN (Comprehensive Perl Archive Network) had only about 500 modules. Today it has over 200,000.

Many concepts from early CGI libraries live on in modern frameworks.

Usage Examples

Using Dano Utilities in Your Script
#!/usr/bin/perl

# Include the Dano library
require "dano.lib";

# Parse form data
%FORM = &parse_form();

# Validate email
if (!&valid_email($FORM{'email'})) {
    &error("Invalid email address");
}

# Sanitize input for display
$safe_name = &html_escape($FORM{'name'});

# Format current date
$today = &format_date(time);

# Lock file for writing
open(DATA, ">>data.txt");
&lock_file(DATA);
print DATA "$safe_name|$FORM{'email'}|$today\n";
&unlock_file(DATA);
close(DATA);

# Output HTML
print "Content-type: text/html\n\n";
print "<html><body>";
print "<p>Thank you, $safe_name!</p>";
print "<p>Submitted on: $today</p>";
print "</body></html>";
Modern Perl Equivalent (Using CPAN)
#!/usr/bin/perl
use strict;
use warnings;
use CGI;
use Email::Valid;
use HTML::Entities;
use Fcntl qw(:flock);
use POSIX qw(strftime);

my $cgi = CGI->new;

# Parse form data (CGI.pm handles this automatically)
my $email = $cgi->param('email') // '';
my $name = $cgi->param('name') // '';

# Validate email (using Email::Valid from CPAN)
unless (Email::Valid->address($email)) {
    print $cgi->header('text/html');
    print "<html><body>Invalid email address</body></html>";
    exit;
}

# Sanitize input (using HTML::Entities)
my $safe_name = encode_entities($name);

# Format date (using POSIX)
my $today = strftime("%B %d, %Y", localtime);

# Lock and write file (using Fcntl)
open(my $fh, '>>', 'data.txt') or die "Cannot open: $!";
flock($fh, LOCK_EX);
print $fh "$safe_name|$email|$today\n";
close($fh);

# Output
print $cgi->header('text/html');
print "<html><body>";
print "<p>Thank you, $safe_name!</p>";
print "<p>Submitted on: $today</p>";
print "</body></html>";
PHP Equivalent
<?php
/**
 * PHP equivalent of Dano utility functions
 */

// Form parsing (built into PHP via $_POST, $_GET)
$email = $_POST['email'] ?? '';
$name = $_POST['name'] ?? '';

// Email validation (built-in filter)
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
    die('Invalid email address');
}

// HTML escape (built-in function)
$safe_name = htmlspecialchars($name, ENT_QUOTES, 'UTF-8');

// Date formatting (built-in function)
$today = date('F j, Y');

// File writing with lock (built-in)
$fp = fopen('data.txt', 'a');
if (flock($fp, LOCK_EX)) {
    fwrite($fp, "$safe_name|$email|$today\n");
    flock($fp, LOCK_UN);
}
fclose($fp);

// Output
echo "<html><body>";
echo "<p>Thank you, $safe_name!</p>";
echo "<p>Submitted on: $today</p>";
echo "</body></html>";
?>

Modern Alternatives (2024)

Today's Perl developers have access to a rich ecosystem of tested, maintained modules on CPAN. Modern web frameworks also provide these utilities out of the box:

CPAN Modules
  • CGI.pm

    The classic CGI handling module. Form parsing, headers, and HTML generation.

  • Email::Valid

    Email address validation with DNS checks.

  • HTML::Entities

    Encode and decode HTML entities safely.

  • Data::FormValidator

    Flexible form data validation framework.

Modern Perl Frameworks
  • Mojolicious Recommended

    Modern real-time web framework. Batteries included with templates, WebSockets, and more.

  • Dancer2

    Lightweight, minimalist web framework inspired by Sinatra.

  • Catalyst

    Enterprise-grade MVC framework with extensive plugin ecosystem.

  • Plack/PSGI

    Modern interface between Perl web applications and web servers.

Comparison: Then vs Now
Task Dano (1990s) Modern Perl (2024)
Form Parsing &parse_form() CGI->new->param() or framework
Email Validation &valid_email() Email::Valid->address()
HTML Escaping &html_escape() HTML::Entities::encode_entities()
File Locking &lock_file() flock($fh, LOCK_EX)
Date Formatting &format_date() POSIX::strftime() or DateTime

Download

Compressed Archives
  • dano.tar.gz 4.2 KB
  • dano.zip 5.1 KB
Package Contents
  • dano.lib

    Main library file with all utility subroutines

  • README

    Documentation and usage instructions

  • example.cgi

    Example script demonstrating library usage

Resources

Back to Scripts