Installation and usage guide for Dano - a collection of miscellaneous Perl utilities and helper functions for CGI programming
Dano is a collection of miscellaneous Perl utilities and helper functions designed to simplify common CGI programming tasks. Unlike standalone scripts like FormMail or Guestbook, Dano is a library meant to be included in your own Perl scripts.
The utilities include functions for:
require or do.
Upload the dano.pl file to your server. You have two common options:
| Location Option 1 | Place in your cgi-bin directory: /cgi-bin/lib/dano.pl |
|---|---|
| Location Option 2 | Place in a shared library directory: /home/username/lib/dano.pl |
| Permissions | chmod 644 dano.pl (readable by all) |
Edit the first line of dano.pl to match your server's Perl location:
#!/usr/bin/perl
Common Perl paths:
#!/usr/bin/perl#!/usr/local/bin/perl#!/usr/bin/perl5Create a simple test script to verify the library loads correctly:
#!/usr/bin/perl
# Include the Dano library
require "/path/to/dano.pl";
print "Content-type: text/html\n\n";
print "<h1>Dano Library Test</h1>";
print "<p>If you see this, Dano loaded successfully!</p>";
Add this line near the top of your Perl CGI script:
#!/usr/bin/perl
require "/path/to/dano.pl";
# Your script code here...
require "/home/username/lib/dano.pl";require "./lib/dano.pl";Once you've included Dano, you have access to various utility functions. Here are some common ones:
Parses form data from both GET and POST methods into a hash.
&parse_form;
my $name = $in{'name'};
my $email = $in{'email'};
Provides safe file locking for concurrent access.
&file_lock("$datafile");
# Read/write file safely
&file_unlock("$datafile");
Encodes special characters to prevent HTML injection.
$safe_text = &html_encode($user_input);
Returns formatted date and time strings.
$date = &get_date();
# Returns: "Tuesday, December 17, 2025"
#!/usr/bin/perl
require "/home/username/lib/dano.pl";
# Parse incoming form data
&parse_form;
# Print HTTP header
print "Content-type: text/html\n\n";
# Print HTML with safe encoding
print "<html><head><title>Form Results</title></head><body>";
print "<h1>Thank You!</h1>";
print "<p>Name: " . &html_encode($in{'name'}) . "</p>";
print "<p>Date: " . &get_date() . "</p>";
print "</body></html>";
#!/usr/bin/perl
require "/home/username/lib/dano.pl";
$datafile = "/home/username/data/entries.txt";
# Lock file for safe writing
&file_lock($datafile);
open(FILE, ">>$datafile");
print FILE "New entry: " . &get_date() . "\n";
close(FILE);
# Unlock file
&file_unlock($datafile);
Solution: Check the path in your require statement. Use absolute paths:
require "/home/username/lib/dano.pl";
Possible Causes:
Solution: Check error logs and verify permissions with chmod 755 for scripts.
Solution: Make sure you're calling functions with & prefix:
&parse_form(); # Correct
parse_form(); # May not work
Real-world code examples using Dano utilities
Installation guide for the FormMail script
Browse all script documentation