ANTBOMB2 - Atomic Ant Bomb work horse.
NAME
VERSION
SYNOPSIS
Required Modules
USAGE
AUTHOR
CREDITS
^ NAME
ANTBOMB2 - Atomic Ant Bomb work horse.
For those of us who think a shoe just isn't enough...
^ VERSION
<!-- VERSION --> : 2004.Nov.06 6:26:22
^ SYNOPSIS
A CGI.pm replacement of sorts. It was originally created to complete specific
tasks with shorter syntax than CGI.pm and other existing modules afforded.
It has since included 'long names' to the calls as well for read-ability,
and added MANY more functions that CGI.pm does not handle. It has also been
chunked into sub modules to load faster than CGI.pm and previous versions of
ANTBOMB.pm. There are many modules out there that perform many of the tasks
that ANTBOMB2.pm handles, but at this time, ANTBOMB2.pm is a pure perl solution.
This makes dropping the main and sub modules on a server possible with minimal
fuss. Note however, there are some functions that DO require other modules to
be loaded (DBI.pm, DBDxxx.pm, and LWP.pm). This module is a work in progress...
^ Required Modules
There are three (possibly four) modules that will need to be installed to get
full use out of ANTBOMB. However, ANTBOMB is very powerful even if you do not
need either of these functions.
^ DBI.pm
In order to tie directly into the DBI interface built into ANTBOMB, the
DBI module from CPAN will need to be installed, as well as the DBD module
for the desired database type.
For instance, to use MySQL, you will need these two modules loaded (current
as of 2004-Mar-15):
http://search.cpan.org/~timb/DBI-1.42/DBI.pm
http://search.cpan.org/~rudy/DBD-mysql-2.9003/lib/DBD/mysql.pm
^ LWP.pm
In order to use the fetch feature of ANTBOMB, you will need to have the LWP
module from CPAN installed. It can be found at (current as of 2004-Mar-15):
http://search.cpan.org/~gaas/libwww-perl-5.76/lib/Bundle/LWP.pm
Additionally, of you plan to use SSL in your fetching, you will need to
install one of two modules. They can be found at (current as of
2004-Mar-15):
http://search.cpan.org/~chamas/Crypt-SSLeay-0.51/SSLeay.pm
or
http://search.cpan.org/~behroozi/IO-Socket-SSL-0.95/SSL.pm
^ USAGE
USAGE:
use ANTBOMB2;
my $A=ANTBOMB2->new();
or
BEGIN {
use ANTBOMB2;
use vars qw($A);
$A=ANTBOMB2->new();
$A->DIAGNOSTICS
(
destroys=>'Yes',
delayout=>'Yes',
debug=>'0',
queries=>'Yes',
useful_errors=>'0'
);
}
NOTE: The second form will pick up on all warnings, even those that are
done at script startup (but not runtime errors).
^ INITIALIZE OBJECT
DESCRIPTION:
Initialize all params from ENV hash (POST & GET) into $self->p(),
initialize all params from ENV hash into $self->e(),
initialize all attached files into $self->p('_UFILES_')
see CGI Parameters for more,
and puts the contents of any post data into $self->{BUFFER}
USAGE:
my $A=ANTBOMB->new();
PARAMETERS:
N/A
^ Example: object creation
$A=ANTBOMB->new();
OUTPUT:
N/A - Creates new object and stores it in $A
^ CGI PARAMETERS+
DESCRIPTION:
Parameters: Web/CGI parameters and internal variables
Sessions: Allow web pages to save sessions between visits to server
NOTE: The reason for the '+' in the heading is that you can add more
into this method than just the CGI passed variables, and you can and
remove them at will.
^ CGI Parameters
DESCRIPTION:
Manipulate parameters in Web/CGI applications, as well as create
parameters that are persistent in the program
USAGE:
$A->p(LIST) or $A->parameters(LIST)
PARAMETERS:
$A->p(a,b);
a: key -> name of parameter to return
accepts: any value
b: value -> value to set key(a) parameter to
accepts: any value
NOTE:
Reserved name space (for with forms with method multipart/form-data) -
'_UFILES_' - This is a referenced array of all uploaded files by
uploaded name and path of the file
'xxx_TYPE_' - Uploaded Files will usually have this parameter, and be
equal to the type of the file where xxx is the uploaded
name and path of the file
'xxx_FILEPATH_' - Uploaded Files will always have this parameter, and be
equal to the file path where xxx is the uploaded name
and path of the file
'xxx_FILENAME_' - Uploaded Files will always have this parameter, and be
equal to the file name where xxx is the uploaded name
and path of the file
'xxx_FILE_' - Uploaded Files will always have this parameter, and be
equal to the file where xxx is the uploaded name and
path of the file
^ Example: retrieve list of parameters
my @params=$A->p();
OUTPUT:
N/A - Returns an array of all parameters in use and store them in @params
^ Example: set parameter
$A->p('ant','bomb');
OUTPUT:
N/A - Stores value 'bomb' in param key 'ant'
^ Example: retrieve and store single parameter
my $bomb=$A->p('ant');
OUTPUT:
N/A - Returns parameter value of key 'ant' & stores it in $bomb
^ Example: retrieve and print single parameter
print $A->p('ant');
OUTPUT:
bomb
^ Example: retrieve list of file parameters
NOTE: File 'test_text.txt' has been uploaded via form element to this
script and the file content is 'This is a test text.'
print $A->START_HTTP();
print $A->START_HTML();
for(@{$A->p('_UFILES_')}) {
print 'Name: ',$_,"<br>\n";
print 'Path: ',$A->p($_.'_FILEPATH_'),"<br>\n";
print 'Name: ',$A->p($_.'_FILENAME_'),"<br>\n";
print 'Type: ',$A->p($_.'_TYPE_'),"<br>\n";
print $A->FORM_TEXTAREA(
name=>'dumby',
rows=>10,
cols=>50,
value=>$A->p($_.'_FILE_')
),"<br>\n<br>\n<br>\n";
}
print $A->END_HTML();
OUTPUT:
Date: Wed, 19 Mar 2003 14:25:41 (+06 UT)
User-Agent: ANTBOMB V.2.001
Content-type: text/html
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<title>TEXT_T~1.CGI - No Title</title>
</head>
<body>
From: C:\Apache\cgi-bin\test_text.txt<br>
Path: C:\Apache\cgi-bin\<br>
Name: test_text.txt<br>
Type: text/plain<br>
<textarea name="dumby" rows="10" cols="50">This is a test text.</textarea><br>
<br>
<br>
</body>
</html>
^ CGI Sessions
DESCRIPTION:
Manipulate session states
USAGE:
$A->SESSION(HASH)
PARAMETERS DESCRIPTION
mode ----- type of action to perform
accepts: set_dir, set, clean_session, clear_dir, or clear_session
dir ------ path to location of session files
accepts: any value
file ----- name of session file
accepts: any value
keep ----- list of names to keep (in regex format)
accepts: any value
drop ----- list of names to drop (in regex format)
accepts: any value
interval - time to delete old sessions from inactivity
accepts: 0-9,. -> number (can be fractions ex:'1.5')
m -> Minutes (number x 60)
h -> Hours (number x 3600)
d -> Days (number x 86400)
'' -> deletes current session file
^ Example: set session directory
$A->SESSION(mode=>'set_dir',dir=>'./sessions/');
OUTPUT:
N/A - Sets session file directory to './sessions/'
^ Example: set session directory to cwd
my $session_dir=$A->SESSION(mode=>'set_dir');
OUTPUT:
N/A - Sets $session_dir to current session directory
^ Example: retrieve current session directory
print $A->SESSION(mode=>'set_dir');
OUTPUT:
./sessions/
^ Example: restore session parameters (known session)
$A->SESSION(mode=>'set');
OUTPUT:
N/A - Restores parameters
^ Example: clean up session directory
$A->SESSION(mode=>'clear_dir',interval=>'5m');
OUTPUT:
N/A - Removes sessions older than 300 seconds
^ Example: clear current session
$A->SESSION(mode=>'clear_session');
OUTPUT:
N/A - Removes current session
^ Example: restore session parameters from named file
my @parameters=$A->SESSION(mode=>'set',file=>'ant.txt');
OUTPUT:
N/A - Sets all saved parameters in file ant.txt in the ANTBOMB2 object.
NOTE: this will drop any parameters that have been passed from a
form, but load all others into the object.
^ Example: save current session to named file raw
$A->SESSION(mode=>'save',file=>'ant.txt');
OUTPUT:
N/A - Saves all current parameters in file ant.txt.
^ Example: save current session to named file with dropped parameters
$A->SESSION(mode=>'save',file=>'ant.txt',drop=>'^(?:disk|cache)');
OUTPUT 9:
N/A - Saves all current parameters in file ant.txt, skipping all
params that begin with disk or cache
^ Example: clean current session to named file with kept parameters
$A->SESSION(mode=>'clean_session',file=>'ant.txt',keep=>'^(?:disk|cache)');
OUTPUT 10:
N/A - Removes all current parameters in the ANTBOMB2 object, that
do not start with disk or cache
^ DBI
DESCRIPTION:
Allows ANTBOMB to communicate directly with the DBI interface
NOTE:
DBI AND the DBD of the flavor of database you will be calling must
already be installed on the server you are going to call this on.
USAGE:
$A->DBI(HASH)
PARAMETERS DESCRIPTION
mode ----- type of action to perform
accepts: handle, select, insert, delete, update, run, clean
query ---- string
accepts: any value
data ----- string
accepts: any value
type ----- type of database (MySQL, Oracle, etc.)
accepts: any value
name ----- name of database to connect to
accepts: any value
host ----- host of database (defaults to 'localhost')
accepts: any value
user ----- user name of database account
accepts: any value
pass ----- pass word of database account
accepts: any value
^ Example: handle explicit
$A->DBI
(
mode=>'handle',
type=>'mysql',
name=>'mysql',
host=>'localhost',
user=>'ant',
pass=>'bomb'
);
OUTPUT:
N/A - Create a database handle for use throughout the life of the script
^ Example: handle default
$A->DBI(mode=>'handle',type=>'mysql',name=>'mysql');
OUTPUT:
N/A - Create a database handle for use throughout the life of the script
NOTE: localhost is assumed for host parameter
^ Example: insert
my $id=$A->DBI
(
mode=>'insert',
query=>q~INSERT INTO db (id,name) VALUES ('','ant')~
);
OUTPUT:
N/A - Inserts ant into database db and stores the new record ID in $id
NOTE:
It is assumed here that id is the primary key and that it will auto
increment, thus we leave it blank to let it do its thing.
^ Example: select
$A->DBI(mode=>'select',query=>q~SELECT * FROM user~);
OUTPUT:
N/A - Selects all records and columns of table user.
^ Example: WORKING select
use strict;
use ANTBOMB2;
$A=ANTBOMB2->new();
$A->DBI(mode=>'handle',type=>'mysql',name=>'mysql');
for(@{$A->DBI(mode=>'select',query=>q~SELECT * FROM user~)}) {
print qq~@$_\n~;
}
OUTPUT:
localhost root Y Y Y Y Y Y Y Y Y Y Y Y Y Y
% root Y Y Y Y Y Y Y Y Y Y Y Y Y Y
localhost N N N N N N N N N N N N N N
% N N N N N N N N N N N N N N
NOTE:
This is a fresh install of mysql, so no passwords have been assigned yet.
^ Example: select stored
my $max=$A->DBI
(mode=>'select',query=>'SELECT MAX(date) FROM user')->[0]->[0];
OUTPUT:
N/A - Sets $max equal to the greatest date found in date column
^ Example: update
$A->DBI
(
mode=>'update',
query=>q~UPDATE user SET pass='password' WHERE user='root'~
);
OUTPUT:
N/A - Sets the password to password where the username is root
NOTE:
Don't do this... use a hard password like cVf7ayheS0. Never put an
easy to guess password (or dictionary searchable word).
^ Example: delete
$A->DBI
(
mode=>'delete',
query=>q~DELETE FROM user WHERE name LIKE '%test%'~
);
OUTPUT 8:
N/A - Deletes all records in table user whose column name has
the word test in it.
^ Example: clean
print $A->DBI(mode=>'clean',data=>q~Shawn's "Page of Links"~);
OUTPUT 9:
Shawn\'s \"Page of Links\"
^ DIAGNOSTICS
DESCRIPTION:
Useful error messages from ANTBOMB
USAGE:
$A->DIAGNOSTICS(HASH)
PARAMETERS DESCRIPTION
warnings ---------- report any warning messages
accepts: any value (is either on or off)
delayout ---------- delay printing of diganostic messages
accepts: any value (is either on or off)
useful_errors ----- display detailed usage of erroring method
accepts: any value (is either on or off)
queries ----------- display DBI interface information
accepts: any value (is either on or off)
debug ------------- display debug information
accepts: any value (is either on or off)
destroys ---------- display destroyed objects
accepts: any value (is either on or off)
logging ----------- log warnings to file ('antbomb.log' in exec directory)
accepts: any value (is either on or off)
template_comments - display template names in HTML comments
accepts: any value (is either on or off)
NOTE: warnings will only go 50 'callers' back.
^ Example: WORKING warnings and delayout
BEGIN {
use ANTBOMB2;
use vars qw($A);
$A=ANTBOMB2->new();
$A->DIAGNOSTICS
(
warnings=>'Yes',
delayout=>'Yes'
);
}
use strict;
my $b;
print '$b: ',$b,$/;
$b='1';
print '$b: ',$b,$/;
undef $b;
print '$b: ',$b,$/;
exit;
OUTPUT:
$b:
$b: 1
$b:
<!-- ANTBOMB WARNINGS -->
<!--
Use of uninitialized value in print at temp.cgi line 15.
from temp.cgi line 15.
main::ANTBOMB2::warning
-->
<!--
Use of uninitialized value in print at temp.cgi line 19.
from temp.cgi line 19.
main::ANTBOMB2::warning
-->
^ Example: WORKING warnings
BEGIN {
use ANTBOMB2;
use vars qw($A);
$A=ANTBOMB2->new();
$A->DIAGNOSTICS
(
warnings=>'Yes'
);
}
use strict;
my $b;
print '$b: ',$b,$/;
$b='1';
print '$b: ',$b,$/;
undef $b;
print '$b: ',$b,$/;
exit;
OUTPUT:
$b: Use of uninitialized value in print at temp.cgi line 14.
from temp.cgi line 14.
main::ANTBOMB2::warning
$b: 1
$b: Use of uninitialized value in print at temp.cgi line 18.
from temp.cgi line 18.
main::ANTBOMB2::warning
^ Example: WORKING queries and delayout
BEGIN {
use ANTBOMB2;
use vars qw($A);
$A=ANTBOMB2->new();
$A->DIAGNOSTICS
(
delayout=>'Yes',
queries=>'Yes'
);
}
use strict;
$A->DBI(mode=>'handle',type=>'mysql',name=>'mysql');
$A->DBI(mode=>'select',query=>q~SELECT * FROM user WHERE user='root'~);
$A->QUERY_TEMP
(mode=>'load',string=>q~SELECT * FROM user WHERE password=''~);
for(@{$A->DBI(mode=>'select',query=>$A->QUERY_TEMP())}) {
print join(',',@$_),$/;
}
$A->QUERY_TEMP(mode=>'load',string=>'SELECT * FROM user',);
for(@{$A->DBI(mode=>'select',query=>$A->QUERY_TEMP())}) {
print join(',',@$_),$/;
}
exit;
OUTPUT:
localhost,root,34873ac155770284,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y
%,root,34873ac155770284,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y
%,antbomb,34873ac155770284,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,N,Y,Y,Y
localhost,antbomb,34873ac155770284,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,N,Y,Y,Y
localhost,antbomb2,34873ac155770284,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,N,Y,Y,Y
%,antbomb2,34873ac155770284,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,N,Y,Y,Y
localhost,antbomb3,34873ac155770284,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,N,Y,Y,Y
%,antbomb3,34873ac155770284,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,N,Y,Y,Y
<!-- DATABASE ACTIVITES -->
<!--
********* SELECT ********** 1
No template used
SELECT * FROM user WHERE user='root'
Returned Rows: 2
-->
<!--
********* SELECT ********** 2
String: SELECT * FROM user WHERE password=''
SELECT * FROM user WHERE password=''
Returned Rows: None
-->
<!--
********* SELECT ********** 3
String: SELECT * FROM user
SELECT * FROM user
Returned Rows: 8
-->
^ ENV PARAMETERS
DESCRIPTION:
Manipulate environment hash parameters
USAGE:
$A->e(LIST) or $A->environment_hash(LIST)
PARAMETERS:
$A->p(a,b);
a: key -> name of parameter to return (accepts wild card *)
accepts: any value
b: value -> value to set key(a) parameter to
accepts: any value
^ Example: store list of paramaters
my @parameters=$A->e();
OUTPUT:
N/A - Returns an array of all parameters in use
^ Example: store single parameter
my $path=$A->e('PATH');
OUTPUT:
N/A - Returns parameter value of key 'PATH' & stores it in $path
^ Example: print single parameter
print $A->e('PATH');
OUTPUT:
C:\Perl\bin\;
^ Example: store list of parameters with wildcard
my @path=$A->e('PATH*');
OUTPUT:
N/A - Returns parameter value of keys that have'PATH' in them
& stores them in @path
^ Example: print list of parameters with wildcard
print $A->e('PATH*');
OUTPUT:
CLASSPATH - "C:\Program Files\JavaSoft\JRE\1.3\lib\ext\QTJava.zip"
HOMEPATH - \
OS2LIBPATH - C:\WINNT\system32\os2\dll;
PATH - C:\Perl\bin\;
PATHEXT - .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
^ FILE MANIPULATION
DESCRIPTION:
Manipulate files, directories, and simple flat file databases
^ Directory
DESCRIPTION:
Read files from directory (ignoring . and ..)
USAGE:
$A->DIRECTORY(HASH)
PARAMETERS DESCRIPTION
mode ---- report any warning messages
accepts: NULL (''), create, delete
dir ----- path to location of directory
accepts: any string
perms --- display detailed usage of erroring method
accepts: octal number (Defaults to '0755')
^ Example: store referenced list of directory contents
my $dir=$A->DIRECTORY(dir=>'./');
OUTPUT:
N/A - returns a referenced array of all objects in the current directory
and stores them in $dir.
^ Example: print list of directory contents
print join($/,sort @{$A->DIRECTORY(dir=>'./')});
OUTPUT:
ANTBOMB_FILE1
AntBomb1
AntBomb2
antbomb_log
modules
status.cgi
status_qry
status_ses
status_tmp
test.cgi
^ Example: create directory with explicit permissions
$A->DIRECTORY(dir=>'./antbomb/',mode=>'create',perms=>'0744');
OUTPUT:
N/A - creates directory antbomb in the current working directory that
the owner has full rights to, but every one else can only read
from.
^ Example: delete directory recursively
my $dir=$A->DIRECTORY(dir=>'./antbomb/',mode=>'delete');
OUTPUT:
N/A - deletes the directory antbomb in the current working directory.
WARNING: This IS a RECURSIVE delete, be carful with this one!!!!
WARNING: This IS a RECURSIVE delete, be carful with this one!!!!
WARNING: This IS a RECURSIVE delete, be carful with this one!!!!
^ Find files recursively
DESCRIPTION:
Read directories as referenced array, files as referenced hash of arrays
(hashed with directories), and fails as array, recursively from directory.
Will match only files/directories when match is passed. Also returns some
counts:
TOTAL
TOTAL_DIRECTORY
TOTAL_FILE
TOTAL_MATCHED
TOTAL_NON_MATCHED
USAGE:
$A->FIND(HASH)
PARAMETERS DESCRIPTION
dir ----- path to location of directory
accepts: any string
match --- string to match file names (case sensative)
accepts: any string
tick ---- outputs symbol (+ for matched, - for not) for
every file and directory it parses, followed by the count for
every 100, so you can see something is happening from the
command line
accepts: NULL ('') or something (is on or off)
NOTE: This can be fairly memory intensive, so use with caution if
you are running on a shared server with memory limits when
you are not using a match.
^ Example: store list of files with match and printing them
my $files=$A->FIND(dir=>'.',match=>'A');
for(sort keys %$files) {
print ' ',$_,$/,' ',join($/.' ',sort @{$files->{$_}}),$/;
}
OUTPUT:
./
ANTBOMB_FILE1
AntBomb1
AntBomb2
./modules/
Administration.pm
./modules/empty_folder/
---NO MATCH---
./status_qry/
---NO MATCH---
./status_ses/
---NO MATCH---
./status_tmp/
---NO MATCH---
^ Example: store list of files and printing them
my $files=$A->FIND(dir=>'.');
for(sort keys %$files) {
print ' ',$_,$/,' ',join($/.' ',sort @{$files->{$_}}),$/;
}
OUTPUT:
./
ANTBOMB_FILE1
AntBomb1
AntBomb2
antbomb_log
status.cgi
test.cgi
./modules/
Administration.pm
Projects.pm
./modules/empty_folder/
---EMPTY---
./status_qry/
check_user1.qry
./status_ses/
1074344840.127.0.0.1.49344
./status_tmp/
home1.tmp
^ Example: list counts
my $C=q~C:/Documents and Settings/Shawn McKinley/My Documents/My Music/~;
my $files=$A->FIND(dir=>$C,tick=>1,match=>'mp3$');
print $/,'Total Items: ',$files->{TOTAL};
print $/,'Total Directories: ',$files->{'TOTAL_DIRECTORY'};
print $/,'Total Files: ',$files->{'TOTAL_FILE'};
print $/,'Total Matches: ',$files->{'TOTAL_MATCHED'};
print $/,'Total Non-Matches: ',$files->{'TOTAL_NON_MATCHED'};
OUTPUT:
Total Items: 55881
Total Directories: 3545
Total Files: 52336
Total Matches: 6027
Total Non-Matches: 46309
^ File
DESCRIPTION:
Append, read, and write files to disk
USAGE:
$A->FILE(HASH)
PARAMETERS DESCRIPTION
file ---- path to location of file
accepts: any string
mode ---- type of action to perform
accepts:
a ---- append ab --- append binary
ha --- append handle hab -- append handle binary
a+ --- open/create and update
r ---- read rb --- read binary
hr --- read handle hrb -- read handle binary
ras -- read as string rasb - read as string binary
r+ --- open and update
w ---- write wb --- write binary
hw --- write handle hwb -- write handle binary
w+ --- create and truncate
cl --- count lines fl --- first line
d ---- delete
data ---- data to save
accepts: any string
NOTE: This can be fairly memory intensive, so use with caution if
you are running on a shared server with memory limits when
loading in large files.
^ Example: append data to file
$A->FILE(file=>'ant.txt',mode=>'a',data=>$bomb);
OUTPUT:
N/A - Appends the contents of $bomb to the end of file ant.txt.
^ Example: store file as referenced list
my $ant=$A->FILE(file=>'ant.txt',mode=>'r');
OUTPUT:
N/A - Stores a referenced array of the file ant.txt in $ant
NOTE:
To use this, you could do something similar to this:
my $count=0;
my $file='ant.txt';
my $data=$A->FILE(file=>$file,mode=>'r');
for(@{$data}) {
print "Line $count in $file is: $_\n";
$count++;
}
^ Example: store file as string
my $ant=$A->FILE(file=>'ant.txt',mode=>'ras');
OUTPUT:
N/A - Stores file ant.txt in $ant
^ Example: print file as string raw
print $A->FILE(file=>$file,mode=>'ras');
OUTPUT:
print entire file $file
^ Example: print file as string removing all new lines
my $data=$A->FILE(file=>$file,mode=>'ras');
$data=~s/\n//g;
print $data;
OUTPUT:
print entire file $data with no new lines
^ Example: write data to file
$A->FILE(file=>'ant.txt',mode=>'w',data=>$bomb);
OUTPUT:
N/A - Writes the contents of $bomb to file ant.txt, over writing any
existing data in the file ant.txt
^ Example: write binary data to file
$A->FILE(file=>'ant.txt',mode=>'wb',data=>$bomb);
OUTPUT:
N/A - Writes the contents of $bomb to file ant.txt in binary format,
over writing any existing data in the file ant.txt
^ Example: delete file
$A->FILE(file=>'ant.txt',mode=>'d');
OUTPUT:
N/A - deletes file ant.txt (same as unlink)
^ Example: store first line of file
my $first_line=$A->FILE(file=>'ant.txt',mode=>'fl');
OUTPUT:
N/A - Stores first line of file ant.txt in $first_line
^ Example: store count of lines in file
my $count=$A->FILE(file=>'ant.txt',mode=>'cl');
OUTPUT:
N/A - Stores the number of lines of file ant.txt in $count
^ Flat File Database Hash
DESCRIPTION:
Read in an ANTBOMB formatted flat file database
NOTE:
ANTBOMB flat file database format:
00: Unique_ID|Field_1|Field_2|Field_3|Field_4|...
01: 001|Ant|Bomb|Foo|Bar|...
02: 101|More|Data|In|Here|..
The first line must contain your column names and each record
must end with a new line character. The delimiter ('|' or pipe
in this case) is assignable (see below).
USAGE:
$A->FLAT_DBH(HASH);
PARAMETERS DESCRIPTION
file ------ path to location of file
accepts: any string
mode ------ type of action to perform
accepts: r (read), w (write)
data ------ string to match file names (case sensative)
accepts: any string
delimiter - the delimiter of the flat file db
accepts: any string (defaults to '|')
NOTE: This can be fairly memory intensive, so use with caution if
you are running on a shared server with memory limits when
loading in large files.
^ Example: store referenced hash of db
my $parts=$A->dbh(file=>'parts.db',mode=>'r');
OUTPUT:
N/A - Returns a hash reference to the parts.db file.
^ Example: print db and print stored referenced hash
print $A->FILE(file=>'parts.db',mode=>'ras'),$/;
my $parts=$A->dbh(file=>'parts.db',mode=>'r');
for(sort keys %{$parts}) {
for my $part (sort keys %{$parts->{$_}}) {
print "Key: $_ Item: $part Value: $parts->{$_}{$part}\n";
}
}
OUTPUT:
ID|NAME|STORE|PART|QUANTITY|PRICE
1|Radiator|213|20B87|23|69.99
2|Steering Wheel|213|SW8978|2|39.95
Key: 1 Item: ID Value: 1
Key: 1 Item: NAME Value: Radiator
Key: 1 Item: PART Value: 20B87
Key: 1 Item: PRICE Value: 69.99
Key: 1 Item: QUANTITY Value: 23
Key: 1 Item: STORE Value: 213
Key: 2 Item: ID Value: 2
Key: 2 Item: NAME Value: Steering Wheel
Key: 2 Item: PART Value: SW8978
Key: 2 Item: PRICE Value: 39.95
Key: 2 Item: QUANTITY Value: 2
Key: 2 Item: STORE Value: 213
^ Example: print db, store it, change db, save it, print out new db
print $A->FILE(file=>'parts.db',mode=>'ras'),$/;
my $parts=$A->dbh(file=>'parts.db',mode=>'r');
$parts->{'2'}{'PRICE'}=49.95;
$A->FLAT_DBH(file=>'parts.db',mode=>'w',data=>$parts);
print $A->FILE(file=>'parts.db',mode=>'ras');
OUTPUT:
ID|NAME|STORE|PART|QUANTITY|PRICE
1|Radiator|213|20B87|23|69.99
2|Steering Wheel|213|SW8978|2|39.95
^^^^^
ID|NAME|STORE|PART|QUANTITY|PRICE
1|Radiator|213|20B87|23|69.99
2|Steering Wheel|213|SW8978|2|49.95
^^^^^
^ Match Database Hash
DESCRIPTION:
Match Record in an ANTBOMB formatted flat file database. This is
here to save time and resources. Instead of reading the entire
file into memory and saving it to a hash, mdbh reads in the file
a single line at a time and exits out as soon as it finds the
record you are looking for.
USAGE:
$A->FLAT_DBHM(HASH)
PARAMETERS DESCRIPTION
file ------ path to location of file
accepts: any string
id -------- column number or heading to match
accepts: any string
NOTE: if this is a numeric value with nothing else,
it will be assumed to be the column number
match ----- data to match against
accepts: any string
delimiter - the delimiter of the flat file db
accepts: any string (defaults to '|')
^ Example: store referenced hash to single matched record
my $part=$A->FLAT_DBHM(file=>'parts.db',id=>'1',match=>'Radiator');
OUTPUT:
N/A - Returns a hash reference to the SINGLE record that matches
^ Example: print db, print stored single matched record
print $A->FILE(file=>'parts.db',mode=>'ras'),$/,$/;
my $part=$A->FLAT_DBHM(file=>'parts.db',id=>'1',match=>'Radiator');
for(sort keys %$part) {
print $_,': ',$part->{$_},$/;
}
OUTPUT:
ID|NAME|STORE|PART|QUANTITY|PRICE
1|Radiator|213|20B87|23|69.99
2|Steering Wheel|213|SW8978|2|49.95
ID: 1
NAME: Radiator
PART: 20B87
PRICE: 69.99
QUANTITY: 23
STORE: 213
^ HTML
^ HTML list of allowed parameters for HTML elements
PARAMETER DESCRIPTION
name -------- document-wide identifier - Attribute names current anchor
so it may be destination of another link. Value must be
unique anchor name. Scope of name is current document.
Note: attribute shares name space with id attribute
accepts any string
id ---------- document-wide identifier - Attribute ids current anchor so
it may be destination of another link. Value must be unique
anchor id. Scope of id is current document. Note: attribute
shares name space with name attribute
accepts any string
class ------- document-wide identifier - Assigns class name or set of
class names to element. Any number of elements may be
assigned the same class name or names. Multiple class names
must be separated by white space characters
accepts any string
lang -------- language information
accepts:
- en (English)
- en-US (U.S. version of English)
- en-cockney (Cockney version of English)
- fr (French)
- de (German)
- it (Italian)
- nl (Dutch)
- el (Greek)
- es (Spanish)
- pt (Portuguese)
- ar (Arabic)
- he (Hebrew)
- ru (Russian)
- zh (Chinese)
- ja (Japanese)
- hi (Hindi)
- ur (Urdu)
- sa (Sanskrit)
- i-navajo (Navajo language of some Native Americans)
- x-klingon (Tag "x" indicates experimental language)
dir --------- text direction
accepts: LTR and RTL
title ------- element title
style ------- inline style information
shape ------- image map - Specifies the shape of a region. Possible values:
accepts:
- default (entire region)
- rect (rectangular region)
- circle (circular region)
- poly (polygonal region)
coords ------ image map - Specifies the position and shape on the screen.
The number and order of values depends on the shape being
defined.
accepts:
- rect (left-x, top-y, right-x, bottom-y)
- circle (center-x, center-y, radius)
Note: When the radius value is a percentage value,
user agents should calculate the final radius value
based on the associated object's width and height.
The radius should be the smaller value of the two.
- poly (x1, y1, x2, y2, ..., xN, yN)
Note: The first x and y coordinate pair and the last
should be the same to close the polygon. When these
coordinate values are not the same, user agents
should infer an additional coordinate pair to close
the polygon.
onfocus ----- intrinsic event (script) - Occurs when element receives
focus either by mouse button click or tabbing. This
attribute applies to the following elements: A, AREA,
and LABEL.
onblur ------ intrinsic event (script) - Occurs when element looses
focus either by mouse button click or tabbing
onclick ----- intrinsic event (script) - Occurs when mouse button
clicked over element
ondblclick -- intrinsic event (script) - Occurs when mouse button
double clicked over element
onmousedown - intrinsic event (script) - Occurs when mouse button
pressed over element
onmouseup --- intrinsic event (script) - Occurs when mouse button
released over element
onmouseover - intrinsic event (script) - Occurs when mouse moved onto
element
onmousemove - intrinsic event (script) - Occurs when mouse moved over
element
onmouseout -- intrinsic event (script) - Occurs when mouse moved off
element
onkeypress -- intrinsic event (script) - Occurs when key pressed and
released over element
onkeydown --- intrinsic event (script) - Occurs when key pressed
over element
onkeyup ----- intrinsic event (script) - Occurs when key released
over element
target ------ target frame information - The name of a frame where a
document is to be opened.
tabindex ---- tabbing navigation - The position of the current element in
the tabbing order for the current document. This value must
be a number between 0 and 32767. User agents should ignore
leading zeros
accesskey --- accesskeys - A single character from the document character
set. Note. Authors should consider the input method of the
expected reader when specifying an accesskey.
^ HTML Crumble
DESCRIPTION:
Adds random comments of random size to each line of page
that starts with white space followed by '<'.
USAGE:
$A->HTML_CRUMBLE(HASH)
PARAMETERS DESCRIPTION
data ------ text to mutilate
accepts: any string
^ Example: add noise to HTML
my $page="
<html>
<head>
<title>ant</title>
</head>
<body>
bomb
</body>
</html>";
print $A->HTML_CRUMBLE(data=>$page);
OUTPUT:
<!--Y\S/!7,*f!([!VA7gfeP:IK*-->
<html>
<!--P6@V%%+--> <head>
<!--k_#kD#2[kTM--> <title>ant</title>
<!--H)6d-9MZQZY.S--> </head>
<!--E"C;$N,BG--> <body>
bomb
<!--#'--> </body>
<!--h_0JVAdTR!.#H,bL8jC];H1!--> </html>
^ HTML Crush
DESCRIPTION:
Checks for any two consecutive white space characters and
eliminates one of them (including space, tab, new lines, etc).
Then eliminates any white space between '>' and '<' followed
by standard html syntax.
NOTE: Will not work with most in-line javascript. Move them
to a .js link before using crush on page.
USAGE:
$A->HTML_CRUSH(HASH)
PARAMETERS DESCRIPTION
data ------ text to remove white space
accepts: any string
^ Example: remove white space from HTML
my $page="
<html>
<head>
<title>ant</title>
</head>
<body>
bomb
</body>
</html>";
print $A->HTML_CRUSH(data=>$page);
OUTPUT:
<html><head><title>ant</title></head><body>bomb</body></html>
^ HTML Encode
DESCRIPTION:
Encodes page into javascript encoding.
NOTE:
Viewing browser will need javascript enabled to view this page.
Also, if no mode is included, the length of each unescape is
random based on the size of the page and the time it is called
(you may never get the same page twice);
USAGE: $A->HTML_ENCODE(HASH)
PARAMETERS DESCRIPTION
data ------ text to convert to javascript
accepts: any string
mode ------ type of conversion (one large string or chunks)
accepts: any (is either on or off)
^ Example: encode HTML to javascript document.write statments random length
my $page="
<html>
<head>
<title>ant</title>
</head>
<body>
bomb
</body>
</html>";
print $A->HTML_ENCODE(data=>$page);
OUTPUT:
<script><!--
document.write(unescape("%0a%20%20%20%20%20"));document.write(unescape("
%20%20%20%20%20%20"));document.write(unescape("%20%3c%68%74%6d%6c"));doc
ument.write(unescape("%3e%0a%20%20%20%20"));document.write(unescape("%20
%20%20%20%20%20"));document.write(unescape("%20%20%20%20%3c%68"));docume
nt.write(unescape("%65%61%64%3e%0a%20"));document.write(unescape("%20%20
%20%20%20%20"));document.write(unescape("%20%20%20%20%20%20"));document.
write(unescape("%20%20%20%3c%74%69"));document.write(unescape("%74%6c%65
%3e%61%6e"));document.write(unescape("%74%3c%2f%74%69%74"));document.wri
te(unescape("%6c%65%3e%0a%20%20"));document.write(unescape("%20%20%20%20
%20%20"));document.write(unescape("%20%20%20%20%20%20"));document.write(
unescape("%3c%2f%68%65%61%64"));document.write(unescape("%3e%0a%20%20%20
%20"));document.write(unescape("%20%20%20%20%20%20"));document.write(une
scape("%20%20%20%20%3c%62"));document.write(unescape("%6f%64%79%3e%0a%20
"));document.write(unescape("%20%20%20%20%20%20"));document.write(unesca
pe("%20%20%20%20%20%20"));document.write(unescape("%20%20%20%62%6f%6d"))
;document.write(unescape("%62%0a%20%20%20%20"));document.write(unescape(
"%20%20%20%20%20%20"));document.write(unescape("%20%20%20%20%3c%2f"));do
cument.write(unescape("%62%6f%64%79%3e%0a"));document.write(unescape("%2
0%20%20%20%20%20"));document.write(unescape("%20%20%20%20%20%20"));docum
ent.write(unescape("%3c%2f%68%74%6d%6c"));document.write(unescape("%3e")
);//--></script>
NOTE:
Newlines added for space considerations
^ Example: encode HTML to javascript document.write statments fixed length
my $page="
<html>
<head>
<title>ant</title>
</head>
<body>
bomb
</body>
</html>";
print $A->HTML_ENCODE(data=>$page,mode=>'raw');
OUTPUT:
<script><!--\ndocument.write(unescape("%0a%20%20%20%20%20%20%20%20%20%20
%20%20%3c%68%74%6d%6c%3e%0a%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3c
%68%65%61%64%3e%0a%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3c%74
%69%74%6c%65%3e%61%6e%74%3c%2f%74%69%74%6c%65%3e%0a%20%20%20%20%20%20%20
%20%20%20%20%20%20%20%3c%2f%68%65%61%64%3e%0a%20%20%20%20%20%20%20%20%20
%20%20%20%20%20%3c%62%6f%64%79%3e%0a%20%20%20%20%20%20%20%20%20%20%20%20
%20%20%20%20%62%6f%6d%62%0a%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3c
%2f%62%6f%64%79%3e%0a%20%20%20%20%20%20%20%20%20%20%20%20%3c%2f%68%74%6d
%6c%3e"));\n//--></script>
NOTE:
Newlines added for space considerations
^ HTML Decode
DESCRIPTION:
Decodes javascript encrypted page into html
USAGE:
$A->HTML_DECODE(HASH)
PARAMETERS DESCRIPTION
data ------ text to convert to javascript
accepts: any string
^ Example: decode javascript document.write()n HTML
my $page="<script><!--
document.write(unescape("%0a%20%20%20%20%20"));document.write(unescape("
%20%20%20%20%20%20"));document.write(unescape("%20%3c%68%74%6d%6c"));doc
ument.write(unescape("%3e%0a%20%20%20%20"));document.write(unescape("%20
%20%20%20%20%20"));document.write(unescape("%20%20%20%20%3c%68"));docume
nt.write(unescape("%65%61%64%3e%0a%20"));document.write(unescape("%20%20
%20%20%20%20"));document.write(unescape("%20%20%20%20%20%20"));document.
write(unescape("%20%20%20%3c%74%69"));document.write(unescape("%74%6c%65
%3e%61%6e"));document.write(unescape("%74%3c%2f%74%69%74"));document.wri
te(unescape("%6c%65%3e%0a%20%20"));document.write(unescape("%20%20%20%20
%20%20"));document.write(unescape("%20%20%20%20%20%20"));document.write(
unescape("%3c%2f%68%65%61%64"));document.write(unescape("%3e%0a%20%20%20
%20"));document.write(unescape("%20%20%20%20%20%20"));document.write(une
scape("%20%20%20%20%3c%62"));document.write(unescape("%6f%64%79%3e%0a%20
"));document.write(unescape("%20%20%20%20%20%20"));document.write(unesca
pe("%20%20%20%20%20%20"));document.write(unescape("%20%20%20%62%6f%6d"))
;document.write(unescape("%62%0a%20%20%20%20"));document.write(unescape(
"%20%20%20%20%20%20"));document.write(unescape("%20%20%20%20%3c%2f"));do
cument.write(unescape("%62%6f%64%79%3e%0a"));document.write(unescape("%2
0%20%20%20%20%20"));document.write(unescape("%20%20%20%20%20%20"));docum
ent.write(unescape("%3c%2f%68%74%6d%6c"));document.write(unescape("%3e")
);//--></script>";
print $A->HTML_DECODE(data=>$page);
OUTPUT:
<html>
<head>
<title>ant</title>
</head>
<body>
bomb
</body>
</html>
NOTE:
Newlines added for space considerations
^ HTML Fetch
DESCRIPTION:
Grab an html page from a specified URL
NOTE:
Well need to have LWP::UserAgent installed and configured
properly for proper operation
USAGE:
$A->HTML_FETCH(HASH)
PARAMETERS DESCRIPTION
url ------- absolute URL
accepts: any string
method ---- method to retrive URL with
accepts: get, post, head (defaults to get) (case insensative)
agent ----- name of agent to anounce to distant server
accepts: any string (defaults to 'ANTBOMB2 '.$VERSION)
timeout --- number of seconds before fetch gives up
accepts: any number (defaults to 25)
^ Example: retrieve & print URL with return codes & sent & recieved header
my($html,$codes,$header)=$A->HTML_FETCH(url=>'http://www.perlhelp.com');
print 'Page',$/,('-'x25),$/;
print 'Fetched HTML would go here...',$/,$/; # $html
print 'Return Codes',$/,('-'x25),$/;
for(sort keys %$codes) {
if(!ref($codes->{$_})) {
printf '%25s: %s'.$/,$_,$codes->{$_};
} else {
printf '%25s:'.$/,$_;
for(@{$codes->{$_}}) {
printf '%25s %-25s'.$/,'',$_;
}
}
}
print 'Headers',$/,('-'x25),$/;
for(sort keys %$header) {
if(!ref($header->{$_})) {
printf '%25s: %s'.$/,$_,$header->{$_};
} else {
printf '%25s:'.$/,$_;
for(@{$header->{$_}}) {
printf '%25s %-25s'.$/,'',$_;
}
}
}
OUTPUT:
Page
-------------------------
Fetched HTML would go here...
Return Codes
-------------------------
code: 200
message: OK
request:
GET http://www.perlhelp.com
User-Agent: ANTBOMB2 2.001
size: 3.46 KB
Headers
-------------------------
client-date: Fri, 23 Jan 2004 11:41:39 GMT
client-peer: 161.58.151.175:80
client-response-num: 1
client-transfer-encoding: chunked
connection: close
content-type:
text/html
text/html;charset=iso-8859-1
date: Fri, 23 Jan 2004 11:42:13 GMT
server: Apache/1.3.27 OpenSSL/0.9.6 (Unix)
title: Perl Help
^ Example: retrieve & print URL with return codes & sent header (error)
my($html,$codes,$header)=$A->HTML_FETCH(url=>'http://www.perlhell.com');
print 'Page',$/,('-'x25),$/;
print 'Fetched HTML would go here...',$/,$/; # $html
print 'Return Codes',$/,('-'x25),$/;
for(sort keys %$codes) {
if(!ref($codes->{$_})) {
printf '%25s: %s'.$/,$_,$codes->{$_};
} else {
printf '%25s:'.$/,$_;
for(@{$codes->{$_}}) {
printf '%25s %-25s'.$/,'',$_;
}
}
}
print 'Headers',$/,('-'x25),$/;
for(sort keys %$header) {
if(!ref($header->{$_})) {
printf '%25s: %s'.$/,$_,$header->{$_};
} else {
printf '%25s:'.$/,$_;
for(@{$header->{$_}}) {
printf '%25s %-25s'.$/,'',$_;
}
}
}
OUTPUT:
Page
-------------------------
Fetched HTML would go here...
Return Codes
-------------------------
code: 500
message: Can't connect to www.perlhell.com:80
(Bad hostname 'www.perlhell.com')
request:
GET http://www.perlhell.com
User-Agent: ANTBOMB2 2.001
size: 0 B
Headers
-------------------------
NOTE:
Newline added for 'Return Codes' message for space considerations
^ HTML Size
DESCRIPTION:
Size of HTML page
USAGE:
$A->HTML_SIZE(HASH)
PARAMETERS DESCRIPTION
data ------ html page
accepts: any string
mode ------ output format
accepts: NULL (''), raw
^ Example: print HTML page size in bytes
my $page="<html><head><title>ant</title></head><body>bomb</body></html>";
print $A->HTML_SIZE(data=>$page);
OUTPUT:
61 B
^ Example: print HTML page size in raw bytes
my $page="<html><head><title>ant</title></head><body>bomb</body></html>";
print $A->HTML_SIZE(data=>$page,mode=>'raw');
OUTPUT:
61
^ HTML Footer
DESCRIPTION:
End an html page
USAGE:
$A->END_HTML(HASH)
PARAMETERS DESCRIPTION
script ------ inline script
accepts: string, ref array, or ref hash
script_link - linked script
accepts: string, ref array, or ref hash
NOTE: See HTML Header for more info
^ Example: print HTML footer
print $A->END_HTML();
OUTPUT:
</body>
</html>
^ Example: print HTML footer with ending script(s)
print $A->END_HTML( script_link => '/source.js' );
OUTPUT:
<script src="/source.js" language="JavaScript"></script>
</body>
</html>
^ HTML Anchor
DESCRIPTION:
End an html page
USAGE:
$A->END_ANCHOR(HASH)
PARAMETERS DESCRIPTION
href -------- link destination
accepts any string
anchor ------ contents to be anchored
accepts any string
name -------- name of anchor
accepts any string
id ---------- id of anchor
accepts any string
class ------- class of anchor
accepts any string
lang -------- language information
accepts: see HTML list of allowed parameters
dir --------- text direction
accepts: LTR and RTL
title ------- element title
accepts any string
style ------- inline style information
accepts any string
shape ------- image map shape
accepts: see HTML list of allowed parameters
coords ------ image map coordinates
accepts: see HTML list of allowed parameters
onfocus ----- intrinsic event (script)
accepts any string
onblur ------ intrinsic event (script)
accepts any string
onclick ----- intrinsic event (script)
accepts any string
ondblclick -- intrinsic event (script)
accepts any string
onmousedown - intrinsic event (script)
accepts any string
onmouseup --- intrinsic event (script)
accepts any string
onmouseover - intrinsic event (script)
accepts any string
onmousemove - intrinsic event (script)
accepts any string
onmouseout -- intrinsic event (script)
accepts any string
onkeypress -- intrinsic event (script)
accepts any string
onkeydown --- intrinsic event (script)
accepts any string
onkeyup ----- intrinsic event (script)
accepts any string
target ------ target frame
accepts any string
tabindex ---- tabbing navigation
accepts 0 through 32767
accesskey --- accesskeys
accepts any string
^ Example: print HTML Anchor
print $A->END_HTML();
OUTPUT:
</body>
</html>
^ HTML Header
DESCRIPTION:
Start an html page
USAGE:
$A->START_HTML(HASH)
PARAMETERS DESCRIPTION
http-equiv -- http-equiv attribute hash
accepts: any key, value pairs
meta -------- meta tag attribute hash
accepts: any key, value pairs
title ------- title of page
accepts: any string (defaults to name of script)
script ------ inline script
accepts: string, ref array, or ref hash
script_link - linked script
accepts: string, ref array, or ref hash
style ------- inline style sheet
accepts: string, ref array, or ref hash
style_link -- linked style sheet
accepts: string, ref array, or ref hash
frameset ---- frame set
accepts: any string
body -------- body attribute hash
accepts:
BACK GROUND background => URL, bgproperties => properties,
COLORS bgcolor => HHHHHH, text => HHHHHH,
link => HHHHHH, vlink => HHHHHH,
alink => HHHHHH,
PAGE ATTRIBS font => font properties,
hover => hover properties,
JAVASCRIPT ATTRIBS onload => func, onunload => fun,
onfocus => func, onblur => fun
^ Example: print basic HTML header
print $A->START_HTML();
OUTPUT:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<title>test.cgi - No Title</title>
</head>
<body>
^ Example: print advanced HTML header without script
print $A->START_HTML
(
title => 'test',
'http-equiv' =>
{
Pragma => 'no-cache'
},
meta =>
{
keywords => 'antbomb2, perl, html, etc',
description => 'Web API for Perl programmers.'
},
body =>
{
bgcolor => 'FFFFFF',
text => '000000',
link => '008000',
alink => '008800',
vlink => '008800'
}
);
OUTPUT:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN
"http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Pragma" content="no-cache">
<meta name="keywords" content="antbomb2, perl, html, etc">
<meta name="description" content="Web API for Perl programmers.">
<title>test</title>
</head>
<body link="#008000" vlink="#008800" alink="#008800" bgcolor="#FFFFFF"
text="#000000">
NOTE:
Newline added for '<body' line for space considerations
NOTE:
The http-equiv hash key MUST be quoted.
^ Example: print advanced HTML header with single script
print $A->START_HTML
(
title => 'test',
'http-equiv' =>
{
Pragma => 'no-cache'
},
meta =>
{
keywords => 'antbomb2, perl, html, etc',
description => 'Web API for Perl programmers.'
},
script_link => '/sources/js.js',
body =>
{
bgcolor => 'FFFFFF',
text => '000000',
link => '008000',
alink => '008800',
vlink => '008800'
}
);
OUTPUT:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN
"http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Pragma" content="no-cache">
<meta name="keywords" content="antbomb2, perl, html, etc">
<meta name="description" content="Web API for Perl programmers.">
<script src="/sources/js.js" language="JavaScript"></script>
<title>test</title>
</head>
<body link="#008000" vlink="#008800" alink="#008800" bgcolor="#FFFFFF"
text="#000000">
NOTE:
Newline added for '<body' line for space considerations
NOTE:
The http-equiv hash key MUST be quoted.
^ Example: print advanced HTML header with multiple scripts
print $A->START_HTML
(
title => 'test',
'http-equiv' =>
{
Pragma => 'no-cache'
},
meta =>
{
keywords => 'antbomb2, perl, html, etc',
description => 'Web API for Perl programmers.'
},
script_link => ['/sources/js1.js','/sources/js2.js'],
body =>
{
bgcolor => 'FFFFFF',
text => '000000',
link => '008000',
alink => '008800',
vlink => '008800'
}
);
OUTPUT:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN
"http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Pragma" content="no-cache">
<meta name="keywords" content="antbomb2, perl, html, etc">
<meta name="description" content="Web API for Perl programmers.">
<script src="/sources/js1.js" language="JavaScript"></script>
<script src="/sources/js2.js" language="JavaScript"></script>
<title>test</title>
</head>
<body link="#008000" vlink="#008800" alink="#008800" bgcolor="#FFFFFF"
text="#000000">
NOTE:
Newline added for '<body' line for space considerations
NOTE:
The http-equiv hash key MUST be quoted.
^ Example: print advanced HTML header with multiple languages and scripts
print $A->START_HTML
(
title => 'test',
'http-equiv' =>
{
Pragma => 'no-cache'
},
meta =>
{
keywords => 'antbomb2, perl, html, etc',
description => 'Web API for Perl programmers.'
},
script_link =>
{
JavaScript => ['/sources/js1.js','/sources/js2.js'],
'JavaScript1.2' => '/sources/js1.2.js'
}
body =>
{
bgcolor => 'FFFFFF',
text => '000000',
link => '008000',
alink => '008800',
vlink => '008800'
}
);
OUTPUT:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN
"http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Pragma" content="no-cache">
<meta name="keywords" content="antbomb2, perl, html, etc">
<meta name="description" content="Web API for Perl programmers.">
<script src="/sources/js1.2.js" language="JavaScript1.2"></script>
<script src="/sources/js1.js" language="JavaScript"></script>
<script src="/sources/js2.js" language="JavaScript"></script>
<title>test</title>
</head>
<body link="#008000" vlink="#008800" alink="#008800" bgcolor="#FFFFFF"
text="#000000">
NOTE:
Newline added for '<body' line for space considerations
NOTE:
The http-equiv hash key MUST be quoted.
^ HTML pre
DESCRIPTION:
Adds pre-formatted tag for an html page, and converts all '<' and '>'
to > and < unless plain is called
USAGE:
$A->PRE(HASH)
PARAMETERS DESCRIPTION
data ------ text
accepts: any string
mode ------ output format (plain will not convert '<' and '>')
accepts: NULL (''), plain
^ Example: print HTML data with pre tags
print $A-PRE(data=>'<antbomb>');
OUTPUT:
<pre><antbomb></pre>
^ Example: print HTML data with pre tags w/o converting the < and >
print $A->PRE(data=>'<antbomb>',mode=>'plain');
OUTPUT:
<pre><antbomb></pre>
^ HTML JAVASCRIPT
^ JavaScript Tool Tips (by Walter Zorn)
DESCRIPTION:
A cross-browser Tooltip JavaScript to create tooltips. These crossbrowser
JavaScript Tooltips and their behavior can be customized in multiple
ways, and may contain plain text as well as HTML, such as images or
line breaks etc.
This Tooltip JavaScript even works in Opera 5 and 6. Each of the html
tags to create a tooltip requires an onmouseover-attribute only,
onmouseouts are unnecessary. To customize these JavaScript tooltips
individually, there are several commands available that may be inserted
into the onmouseovers.
Have a look at the demonstration and documentation at
http://www.walterzorn.com/tooltip/tooltip_e.htm
Supported browsers (according to Wanter Zorn's site)
Linux: Konqueror 3,
Browsers with Gecko-Engine (Mozilla, Netscape 6, Galeon),
Netscape 4 and 6,
Opera 5 and 6.
Windows: Netscape 4, 6 and 7,
Browsers with Gecko-Engine (Mozilla, Netscape 6, Galeon),
IE 4, 5.0, 5.5 and 6.0,
Opera 5,6,7.
USAGE:
$A->JS_TOOLTIPS(HASH)
PARAMETERS DESCRIPTION
background_color -- Background color of tooltips
accepts: six characters of this set a-f, A-F, and 0-9
default: #E6ECFF
background_image -- Background image of tooltips
accepts: any string
default: NULL
border_color ------ Border color of tooltips
accepts: six characters of this set a-f, A-F, and 0-9
default: #003399
font_color -------- Font color of tooltips
accepts: six characters of this set a-f, A-F, and 0-9
default: #000066
font_face --------- Font face / family of tooltips
accepts: any string
default: arial, helvetica, sans-serif
font_size --------- Font size + unit of tooltips (eg: 11px)
accepts: any string
default: 11px
font_weight ------- Font weight of tooltips ('normal' or 'bold')
accepts: any string
default: normal
shadow_color ------ Tooltip shadow color
accepts: any string
default: NULL
title_color ------- Color of tooltip title text
accepts: six characters of this set a-f, A-F, and 0-9
default: #FFFFFF
border_width ------ Width of tooltip border (pixels)
accepts: positive integer or zero
default: 1
mouseover_delay --- Tooltip shows up after specified timeout (milliseconds)
accepts: positive integer or zero
default: 500
horizontal_offset - Horizontal offset from mouse-pointer of tooltips
accepts: positive or negative integer or zero
default: 8
vertical_offset --- Vertical offset from mouse-pointer of tooltips
accepts: positive or negative integer or zero
default: 19
tooltip_padding --- Inner spacing of tooltips (between border & content)
accepts: positive integer or zero
default: 3
shadow_width ------ Tooltip shadow width
accepts: positive integer or zero
default: 0
disappear_delay --- Time span before tooltip disappears (milliseconds)
accepts: positive integer or zero
default: 0
tooltip_width ----- Width of tooltip (pixels)
accepts: positive integer or zero
default: 300
NOTE:
This script must be AT THE END of your tool tips in your HTML code,
so you must either insert this in the bottom of the page yourself or
use this in the END_HTML tag like so:
print $A->START_HTML(
script_link => '/sources/antbomb.js',
title => 'ANTBOMB JavaScript ToolTips Example'
),
$A->HTML_TEMP(),
$A->END_HTML(
script =>
$A->JS_TOOLTIPS(
background_color => '800000',
border_color => '800000',
font_color => 'FFFFFF',
mouseover_delay => 1,
horizontal_offset => 16,
vertical_offset => -12,
shadow_width => 3,
tooltip_width => 200,
tooltip_padding => 2
),
);
^ Example: print JavaScript Tool Tips
print $A->JS_TOOLTIPS(
background_color => '800000',
border_color => '800000',
font_color => 'FFFFFF',
mouseover_delay => 1,
horizontal_offset => 16,
vertical_offset => -12,
shadow_width => 3,
tooltip_width => 100,
tooltip_padding => 2
);
OUTPUT:
<script language="JavaScript" type="text/javascript">
...
var ttBgColor = "#800000";
var ttBgImg = "";
var ttBorderColor = "#800000";
var ttBorderWidth =
var ttDelay = 1;
var ttFontColor = "#FFFFFF";
var ttFontFace = "arial,helvetica,sans-serif";
var ttFontSize = "11px";
var ttFontWeight = "normal";
var ttOffsetX = 16;
var ttOffsetY = -12;
var ttPadding = 2;
var ttShadowColor = "";
var ttShadowWidth = 3;
var ttTemp = 0;
var ttTitleColor = "#ffffff";
var ttWidth = 100;
...
</script>
NOTE:
Only the dynamic portion is shown here. See the file
HTML_TOOLTIPS.txt for a full listing of the JavaScript source
^ Individual JavaScript Tool Tip Creation
DESCRIPTION:
Create individual Tool Tips ( must use with JS_TOOLTIPS ) to be inserted
into some anchor tag in an HTML page.
USAGE:
$A->JS_TOOLTIP_TIP(HASH)
PARAMETERS DESCRIPTION
background_color -- Background color of tooltips
accepts: six characters of this set a-f, A-F, and 0-9
default: #E6ECFF
background_image -- Background image of tooltips
accepts: any string
default: NULL
border_color ------ Border color of tooltips
accepts: six characters of this set a-f, A-F, and 0-9
default: #003399
font_color -------- Font color of tooltips
accepts: six characters of this set a-f, A-F, and 0-9
default: #000066
font_face --------- Font face / family of tooltips
accepts: any string
default: arial, helvetica, sans-serif
font_size --------- Font size + unit of tooltips (eg: 11px)
accepts: any string
default: 11px
font_weight ------- Font weight of tooltips ('normal' or 'bold')
accepts: any string
default: normal
shadow_color ------ Tooltip shadow color
accepts: any string
default: NULL
title_color ------- Color of tooltip title text
accepts: six characters of this set a-f, A-F, and 0-9
default: #FFFFFF
border_width ------ Width of tooltip border (pixels)
accepts: positive integer or zero
default: 1
mouseover_delay --- Tooltip shows up after specified timeout (milliseconds)
accepts: positive integer or zero
default: 500
horizontal_offset - Horizontal offset from mouse-pointer of tooltips
accepts: positive or negative integer or zero
default: 8
vertical_offset --- Vertical offset from mouse-pointer of tooltips
accepts: positive or negative integer or zero
default: 19
tooltip_padding --- Inner spacing of tooltips (between border & content)
accepts: positive integer or zero
default: 3
shadow_width ------ Tooltip shadow width
accepts: positive integer or zero
default: 0
disappear_delay --- Time span before tooltip disappears (milliseconds)
accepts: positive integer or zero
default: 0
tooltip_width ----- Width of tooltip (pixels)
accepts: positive integer or zero
default: 300
tip_above --------- Places the tooltip above the mouse-pointer
accepts: any value (is either on or off)
default: NULL
fixed_position ---- Set tooltip to coordinates in referenced arrays
accepts: '[' +
positive or negative integer or zero +
',' +
positive or negative integer or zero +
']'
default: NULL
position_left ----- Places the tooltip to the left of mouse-pointer
accepts: any value (is either on or off)
default: NULL
static_tooltip ---- Tooltip doesn't follow movements of mouse-pointer
accepts: any value (is either on or off)
default: NULL
sticky_tooltip ---- Tooltip stays fixed on it's initial position
accepts: any value (is either on or off)
default: NULL
tooltip_title ----- Tooltip Title
accepts: any value
default: NULL
tip --------------- Tooltip to be displayed
accepts: any value
default: NULL
^ Example: print Individual JavaScript Tool Tip
print $A->JS_TOOLTIP_TIP(
tip => 'ANTBOMB Test',
fixed_position => [100,100]
);
OUTPUT:
this.T_FIX = [100,100]; return escape('ANTBOMB Test');
^ Example: print Individual JavaScript Tool Tip in an anchor tag
print $A->HTML_ANCHOR(
href => 'javascript:void(0);',
onmouseover =>
$A->JS_TOOLTIP_TIP(
tip => 'ANTBOMB Test',
fixed_position => [100,100]
),
onclick => 'show_hide(text1,1);',
anchor =>
$A->HTML_IMAGE(
src => '/sources/ANTBOMB_Test.gif',
border => 0
)
);
OUTPUT:
<a
href="javascript:void(0);"
onclick="show_hide(text1,1);"
onmouseover="this.T_FIX = [100,100];
return escape('ANTBOMB Test');"
><img src="/sources/ANTBOMB_Test.gif" border="0"></a>
NOTE:
New lines added for readability
^ HTML FORMS
^ Full list of allowed parameters for FORM elements
^ W3C element legend
Name Type (value) Description
-------------------------------------------------------------------------------
accept %ContentTypes; -- Specifies a comma-separated list of content
types that a server processing this form will
handle correctly. User agents may use this
information to filter out non-conforming files
when prompting a user to select files to be
sent to the server for "file".
accept-charset %Charsets; -- list of supported charsets
accesskey %Character; -- Assigns an access key to an element. An access
key is a single character from the document
character set.
alt CDATA -- Specifies alternate text. The language of the
alternate text is specified by the lang
attribute.
checked (checked) -- Specifies that the button is on for "radio"
or "checkbox".
class CDATA -- Assigns a class name or set of class names to
an element. Any number of elements may be
assigned the same class name or names.
Multiple class names must be separated by
white space characters.
dir (ltr|rtl) -- Specifies the base direction of directionally
neutral text (i.e., text that doesn't have
inherent directionality as defined in
[UNICODE]) in an element's content and
attribute values. It also specifies the
directionality of tables. Possible values:
LTR: Left-to-right text or table.
RTL: Right-to-left text or table.
disabled (disabled) -- When set for a form control, this boolean
attribute disables the control for user input.
Used with "BUTTON", "OPTGROUP", "OPTION",
"INPUT", and "SELECT".
id ID -- Assigns a name to an element. This name must
be unique in a document.
ismap (ismap) -- use server-side image map
lang %LanguageCode; -- Specifies the base language of an element's
attribute values and text content. The default
value of this attribute is unknown.
maxlength NUMBER -- Specifies the maximum number of characters the
user may enter. The default value for this
attribute is an unlimited number.
name CDATA -- Assigns the control name
onblur %Script; -- the element lost the focus
onchange %Script; -- the element value was changed
onclick %Script; -- a pointer button was clicked
ondblclick %Script; -- a pointer button was double clicked
onfocus %Script; -- the element got the focus
onkeydown %Script; -- a key was pressed down
onkeypress %Script; -- a key was pressed and released
onkeyup %Script; -- a key was released
onmousedown %Script; -- a pointer button was pressed down
onmousemove %Script; -- a pointer was moved within
onmouseout %Script; -- a pointer was moved away
onmouseover %Script; -- a pointer was moved onto
onmouseup %Script; -- a pointer button was released
onselect %Script; -- some text was selected
readonly (readonly) -- When set for a form control, this boolean
attribute prohibits changes to the control.
Used with "INPUT" and "TEXTAREA".
size CDATA -- Specifies the initial width of the control.
The width is given in pixels except for
"text" or "password". In that case, its value
refers to the number of characters.
src %URI; -- Specifies the location of the image to be used
to decorate the graphical submit button for
"image".
style %StyleSheet; -- Specifies style information for the current
element.
tabindex NUMBER -- Specifies the position of the current element
in the tabbing order for the current document.
This value must be a number between 0 and
32767.
title %Text; -- Offers advisory information about the element
for which it is set.
usemap %URI; -- Associates an image map with an element. The
image map is defined by a MAP element. The
value of usemap must match the value of the
name attribute of the associated MAP element.
value CDATA -- Specifies the initial value of the control.
It is optional except when the type attribute
has the value "radio" or "checkbox".
^ Element usage
Name Usage / Example
-------------------------------------------------------------------------------
accept => 'gif,jpg,jpeg,png'
accept-charset => 'US-ASCII, ISO646-US'
accesskey => 1..n
alt => 'Some alternate text tag'
checked => 1 (on or off)
class => 'Forms1 TickleDatabase'
dir => 'rtl'
disabled => 1 (on or off)
id => 1..n
ismap => 1 (on or off)
lang => 'en-US'
maxlength => 1..n
name => 'Any string'
onblur => 'Script Function Name'
onchange => 'Script Function Name'
onclick => 'Script Function Name'
ondblclick => 'Script Function Name'
onfocus => 'Script Function Name'
onkeydown => 'Script Function Name'
onkeypress => 'Script Function Name'
onkeyup => 'Script Function Name'
onmousedown => 'Script Function Name'
onmousemove => 'Script Function Name'
onmouseout => 'Script Function Name'
onmouseover => 'Script Function Name'
onmouseup => 'Script Function Name'
onselect => 'Script Function Name'
readonly => 1 (on or off)
size => 1..n
src => 'http://www.perlhelp.com/logo.gif'
style => 'Style sheet element'
tabindex => 1..n
title => 'Any string'
usemap => 'Existing map elsewhere in the document'
value => 'Any string'
^ Method allowed element list
^ START --- allowed hash elements
accept accept-charset action
class dir enctype
id lang method
name onreset onsubmit
style title
^ END --- allowed hash elements
None
^ RESET --- allowed hash elements
None
^ TEXT --- allowed hash elements
accesskey alt class
dir id lang
maxlength name onblur
onchange onclick ondblclick
onfocus onselect onkeydown
onkeypress onkeyup onmousedown
onmousemove onmouseout onmouseover
onmouseup readonly size
style tabindex title
value
^ PASSWORD --- allowed hash elements
accesskey alt class
dir id lang
maxlength name onblur
onchange onclick ondblclick
onfocus onselect onkeydown
onkeypress onkeyup onmousedown
onmousemove onmouseout onmouseover
onmouseup readonly size
style tabindex title
value
^ SUBMIT --- allowed hash elements
accesskey alt class
dir id lang
name onblur onchange
onclick ondblclick onfocus
onkeydown onkeypress onkeyup
onmousedown onmousemove onmouseout
onmouseover onmouseup onselect
style tabindex title
value
^ HIDDEN --- allowed hash elements
class id name
style title value
^ IMAGE --- allowed hash elements
accesskey alt class
dir id lang
name onblur onchange
onclick ondblclick onfocus
onkeydown onkeypress onkeyup
onmousedown onmousemove onmouseout
onmouseover onmouseup onselect
src style tabindex
title usemap value
^ BUTTON --- allowed hash elements
accesskey alt class
dir id lang
name onblur onchange
onclick ondblclick onfocus
onkeydown onkeypress onkeyup
onmousedown onmousemove onmouseout
onmouseover onmouseup onselect
style tabindex title
value
^ FILE --- allowed hash elements
accept accesskey alt
class dir id
lang name onblur
onchange onclick ondblclick
onfocus onkeydown onkeypress
onkeyup onmousedown onmousemove
onmouseout onmouseover onmouseup
onselect style tabindex
title value
^ TEXTAREA --- allowed hash elements
accesskey class cols
dir disabled id
lang name onblur
onchange onfocus onselect
readonly rows style
tabindex title value
^ CHECKBOX --- allowed hash elements
accesskey alt checked
class dir id
label lang name
onblur onchange onclick
ondblclick onfocus onselect
onkeydown onkeypress onkeyup
onmousedown onmousemove onmouseout
onmouseover onmouseup readonly
style tabindex title
value
^ RADIO --- allowed hash elements
accesskey alt checked
class dir id
label lang name
onblur onchange onclick
ondblclick onfocus onselect
onkeydown onkeypress onkeyup
onmousedown onmousemove onmouseout
onmouseover onmouseup readonly
style tabindex title
value
^ SELECT --- allowed hash elements
class dir id
lang multiple name
onblur onchange onfocus
size style tabindex
title
^ Start Form
DESCRIPTION:
Create a form element for an html page
USAGE:
$A->START_FORM(HASH)
PARAMETERS DESCRIPTION
action ---- name of script to act upon
accepts: any string
name ------ name of form
accepts: any string
method ---- how the form will be processed
accepts: get, post (defaults to post)
enctype --- encoding type
accepts:
application/x-www-form-urlencoded (default)
multipart/form-data
text/plain (depreciated at best)
^ Example: start form basic
print $A->START_FORM(action=>'script.pl');
OUTPUT:
<form action='script.pl' method="post"
enctype="application/x-www-form-urlencoded">
NOTE:
Newline added for space considerations
^ Example: start form advanced
print $A->START_FORM
(
action=>'script.pl',
name=>'ant',
method=>'get',
enctype=>'multipart/form-data'
);
OUTPUT:
<form action='script.pl' name="ant" method="get"
enctype="multipart/form-data">
NOTE:
Newline added for space considerations
^ End Form
DESCRIPTION:
Close the form tag of a form element for an html page
USAGE:
$A->END_FORM()
PARAMETERS DESCRIPTION
^ Example: end form
print $A->END_FORM();
OUTPUT:
</form>
^ Check Box
DESCRIPTION:
Create a form check box for an html page
USAGE:
$A->FORM_CHECKBOX(HASH)
PARAMETERS DESCRIPTION
name ------ name of check box form element
accepts: a-z,A-Z,0-9, ,_,- (anything else is dropped)
value ----- The value for the check box(s)
accepts: any string, referenced array or referenced hash
(defaults to 1)
label ----- The label for the check box
accepts: any value
checked --- Denotes wether the box is checked
accepts: string or referenced array
sort ------ determines if array values will be sorted (overides order)
accepts: any value (is either on or off)
order ----- determines sort order of values
accepts: referenced array
NOTE:
order array must correspond with the keys in the
referenced hash. This is used to get a list in
the order you want when passing a hash as the
list value.
^ Example: checkbox using ref hash for value with checked
print $A->FORM_CHECKBOX
(
name=>'Test',
value=>{1=>'ANT',2=>'BOMB',3=>'TEST'},
sort=>1,
checked=>[1,2],
spacing=>' '
);
OUTPUT:
<input type="checkbox" name="Test" value="1" checked>ANT
<input type="checkbox" name="Test" value="2" checked>BOMB
<input type="checkbox" name="Test" value="3">TEST
NOTE:
Newlines added for space considerations.
NOTE:
Because spacing was used, spaces will be used between each element
^ Example: checkbox with ref hash for value setting p() for checked
$A->p('Test',1); # Test is now set to 1
print $A->FORM_CHECKBOX
(
name=>'Test',
value=>{1=>'ANT',2=>'BOMB',3=>'TEST'},
sort=>1,
spacing=>' '
);
OUTPUT:
<input type="checkbox" name="Test" value="1" checked>ANT
<input type="checkbox" name="Test" value="2">BOMB
<input type="checkbox" name="Test" value="3">TEST
NOTE:
New lines added for readability
NOTE:
Because spacing was used, spaces will be used between each element
^ Example: checkbox with ref array for value setting p() for checked
$A->p('Test',['ANT','TEST']); # Test is now set to referenced array
print $A->FORM_CHECKBOX # of 'ANT' and 'TEST'
(
name=>'Test',
value=>['ANT','TEST','BOMB'],
sort=>1
);
OUTPUT:
<input type="checkbox" name="Test" value="ANT" checked>ANT
<input type="checkbox" name="Test" value="BOMB">BOMB
<input type="checkbox" name="Test" value="TEST" checked>TEST
NOTE:
New lines added for readability
NOTE:
Because spacing was NOT used, spaces will NOT be used between each element
^ Example: checkbox using ref hash for value ref array for order with checked
print $A->FORM_CHECKBOX
(
name=>'Test',
value=>{1=>'ANT',2=>'BOMB',3=>'TEST'},
order=>[2,3,1],
checked=>[1,3]
);
OUTPUT:
<input type="checkbox" name="Test" value="2">BOMB
<input type="checkbox" name="Test" value="3" checked>TEST
<input type="checkbox" name="Test" value="1" checked>ANT
NOTE:
New lines added for readability
NOTE:
Because spacing was NOT used, spaces will NOT be used between each element
^ Radio Button
DESCRIPTION:
Create a form radio button for an html page
USAGE:
$A->FORM_RADIO(HASH)
PARAMETERS DESCRIPTION
name ------ name of radio button form element
accepts: a-z,A-Z,0-9, ,_,- (anything else is dropped)
value ----- The value for the check box(s)
accepts: any string, referenced array or referenced hash
(defaults to 1)
label ----- The label for the check box
accepts: any value
checked --- Denotes wether the box is checked
accepts: string or referenced array
sort ------ determines if array values will be sorted (overides order)
accepts: any value (is either on or off)
order ----- determines sort order of values
accepts: referenced array
NOTE:
order array must correspond with the keys in the
referenced hash. This is used to get a list in
the order you want when passing a hash as the
list value.
^ Example: radio using ref hash for value with checked
print $A->FORM_RADIO
(
name=>'Test',
value=>{1=>'ANT',2=>'BOMB',3=>'TEST'},
sort=>1,
checked=>[1,2],
spacing=>' '
);
OUTPUT:
<input type="radio" name="Test" value="1" checked>ANT
<input type="radio" name="Test" value="2" checked>BOMB
<input type="radio" name="Test" value="3">TEST
NOTE:
Newlines added for space considerations.
NOTE:
Because spacing was used, spaces will be used between each element
^ Example: radio using ref hash for value setting p() for checked
$A->p('Test',1); # Test is now set to 1
print $A->FORM_RADIO
(
name=>'Test',
value=>{1=>'ANT',2=>'BOMB',3=>'TEST'},
sort=>1,
spacing=>' '
);
OUTPUT:
<input type="radio" name="Test" value="1" checked>ANT
<input type="radio" name="Test" value="2">BOMB
<input type="radio" name="Test" value="3">TEST
NOTE:
New lines added for readability
NOTE:
Because spacing was used, spaces will be used between each element
^ Example: radio using ref array for value and setting p() for checked
$A->p('Test',['ANT','TEST']); # Test is now set to referenced array
print $A->FORM_RADIO # of 'ANT' and 'TEST'
(
name=>'Test',
value=>['ANT','TEST','BOMB'],
sort=>1
);
OUTPUT:
<input type="radio" name="Test" value="ANT" checked>ANT
<input type="radio" name="Test" value="BOMB">BOMB
<input type="radio" name="Test" value="TEST" checked>TEST
NOTE:
New lines added for readability
NOTE:
Because spacing was NOT used, spaces will NOT be used between each element
^ Example: radio using ref hash for value ref array for order with checked
print $A->FORM_RADIO
(
name=>'Test',
value=>{1=>'ANT',2=>'BOMB',3=>'TEST'},
order=>[2,3,1],
checked=>[1,3]
);
OUTPUT:
<input type="radio" name="Test" value="2">BOMB
<input type="radio" name="Test" value="3" checked>TEST
<input type="radio" name="Test" value="1" checked>ANT
NOTE:
New lines added for readability
NOTE:
Because spacing was NOT used, spaces will NOT be used between each element
^ Input Select
DESCRIPTION:
Create a form selection for an html page
USAGE:
$A->FORM_SELECT(HASH)
PARAMETERS DESCRIPTION
name ------ name of select form element
accepts: a-z,A-Z,0-9, ,_,- (anything else is dropped)
size ------ size of display of select form element
accepts: 0-9 (anything else is dropped)
multiple -- make the select multiple selectable
accepts: any value (is either on or off)
options --- referenced array or hash
accepts: any referenced array or hash (ie. \@array or \%hash)
sort ------ determines if array values will be sorted (overides order)
accepts: any value (is either on or off)
order ----- determines sort order of values
accepts: referenced array
NOTE:
order array must correspond with the keys in the
referenced hash. This is used to get a list in
the order you want when passing a hash as the
list value.
^ Example: select using ref hash for value ref array for order
print $A->FORM_SELECT
(
name=>'Test2',
options=>{1=>'ANT',2=>'BOMB',3=>'TEST'},
order=>[2,3,1]
);
OUTPUT:
<select name="Test2">
<option value="2">BOMB</option>
<option value="3">TEST</option>
<option value="1">ANT</option>
</select>
NOTE:
New lines added for readability
^ Example: select using ref array for value and using sort
print $A->FORM_SELECT
(
name=>'Test2',
options=>['ANT','TEST','BOMB'],
sort=>1
);
OUTPUT:
<select name="Test2">
<option>ANT</option>
<option>BOMB</option>
<option>TEST</option>
</select>
NOTE:
New lines/indentions added for readability
^ Example: select using ref hash for value ref arry for order (real world)
my %hash=(
Select_One=>'Select One',line=>'-------------',
Cash=>'Cash',Check=>'Check',Charge=>'Customer Charge',
MasterCard=>'Master Card',Visa_card=>'Visa',
Discover_card=>'Discover'
);
my @array=
qw(
Select_One line
Cash Check line
Charge line
MasterCard Visa_card Discover_card
);
print $A->FORM_SELECT
(
name=>'Test2',
size=>5,
multiple=>1,
options=>\%hash,
order=>\@array
);
OUTPUT 3:
<select name="Test2" size="5" multiple>
<option value="Select_One">Select One</option>
<option value="line">-------------</option>
<option value="Cash">Cash</option>
<option value="Check">Check</option>
<option value="line">-------------</option>
<option value="Charge">Customer Charge</option>
<option value="line">-------------</option>
<option value="MasterCard">Master Card</option>
<option value="Visa_card">Visa</option>
<option value="Discover_card">Discover</option>
</select>
NOTE:
New lines/indentions added for readability
^ Input Text
DESCRIPTION:
Create a form text input for an html page
USAGE:
$A->FORM_TEXT(HASH)
PARAMETERS DESCRIPTION
name ------ name of text form element
accepts: a-z,A-Z,0-9, ,_,- (anything else is dropped)
size ------ size of display of text form element
accepts: 0-9 (anything else is dropped)
value ----- value of text form element
accepts: any value
maxlength - max number of characters the form input will accept
accepts: 0-9 (anything else is dropped)
^ Example: text
print $A->FORM_TEXT(name=>'ant',size=>5,value=>'bomb',maxlength=>5);
OUTPUT:
<input type="text" name="ant" value="bomb" size="5" maxlength="5">
^ Input Password Text
DESCRIPTION:
Create a form text input (password) for an html page
USAGE:
$A->FORM_PASSWORD(HASH)
PARAMETERS DESCRIPTION
name ------ name of passowrd form element
accepts: a-z,A-Z,0-9, ,_,- (anything else is dropped)
size ------ size of display of passowrd form element
accepts: 0-9 (anything else is dropped)
value ----- value of passowrd form element
accepts: any value
maxlength - max number of characters the form input will accept
accepts: 0-9 (anything else is dropped)
^ Example: password
print $A->FORM_PASSWORD(name=>'ant',size=>5,value=>'bomb',maxlength=>5);
OUTPUT:
<input type="password" name="ant" value="bomb" size="5" maxlength="5">
^ Input Hidden
DESCRIPTION:
Create a form text hidden for an html page
USAGE:
$A->FORM_HIDDEN(HASH)
PARAMETERS DESCRIPTION
name ------ name of hidden form element
accepts: a-z,A-Z,0-9, ,_,- (anything else is dropped)
value ----- value of hidden form element
accepts: any value
^ Example: hidden
print $A->FORM_HIDDEN(name=>'ant',value=>'bomb');
OUTPUT:
<input type="hidden" name="ant" value="bomb">
^ Text Area
DESCRIPTION:
Create a form text area for an html page
USAGE:
$A->FORM_TEXTAREA(HASH)
PARAMETERS DESCRIPTION
name ------ name of textarea form element
accepts: a-z,A-Z,0-9, ,_,- (anything else is dropped)
value ----- value of textarea form element
accepts: any value
rows ------ number of rows long
accepts: 0-9 (anything else is dropped)
cols ------ number of columns wide
accepts: 0-9 (anything else is dropped)
^ Example: textarea
$A->p('antbomb','Test textarea...');
print $A->FORM_TEXTAREA(name=>'antbomb',rows=>5,cols=>40);
OUTPUT:
<textarea name="antbomb" rows="5" cols="40">Test textarea...</textarea>
^ Submit Button
DESCRIPTION:
Create a submit button for an html page
USAGE:
$A->FORM_SUBMIT(HASH)
PARAMETERS DESCRIPTION
name ------ name of submit form element
accepts: a-z,A-Z,0-9, ,_,- (anything else is dropped)
value ----- value of submit form element
accepts: any value
^ Example: submit button
print $A->FORM_SUBMIT(name=>'ant',value=>'bomb');
OUTPUT:
<input type="submit" name="ant" value="bomb">
^ Upload File
DESCRIPTION:
Create a submit button for an html page
USAGE:
$A->FORM_UPLOAD(HASH)
PARAMETERS DESCRIPTION
accept ---- allowable file types to be uploaded
accepts: any value
name ------ name of submit form element
accepts: a-z,A-Z,0-9, ,_,- (anything else is dropped)
value ----- value of submit form element
accepts: any value
^ Example: upload file simple
print $A->FORM_UPLOAD(name=>'ant');
OUTPUT:
<input type="upload" name="ant">
^ Example: upload file advanced
print $A->FORM_UPLOAD(name=>'ant',lang=>'en-US',accept=>'gif,jpg');
OUTPUT:
<input type="upload" name="ant" lang="en-US" accept="gif,jpg">
^ Formatted Date Drop Down
DESCRIPTION:
Formatted date drop down (select form)
USAGE:
$A->FORM_FDD(HASH)
PARAMETERS DESCRIPTION
year ------ number of years to appear on drop down
accepts: positive integer
epoch ----- epoch seconds of when the drop down is to start
accepts: any value
NOTE:
if epoch is starts with '+', epoch will be added to
current epoch seconds
NOTE:
if $A->p('date') is set, it is used if epoch is not passed
mon_name -- form name for month select
accepts: a-z,A-Z,0-9, ,_,- (anything else is dropped)
day_name -- form name for day select
accepts: a-z,A-Z,0-9, ,_,- (anything else is dropped)
year_name - form name for year select
accepts: a-z,A-Z,0-9, ,_,- (anything else is dropped)
^ Example: basic formatted date drop down
print $A->FORM_FDD();
OUTPUT:
<select name="mon">
<option value="1" selected>Jan</option>
<option value="2">Feb</option>
...
<option value="12">Dec</option>
</select>
<select name="day">
<option>1</option>
...
<option>22</option>
<option selected>23</option>
<option>24</option>
...
<option>31</option>
</select>
<select name="year">
<option>2001</option>
<option>2002</option>
<option selected>2003</option>
<option>2004</option>
<option>2005</option>
</select>
NOTE:
New lines added for readability. Some self evident lines replaced
with ... to save on the size of this document.
^ Example: advanced formatted date drop down for AD times
print $A->FORM_FDD
(
year=>3,
epoch=>$A->EPOCH_TIME
(
seconds => 0,
minutes => 30,
hours => 2,
day => 18,
month => 3,
year => 1970
)
);
OUTPUT:
<select name="mon">
<option value="1">Jan</option>
<option value="2">Feb</option>
<option value="3" selected>Mar</option>
<option value="4">Apr</option>
...
<option value="12">Dec</option>
</select>
<select name="day">
<option>1</option>
...
<option>17</option>
<option selected>18</option>
<option>19</option>
...
<option>31</option>
</select>
<select name="year">
<option>1968</option>
<option>1969</option>
<option selected>1970</option>
<option>1971</option>
<option>1972</option>
</select>
NOTE:
New lines added for readability. Some self evident lines replaced
with ... to save on the size of this document.
^ Example: advanced formatted date drop down for BC times
my $epoch=$A->EPOCH_TIME
(
seconds => 0,
minutes => 30,
hours => 2,
day => 18,
month => 9,
year => 0
);
print $A->FORM_FDD
(
year=>5,
epoch=>$epoch,
mon_name=>'start_mon',
day_name=>'start_day',
year_name=>'start_year'
);
OUTPUT:
<select name="start_mon">
<option value="1">Jan</option>
...
<option value="8">Aug</option>
<option value="9" selected>Sep</option>
<option value="10">Oct</option>
...
<option value="12">Dec</option>
</select>
<select name="start_day">
<option>1</option>
...
<option>17</option>
<option selected>18</option>
<option>19</option>
...
<option>31</option>
</select>
<select name="start_year">
<option>3 BC</option>
<option>2 BC</option>
<option selected>1 BC</option>
<option>1 AD</option>
<option>2 AD</option>
</select>
NOTE:
New lines added for readability. Some self evident lines replaced
with ... to save on the size of this document.
^ Formatted Time Drop Down
DESCRIPTION:
Formatted time drop down (select form)
USAGE:
$A->FORM_FTD(HASH)
PARAMETERS DESCRIPTION
epoch ----- epoch seconds of when the drop down is to start
accepts: any value
NOTE:
if epoch is starts with '+', epoch will be added to
current epoch seconds
NOTE:
if $A->p('date') is set, it is used if epoch is not passed
sec_name -- form name for second select
accepts: a-z,A-Z,0-9, ,_,- (anything else is dropped)
min_name -- form name for minute select
accepts: a-z,A-Z,0-9, ,_,- (anything else is dropped)
hour_name - form name for hour select
accepts: a-z,A-Z,0-9, ,_,- (anything else is dropped)
no_secs --- omit seconds from output
accepts: any value (is either on or off)
interval -- number of minutes to increment on
accepts: 0-9 (anything else is dropped)
start ----- hour to start hours with
accepts: 0-23 (anything else is dropped)
end ------- hour to end hours with
accepts: 0-23 (anything else is dropped)
^ Example: basic formated time drop down
my $epoch=$A->EPOCH_TIME
(
seconds => 0,
minutes => 30,
hours => 2,
day => 18,
month => 9,
year => 1970
);
print $A->FORM_FTD(epoch=>$epoch);
OUTPUT:
<select name="hour">
<option value="0">12 AM</option>
...
<option value="13">1 PM</option>
<option value="14" selected>2 PM</option>
<option value="15">3 PM</option>
...
<option value="23">11 PM</option>
</select>
<select name="min">
<option>0</option>
..
<option>31</option>
<option selected>32</option>
<option>33</option>
...
<option>59</option>
</select>
<select name="sec">
<option value="0">00</option>
...
<option value="39">39</option>
<option value="40" selected>40</option>
<option value="41">41</option>
...
<option value="59">59</option>
</select>
NOTE:
New lines added for readability. Some self evident lines replaced
with ... to save on the size of this document.
^ Example: advanced formatted time drop down
my $epoch=$A->EPOCH_TIME
(
seconds => 0,
minutes => 30,
hours => 2,
day => 18,
month => 9,
year => 1970
);
print $A->FORM_FTD
(
epoch=>$epoch,
no_secs=>1,
interval=>15,
start=>8,
end=>20,
min_name=>'start_minute',
hour_name=>'start_hour',
);
OUTPUT 2:
<select name="start_hour">
<option value="8">8 AM</option>
<option value="9">9 AM</option>
<option value="10">10 AM</option>
<option value="11">11 AM</option>
<option value="12">12 PM</option>
<option value="13">1 PM</option>
<option value="14" selected>2 PM</option>
<option value="15">3 PM</option>
<option value="16">4 PM</option>
<option value="17">5 PM</option>
<option value="18">6 PM</option>
<optionvalue="19">7 PM</option>
<option value="20">8 PM</option>
</select>
<select name="start_minute">
<option>0</option>
<option>15</option>
<option>30</option>
<option>45</option>
</select>
^ Formatted Date Time Drop Down
DESCRIPTION:
Formatted date time drop down (select form)
USAGE:
$A->FORM_FDTD(HASH)
PARAMETERS DESCRIPTION
epoch -------- epoch seconds of when the drop down is to start
accepts: any value
NOTE:
if epoch is starts with '+', epoch will be added to
current epoch seconds
NOTE:
if $A->p('date') is set, it is used if epoch is not passed
year --------- number of years to appear on drop down
accepts: positive integer
mon_name ----- form name for month select (defaults to 'mon')
accepts: a-z,A-Z,0-9, ,_,- (anything else is dropped)
day_name ----- form name for day select (defaults to 'day')
accepts: a-z,A-Z,0-9, ,_,- (anything else is dropped)
year_name ---- form name for year select (defaults to 'year')
accepts: a-z,A-Z,0-9, ,_,- (anything else is dropped)
sec_name ----- form name for second select (defaults to 'sec')
accepts: a-z,A-Z,0-9, ,_,- (anything else is dropped)
min_name ----- form name for minute select (defaults to 'min')
accepts: a-z,A-Z,0-9, ,_,- (anything else is dropped)
hour_name ---- form name for hour select (defaults to 'hour')
accepts: a-z,A-Z,0-9, ,_,- (anything else is dropped)
no_secs ------ omit seconds from output
accepts: any value (is either on or off)
interval ----- number of minutes to increment on
accepts: 0-9 (anything else is dropped)
start -------- hour to start hours with
accepts: 0-23 (anything else is dropped)
end ---------- hour to end hours with
accepts: 0-23 (anything else is dropped)
date_heading - Text label for date line
accepts: any value
time_heading - Text label for time line
accepts: any value
multi_line --- Create HTML (and text) line break
accepts: any value (is either on or off)
prefix ------- pre-pending name to start all default names with. if more
than one call is made to FORM_FDTD with the same pre_name
(or none at all), the subsequent labels will be pre-pended
with a numeric label followed by an underscore starting at
2 (2_mon, 3_mon, 4_mon or 2_start_mon, 3_start_mon, etc)
accepts: a-z,A-Z,0-9, ,_,-
Example:
passed prefix parameter:
prefix => 'start'
resulting parameter names:
year -> 'start_year'
mon -> 'start_mon'
day -> 'start_day'
hour -> 'start_hour'
min -> 'start_min'
sec -> 'start_sec'
^ Example: basic formated date time drop down
my $epoch=$A->EPOCH_TIME
(
seconds => 0,
minutes => 30,
hours => 2,
day => 18,
month => 9,
year => 1970,
prefix => 'start'
);
print $A->FORM_FDTD(epoch=>$epoch);
OUTPUT:
<select name="start_mon">
<option value="1">Jan</option>
...
<option value="3" selected>Mar</option>
...
<option value="12">Dec</option>
</select>
<select name="start_day">
<option>1</option>
...
<option selected>18</option>
...
<option>31</option>
</select>
<select name="start_year">
<option>1968</option>
...
<option selected>1970</option>
...
<option>1972</option>
</select>
<select name="start_hour">
<option value="0">12 AM</option>
...
<option value="14" selected>2 PM</option>
...
<option value="23">11 PM</option>
</select>
<select name="start_min">
<option>0</option>
..
<option selected>32</option>
...
<option>59</option>
</select>
<select name="start_sec">
<option value="0">00</option>
...
<option value="40" selected>40</option>
...
<option value="59">59</option>
</select>
NOTE:
New lines added for readability. Some self evident lines replaced
with ... to save on the size of this document.
^ Example: advanced formatted date time drop down
my $epoch=$A->EPOCH_TIME
(
seconds => 0,
minutes => 30,
hours => 2,
day => 18,
month => 9,
year => 1970
);
print $A->FORM_FDTD
(
mon_name=>'start_month',
day_name=>'start_day',
year_name=>'start_year',
sec_name=>'start_second',
min_name=>'start_minute',
hour_name=>'start_hour',
epoch=>$epoch,
no_secs=>1,
interval=>15,
start=>8,
end=>20,
date_heading=>'Date:',
time_heading=>'Time:',
multi_line=>1
);
OUTPUT 2:
Date:
<select name="start_month">
<option value="1">Jan</option>
...
<option value="3" selected>Mar</option>
...
<option value="12">Dec</option>
</select>
<select name="start_day">
<option>1</option>
...
<option selected>18</option>
...
<option>31</option>
</select>
<select name="start_year">
<option>1968</option>
...
<option selected>1970</option>
...
<option>1972</option>
</select>
<br>
Time:
<select name="start_hour">
<option value="0">12 AM</option>
...
<option value="14" selected>2 PM</option>
...
<option value="23">11 PM</option>
</select>
<select name="start_minute">
<option>0</option>
<option>15</option>
<option selected>30</option>
<option>45</option>
</select>
^ HTTP
^ Full list of allowed parameters for each HTTP elements
Name Type Description
-------------------------------------------------------------------------------
Accept Request Specifies which Internet media types are
acceptable for the response and to assign
preferences to them.
Accept-Charset Request Specifies which character encodings
(confusingly called "charsets") are
acceptable for the response and to assign
preferences to them.
Accept-Encoding Request Specifies which data format tranformations,
confusingly called content (en)codings, such
as compression mechanisms, are acceptable
for the response and to assign preferences
to them.
Accept-Language Request Specifies which natural languages are
acceptable for the response and to assign
preferences to them. Useful for language
negotation.
Accept-Ranges Response Indicates the server's acceptance of range
requests for a resource.
Age Response Gives the sender's estimate of the amount
of time since the response (or its
revalidation) was generated at the origin
server.
Allow Entity Lists the set of methods supported by the
resource identified by the Request-URI. The
purpose is to inform the recipient of valid
methods associated with the resource.
Authorization Request Consists of credentials containing the
authentication information of the client for
the realm of the resource being requested
Cache-Control General Specifies directives that must be obeyed by
all caching mechanisms along the
request/response chain.
Connection General Specifies options that are desired for the
particular connection and must not be
communicated by proxies over further
connections.
Content-Encoding Entity Used as a modifier to the media-type, to
indicate what additional data format
transformations such as compression have
been applied to the entity-body.
Content-Language Entity Specifies the natural language(s) of the
intended audience for the enclosed entity.
Content-Length Entity Indicates the size (in octets) of the
entity-body that is sent or that would have
been sent if it has reen requested.
Content-Location Entity Supplies the resource location for the
entity enclosed in the message when that
entity is accessible from a location
separate from the requested resource's URI.
Content-MD5 Entity An MD5 digest of the entity-body for the
purpose of providing an end-to-end message
integrity check (MIC) of the entity-body.
Content-Range Entity Sent with a partial entity-body to specify
where in the full entity-body the partial
body should be applied.
Content-Type Entity Specifies the Internet media types of the
entity-body that is sent or would have been
sent if requested. Often includes a charset
parameter specifying the character encoding.
Date General Date and time at which the message was
originated.
ETag Response Provides the current value of the entity
tag for the requested variant, for caching
purposes.
Expect Request Indicates that particular server behaviors
are required by the client.
Expires Entity Gives the date/time after which the response
is considered stale, for caching purposes.
From Request The Internet e-mail address for the human
user who controls the requesting browser or
other client.
Host Request Specifies the Internet host and port number
of the resource being requested. Obligatory
in all HTTP/1.1 requests.
If-Match Request Used with a method to make it conditional:
a client that has previously obtained
entities can verify that one of those
entities is current by including a list of
their associated entity tags in the If-Match
header field.
If-Modified-Since Request Used with a method to make it conditional:
if the requested variant has not been
modified since the time specified in this
field, the server will not return the
entity but information about this fact.
If-None-Match Request Used with a method to make it conditional:
a client that has previously obtained
entities can verify that none of those
entities is current by including a list
of their associated entity tags in the
If-None-Match header field.
If-Range Request Used together with Range to say: "if the
entity is unchanged, send me the part(s)
that I am missing; otherwise, send me the
entire new entity".
If-Unmodified-Since Request Used with a method to make it conditional:
if the requested variant has been modified
since the time specified in this field, the
server will not perform the requested
operation but information about this fact.
Last-Modified Entity Indicates the date and time at which the
origin server believes the variant was last
modified.
Location Response Redirects the recipient to a location other
than the Request-URI for completion of the
request or identification of a new resource.
Max-Forwards Request Provides a mechanism with the TRACE and
OPTIONS methods to limit the number of
proxies or gateways that can forward the
request to the next inbound server.
Pragma General Used to include implementation-specific
directives that might (optionally) apply
to any recipient along the request/response
chain.
Proxy-Authenticate Response Included as part of a 407 (Proxy
Authentication Required) response. The field
value consists of a challenge that indicates
the authentication scheme and parameters
applicable to the proxy for this
Request-URI.
Proxy-Authorization Request Used by a client to identify itself (or its
user) to a proxy which requires
authentication.
Range Request Restricts the request to some part(s),
specified as range(s) of octets, in the
resource.
Referer Request Used by a client to specify, for the
server's benefit, the address (URI) of the
resource from which the Request-URI was
obtained.
Retry-After Response Indicates how long the service is expected
to be unavailable to the requesting client.
Server Response Contains information about the software
used by the origin server to handle the
request.
TE Request Indicates what extension transfer-codings
the client is willing to accept in the
response and whether or not it is willing
to accept trailer fields in a chunked
transfer-coding.
Trailer General Indicates that the given set of header
fields is present in the trailer of a
message encoded with chunked
transfer-coding.
Transfer-Encoding General Indicates what (if any) type of
transformation has been applied to the
message body in order to safely transfer
it between the sender and the recipient.
This differs from the Content-Encoding in
that the transfer-coding is a property of
the message, not of the entity.
Upgrade General Used by a client to specify what additional
communication protocols it supports and
would like to use if the server finds it
appropriate to switch protocols. The server
uses the Upgrade header to indicate which
protocol(s) are being switched.
User-Agent Request Contains information about the user agent
(client) originating the request
Vary Response Indicates the set of request-header fields
that fully determines, while the response
is fresh, whether a cache is permitted to
use the response to reply to a subsequent
request without revalidation.
Via General Used by gateways and proxies to indicate
the intermediate protocols and recipients
between the user agent and the server on
requests, and between the origin server
and the client on responses.
Warning General Carries additional information about the
status or transformation of a message
which might not be reflected in the message.
WWW-Authenticate Response Used in 401 (Unauthorized) response
messages. The field value consists of at
least one challenge that indicates the
authentication scheme(s) and parameters
applicable to the Request-URI.
^ HTTP Header
DESCRIPTION:
Output an HTTP header.
USAGE:
$A->START_HTTP(HASH)
PARAMETERS DESCRIPTION
see 'Full list of allowed parameters for each HTTP elements' for details
^ Example: no cache
print $A->START_HTTP('no-cache'=>1);
OUTPUT:
Cache-Control: no-cache
Cache-Control: max-age=0
Date: Sat, 19 Mar 2004 14:22:07 (+06 UT)
User-Agent: ANTBOMB V.2.001
Content-Type: text/html
NOTE: Content-Type will default to 'text/html' if none is specified
^ Example: gif image
print $A->START_HTTP('Content-type'=>'image/gif');
OUTPUT:
Date: Sat, 19 Mar 2004 14:24:55 (+06 UT)
User-Agent: ANTBOMB V.2.001
Content-Type: image/gif
^ MISC
^ Acceptable Characters
DESCRIPTION:
Returns acceptable characters. If no 'b' is passed, it is assumed that
usable characters for HTML forms are to be used. This will result in the
return string containing A-Z, a-z, 0-9, , - or _ (yes, these were what was
acceptable to the writers...). If 'file' is passed in 'b', it will also
include the period (.) and NOT accept spaces ( ) for file names.
USAGE:
$A->ACCEPT_CHARS(HASH)
PARAMETERS DESCRIPTION
data ------ string to be checked
accepts: any value
type ------ type of characters to accept
accepts: NULL (''), file
^ Example: accept form characters
$var="%28 my%20files+here.html %29";
print $A->accept_chars($var);
OUTPUT:
28 my20filesherehtml29
^ Example: accept file characters
$var="%28 my%20files+here.html %29";
print $A->accept_chars($var,'file');
OUTPUT 2:
28my20fileshere.html29
^ Counter
DESCRIPTION:
Open a passed file name, read in number, modify it, and save
it back to file. It will create the file if it does not exist.
USAGE:
$A->COUNTER(HASH)
PARAMETERS DESCRIPTION
file ------ file name
accepts: any string that contains A-Z, a-z, 0-9, _, or .
mode ------ type of action to perform
accepts: NULL (''), decrement
^ Example: increment counter file
print $A->COUNTER(file=>'index.count');
OUTPUT:
Number that was in index.count plus 1 or 1 if index.count did not exist
^ Example: decrement counter file
print $A->COUNTER(file=>'index.count',mode=>'decrement');
OUTPUT:
Number that was in index.count minus 1 or -1 if index.count did not exist
^ HTML String Cleaner
DESCRIPTION:
As well converting hex to decimal and '+' to ' ', it also pulls out possible
malicious code by eliminating anything that starts with <!-- -->, even if
it has new lines in it (but does not span the entire string, see the clean
sub routine for more)...
USAGE:
$A->CLEAN_HTML(HASH)
PARAMETERS DESCRIPTION
data ------ string to be checked
accepts: any value
^ Example: convert web encodings to ASCII
$var="%28 my%20files+here.html %29";
print $A->CLEAN_HTML(data=>$var);
OUTPUT:
( my files here.html )
^ IP
DESCRIPTION:
Returns current users IP. It checks the %ENV hash for:
REMOTE_ADDR
REMOTE_HOST
SSH_CLIENT
REMOTEHOST
USAGE:
$A->IP(HASH)
PARAMETERS DESCRIPTION
ip -------- ip to be set
accepts: any value
^ Example: set and print IP
print $A->IP();
OUTPUT:
192.168.0.1
^ Example: print IP (will not set since IP already called)
print $A->IP();
OUTPUT:
192.168.0.1
NOTE:
If ip has previously been called returns the currently set users IP
^ Example: set IP
$A->IP(ip=>'192.168.0.1');
OUTPUT:
N/A - will set internal IP to 192.168.0.1
^ Random Number Generator
DESCRIPTION:
Generate a random number
USAGE:
$A->RAND(HASH);
PARAMETERS DESCRIPTION
num ------- max of random number generated
accepts: any positive integer (defaults to 10)
^ Example: print random number 1-10000
print $A->Rand(num=>10000);
OUTPUT:
2368
^ Example: print random number 1-10
print $A->Rand();
OUTPUT:
7
NOTE:
Returns a number between 1 and 10
^ Random Alpha Numeric String Generator
DESCRIPTION:
Generate a random alpha numeric string from 1 to 25 characters
Note:
1 (one), l (lower case L), 0 (zero), and O (upper case o) are
omitted to prevent confusion.
USAGE:
$A->RANDA(HASH)
PARAMETERS DESCRIPTION
num ------- length of random string generated
accepts: any positive integer (defaults to 10)
^ Example: print random alpha numeric string 10 characters long
print $A->RANDA();
OUTPUT:
FvFuPNEegK
^ Example: print random alpha numeric string 25 characters long
print $A->RANDA(num=>25);
OUTPUT:
2npxyjxIMWMwUWk2XAHZycwe2
^ Encode Base 64
DESCRIPTION:
Encode data string into base 64
USAGE:
$A->ENCODE_64(HASH)
PARAMETERS DESCRIPTION
data ------ data to convert to base64
accepts: any value
teminator - character that defines end of line
accepts: any value (defaults to "\n")
^ Example: encode string to base 64
my $string='Test encode base 64';
print $A->ENCODE_64(data=>$string);
OUTPUT:
VGVzdCBlbmNvZGUgYmFzZSA2NA==
NOTE: The result string has a newline on it
^ Decode Base 64
DESCRIPTION:
Decode data string from base 64
USAGE:
$A->DECODE_64(HASH)
PARAMETERS DESCRIPTION
data ------ data to convert from base64
accepts: any value
^ Example: decode string from base 64
my $string='VGVzdCBlbmNvZGUgYmFzZSA2NA==';
print $A->DECODE_64(data=>$string);
OUTPUT 1:
Test encode base 64
^ Encode Base 85
DESCRIPTION:
Encode data string into base 85
USAGE:
$A->ENCODE_85(HASH)
PARAMETERS DESCRIPTION
data ------ data to convert to base85
accepts: any value
teminator - character that defines end of line
accepts: any value (defaults to "\n")
^ Example: encode string to base 85
my $string='Test encode base 85';
print $A->ENCODE_85(data=>$string);
OUTPUT 1:
<+U,m+D#G#De*E%@UX=h+?24Y~>
NOTE: The result string has a newline on it
^ Decode Base 85
DESCRIPTION:
Decode data string from base 85
USAGE:
$A->DECODE_85(HASH)
PARAMETERS DESCRIPTION
data ------ data to convert from base85
accepts: any value
^ Example: decode string from base 85
my $string='VGVzdCBlbmNvZGUgYmFzZSA2NA==';
print $A->DECODE_85(data=>$string);
OUTPUT 1:
Test encode base 85
^ Byte Convert
DESCRIPTION:
Convert bytes to kilobytes, megabytes, gigabytes
USAGE:
$A->BYTE_CONVERT(HASH)
PARAMETERS DESCRIPTION
data ------ number to convert
accepts: any integer
mode ------ type of action to perform
accepts: NULL (''), raw
^ Example: convert number to raw bytes
my $bytes='100058324';
print $A->BYTE_CONVERT(data=>$bytes,mode=>'raw');
OUTPUT:
100.06 MB
^ Example: convert number to bytes
my $bytes='100058324';
print $A->BYTE_CONVERT(data=>$bytes);
OUTPUT:
95.42 MB
^ NUMERIC FORMATTING
^ commify
DESCRIPTION:
Add commas appropriately to numeric values
USAGE:
$A->COMMIFY(HASH)
PARAMETERS DESCRIPTION
num ------- number to commify
accepts: 0-9, .
^ Example: commify number
my $var=10000000.0000;
print $A->COMMIFY(num=>$var);
OUTPUT:
10,000,000.0000
^ format money
DESCRIPTION:
Format numeric values and into US money
USAGE:
$A->FORMAT_MONEY(HASH)
PARAMETERS DESCRIPTION
num ------- number to commify
accepts: 0-9, .
^ Example: format number to money with commas
my $var=10000000.0000;
print $A->FORMAT_MONEY(num=>$var);
OUTPUT:
10,000,000.00
^ round money (no commas)
DESCRIPTION:
Format numeric values into US money (and othes) without commas
USAGE:
$A->ROUND_MONEY(HASH)
PARAMETERS DESCRIPTION
num ------- number to round
accepts: 0-9, .
^ Example: format number to money without commas
$var=10000000.0000;
print $A->ROUND_MONEY(num=>$var);
OUTPUT:
10000000.00
^ round number (no commas)
DESCRIPTION:
Round numeric values to given places without commas
USAGE:
$A->ROUND(HASH)
PARAMETERS DESCRIPTION
num ------- number to round
accepts: 0-9, .
places----- places behind decimal point round to
accepts: 0-9 (defaults to 2)
^ Example: round number to 2 places
$var=10.409127;
print $A->ROUND(num=>$var);
OUTPUT:
10.41
^ Example: round number to 5 places
$var=10.409127;
print $A->ROUND(num=>$var,places=>5);
OUTPUT:
10.40913
^ PAYPAL
^ Send Paypal Request
DESCRIPTION:
Send PayPal a payment request
USAGE:
$A->PAYPAL_GO();
PARAMETERS DESCRIPTION
mode ------ type of action to perform
accepts: go, set
type ------ type of action on action
accepts: buy_now or ipn (ipn not fully working or doc'd)
sub_type -- type of action on action on action
accepts: prefill or NULL
use_opts -- force values to conform to PayPal specs (NULLs included)
accepts: any value (is either on or off)
delay ----- do not print to browser, but send result back to be stored
accepts: any value (is either on or off)
full ------ use all possible params (even if NULL)
accepts: any value (is either on or off)
^ Example: Forward to pre-filled Buy Now using full options (empty param set)
NOTE: 'Location' link has had new lines and spaces add for readability...
BEGIN {
use ANTBOMB2;
use vars qw( $A );
$A=ANTBOMB2->new();
$A->DIAGNOSTICS(
warnings => "Yes",
delayout => "Yes"
);
}
use strict;
$A->PAYPAL(
mode => "go",
type => "buy_now",
sub_type => "prefill",
use_opts => 1,
full => 1
);
OUTPUT:
Location: https://www.paypal.com/cgi-bin/webscr
?cmd=_ext-enter &redirect_cmd=_xclick &business=
&amount= &item_number= &on1=
&os1= &cs=0 &no_note=0
&cancel_return= &rm=0 &custom=
&invoice= &shipping2= ¤cy_code=USD
&undefined_quantity=0 &item_name= &on0=
&os0= &cn= &image_url=
&no_shipping=0 &return= &page_style=
&handling= &shipping= &tax=
&first_name= &last_name= &address1=
&address2= &city= &state=
&zip= &night_phone_a=000 &night_phone_b=000
&night_phone_c=0000 &day_phone_a=000 &day_phone_b=000
&day_phone_c=0000
<!-- ANTBOMB WARNINGS -->
<!--
cs () required to be 0 or 1...setting to default (0).
from paypal_test.cgi line 10.
main::ANTBOMB2::PAYPAL from ANTBOMB2.pm line 463.
ANTBOMB2::ANTBOMB2::MOD from ANTBOMB2.pm line 376.
ANTBOMB2::ANTBOMB2::PAYPAL::paypal from PAYPAL.pm line 20.
ANTBOMB2::PAYPAL::GO::action from PAYPAL.pm line 110.
GO::GO::check_params from PAYPAL.pm line 150.
GO::ANTBOMB2::warning
-->
<!--
no_note () required to be 0 or 1...setting to default (0).
from paypal_test.cgi line 10.
main::ANTBOMB2::PAYPAL from ANTBOMB2.pm line 463.
ANTBOMB2::ANTBOMB2::MOD from ANTBOMB2.pm line 376.
ANTBOMB2::ANTBOMB2::PAYPAL::paypal from PAYPAL.pm line 20.
ANTBOMB2::PAYPAL::GO::action from PAYPAL.pm line 110.
GO::GO::check_params from PAYPAL.pm line 150.
GO::ANTBOMB2::warning
-->
<!--
rm () required to be 0,1,2...setting to default (0).
from paypal_test.cgi line 10.
main::ANTBOMB2::PAYPAL from ANTBOMB2.pm line 463.
ANTBOMB2::ANTBOMB2::MOD from ANTBOMB2.pm line 376.
ANTBOMB2::ANTBOMB2::PAYPAL::paypal from PAYPAL.pm line 20.
ANTBOMB2::PAYPAL::GO::action from PAYPAL.pm line 110.
GO::GO::check_params from PAYPAL.pm line 163.
GO::ANTBOMB2::warning
-->
<!--
currency_code () required to be USD,EUR,GBP,CAD,JPY...setting to default (USD).
from paypal_test.cgi line 10.
main::ANTBOMB2::PAYPAL from ANTBOMB2.pm line 463.
ANTBOMB2::ANTBOMB2::MOD from ANTBOMB2.pm line 376.
ANTBOMB2::ANTBOMB2::PAYPAL::paypal from PAYPAL.pm line 20.
ANTBOMB2::PAYPAL::GO::action from PAYPAL.pm line 110.
GO::GO::check_params from PAYPAL.pm line 163.
GO::ANTBOMB2::warning
-->
<!--
undefined_quantity () required to be 0 or 1...setting to default (0).
from paypal_test.cgi line 10.
main::ANTBOMB2::PAYPAL from ANTBOMB2.pm line 463.
ANTBOMB2::ANTBOMB2::MOD from ANTBOMB2.pm line 376.
ANTBOMB2::ANTBOMB2::PAYPAL::paypal from PAYPAL.pm line 20.
ANTBOMB2::PAYPAL::GO::action from PAYPAL.pm line 110.
GO::GO::check_params from PAYPAL.pm line 150.
GO::ANTBOMB2::warning
-->
<!--
no_shipping () required to be 0 or 1...setting to default (0).
from paypal_test.cgi line 10.
main::ANTBOMB2::PAYPAL from ANTBOMB2.pm line 463.
ANTBOMB2::ANTBOMB2::MOD from ANTBOMB2.pm line 376.
ANTBOMB2::ANTBOMB2::PAYPAL::paypal from PAYPAL.pm line 20.
ANTBOMB2::PAYPAL::GO::action from PAYPAL.pm line 110.
GO::GO::check_params from PAYPAL.pm line 150.
GO::ANTBOMB2::warning
-->
<!--
night_phone_a contain non-digits...truncating non-digitis.
from paypal_test.cgi line 10.
main::ANTBOMB2::PAYPAL from ANTBOMB2.pm line 463.
ANTBOMB2::ANTBOMB2::MOD from ANTBOMB2.pm line 376.
ANTBOMB2::ANTBOMB2::PAYPAL::paypal from PAYPAL.pm line 20.
ANTBOMB2::PAYPAL::GO::action from PAYPAL.pm line 110.
GO::GO::check_params from PAYPAL.pm line 170.
GO::ANTBOMB2::warning
-->
<!--
night_phone_a still contains non-digits or bad count...setting 0's.
from paypal_test.cgi line 10.
main::ANTBOMB2::PAYPAL from ANTBOMB2.pm line 463.
ANTBOMB2::ANTBOMB2::MOD from ANTBOMB2.pm line 376.
ANTBOMB2::ANTBOMB2::PAYPAL::paypal from PAYPAL.pm line 20.
ANTBOMB2::PAYPAL::GO::action from PAYPAL.pm line 110.
GO::GO::check_params from PAYPAL.pm line 173.
GO::ANTBOMB2::warning
-->
<!--
night_phone_b contain non-digits...truncating non-digitis.
from paypal_test.cgi line 10.
main::ANTBOMB2::PAYPAL from ANTBOMB2.pm line 463.
ANTBOMB2::ANTBOMB2::MOD from ANTBOMB2.pm line 376.
ANTBOMB2::ANTBOMB2::PAYPAL::paypal from PAYPAL.pm line 20.
ANTBOMB2::PAYPAL::GO::action from PAYPAL.pm line 110.
GO::GO::check_params from PAYPAL.pm line 170.
GO::ANTBOMB2::warning
-->
<!--
night_phone_b still contains non-digits or bad count...setting 0's.
from paypal_test.cgi line 10.
main::ANTBOMB2::PAYPAL from ANTBOMB2.pm line 463.
ANTBOMB2::ANTBOMB2::MOD from ANTBOMB2.pm line 376.
ANTBOMB2::ANTBOMB2::PAYPAL::paypal from PAYPAL.pm line 20.
ANTBOMB2::PAYPAL::GO::action from PAYPAL.pm line 110.
GO::GO::check_params from PAYPAL.pm line 173.
GO::ANTBOMB2::warning
-->
<!--
night_phone_c contain non-digits...truncating non-digitis.
from paypal_test.cgi line 10.
main::ANTBOMB2::PAYPAL from ANTBOMB2.pm line 463.
ANTBOMB2::ANTBOMB2::MOD from ANTBOMB2.pm line 376.
ANTBOMB2::ANTBOMB2::PAYPAL::paypal from PAYPAL.pm line 20.
ANTBOMB2::PAYPAL::GO::action from PAYPAL.pm line 110.
GO::GO::check_params from PAYPAL.pm line 170.
GO::ANTBOMB2::warning
-->
<!--
night_phone_c still contains non-digits or bad count...setting 0's.
from paypal_test.cgi line 10.
main::ANTBOMB2::PAYPAL from ANTBOMB2.pm line 463.
ANTBOMB2::ANTBOMB2::MOD from ANTBOMB2.pm line 376.
ANTBOMB2::ANTBOMB2::PAYPAL::paypal from PAYPAL.pm line 20.
ANTBOMB2::PAYPAL::GO::action from PAYPAL.pm line 110.
GO::GO::check_params from PAYPAL.pm line 173.
GO::ANTBOMB2::warning
-->
<!--
day_phone_a contain non-digits...truncating non-digitis.
from paypal_test.cgi line 10.
main::ANTBOMB2::PAYPAL from ANTBOMB2.pm line 463.
ANTBOMB2::ANTBOMB2::MOD from ANTBOMB2.pm line 376.
ANTBOMB2::ANTBOMB2::PAYPAL::paypal from PAYPAL.pm line 20.
ANTBOMB2::PAYPAL::GO::action from PAYPAL.pm line 110.
GO::GO::check_params from PAYPAL.pm line 170.
GO::ANTBOMB2::warning
-->
<!--
day_phone_a still contains non-digits or bad count...setting 0's.
from paypal_test.cgi line 10.
main::ANTBOMB2::PAYPAL from ANTBOMB2.pm line 463.
ANTBOMB2::ANTBOMB2::MOD from ANTBOMB2.pm line 376.
ANTBOMB2::ANTBOMB2::PAYPAL::paypal from PAYPAL.pm line 20.
ANTBOMB2::PAYPAL::GO::action from PAYPAL.pm line 110.
GO::GO::check_params from PAYPAL.pm line 173.
GO::ANTBOMB2::warning
-->
<!--
day_phone_b contain non-digits...truncating non-digitis.
from paypal_test.cgi line 10.
main::ANTBOMB2::PAYPAL from ANTBOMB2.pm line 463.
ANTBOMB2::ANTBOMB2::MOD from ANTBOMB2.pm line 376.
ANTBOMB2::ANTBOMB2::PAYPAL::paypal from PAYPAL.pm line 20.
ANTBOMB2::PAYPAL::GO::action from PAYPAL.pm line 110.
GO::GO::check_params from PAYPAL.pm line 170.
GO::ANTBOMB2::warning
-->
<!--
day_phone_b still contains non-digits or bad count...setting 0's.
from paypal_test.cgi line 10.
main::ANTBOMB2::PAYPAL from ANTBOMB2.pm line 463.
ANTBOMB2::ANTBOMB2::MOD from ANTBOMB2.pm line 376.
ANTBOMB2::ANTBOMB2::PAYPAL::paypal from PAYPAL.pm line 20.
ANTBOMB2::PAYPAL::GO::action from PAYPAL.pm line 110.
GO::GO::check_params from PAYPAL.pm line 173.
GO::ANTBOMB2::warning
-->
<!--
day_phone_c contain non-digits...truncating non-digitis.
from paypal_test.cgi line 10.
main::ANTBOMB2::PAYPAL from ANTBOMB2.pm line 463.
ANTBOMB2::ANTBOMB2::MOD from ANTBOMB2.pm line 376.
ANTBOMB2::ANTBOMB2::PAYPAL::paypal from PAYPAL.pm line 20.
ANTBOMB2::PAYPAL::GO::action from PAYPAL.pm line 110.
GO::GO::check_params from PAYPAL.pm line 170.
GO::ANTBOMB2::warning
-->
<!--
day_phone_c still contains non-digits or bad count...setting 0's.
from paypal_test.cgi line 10.
main::ANTBOMB2::PAYPAL from ANTBOMB2.pm line 463.
ANTBOMB2::ANTBOMB2::MOD from ANTBOMB2.pm line 376.
ANTBOMB2::ANTBOMB2::PAYPAL::paypal from PAYPAL.pm line 20.
ANTBOMB2::PAYPAL::GO::action from PAYPAL.pm line 110.
GO::GO::check_params from PAYPAL.pm line 173.
GO::ANTBOMB2::warning
-->
^ Example: Forward to pre-filled Buy Now (empty param set)
NOTE: 'Location' link has had new lines and spaces add for readability...
BEGIN {
use ANTBOMB2;
use vars qw( $A );
$A=ANTBOMB2->new();
$A->DIAGNOSTICS(
warnings => "Yes",
delayout => "Yes"
);
}
use strict;
$A->PAYPAL(
mode => "go",
type => "buy_now",
sub_type => "prefill",
full => 1
);
OUTPUT:
Location: https://www.paypal.com/cgi-bin/webscr
?cmd=_ext-enter &redirect_cmd=_xclick &business=
&amount= &item_number= &on1=
&os1= &cs= &no_note=
&cancel_return= &rm= &custom=
&invoice= &shipping2= ¤cy_code=
&undefined_quantity= &item_name= &on0=
&os0= &cn= &image_url=
&no_shipping= &return= &page_style=
&handling= &shipping= &tax=
&first_name= &last_name= &address1=
&address2= &city= &state=
&zip= &night_phone_a= &night_phone_b=
&night_phone_c= &day_phone_a= &day_phone_b=
&day_phone_c=
<!-- ANTBOMB WARNINGS -->
^ Example: Forward to pre-filled Buy Now (empty param set)
NOTE: 'Location' link has had new lines and spaces add for readability...
BEGIN {
use ANTBOMB2;
use vars qw( $A );
$A=ANTBOMB2->new();
$A->DIAGNOSTICS(
warnings => "Yes",
delayout => "Yes"
);
}
use strict;
$A->PAYPAL(
mode => "go",
type => "buy_now",
full => 1
);
OUTPUT:
Location: https://www.paypal.com/cgi-bin/webscr
?cmd=_xclick &business= &amount=
&item_number= &on1= &os1=
&cs= &no_note= &cancel_return=
&rm= &custom= &invoice=
&shipping2= ¤cy_code= &undefined_quantity=
&item_name= &on0= &os0=
&cn= &image_url= &no_shipping=
&return= &page_style= &handling=
&shipping= &tax=
<!-- ANTBOMB WARNINGS -->
^ Example: Forward to pre-filled Buy Now (empty param set)
BEGIN {
use ANTBOMB2;
use vars qw( $A );
$A=ANTBOMB2->new();
$A->DIAGNOSTICS(
warnings => "Yes",
delayout => "Yes"
);
}
use strict;
$A->PAYPAL(
mode => "go",
type => "buy_now"
);
OUTPUT:
Location: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick
<!-- ANTBOMB WARNINGS -->
^ Example: Forward to pre-filled Buy Now
NOTE: 'Location' link has had new lines and spaces add for readability...
BEGIN {
use ANTBOMB2;
use vars qw( $A );
$A=ANTBOMB2->new();
$A->DIAGNOSTICS(
warnings => "Yes",
delayout => "Yes"
);
}
use strict;
$A->PAYPAL(
mode => 'go',
type => 'buy_now',
business => 'nora@paypal.com',
return => 'http://www.yoursite.com/thankyou.htm',
undefined_quantity => 1,
item_name => 'Baseball Hat',
item_number => 123,
amount => 5.95,
no_shipping => 1,
image_url => 'https://www.yoursite.com/logo.gif',
cancel_return => 'http://www.yoursite.com/cancel.htm',
no_note => 0,
on0 => 'Color?',
os0 => 'Red',
cn => 'How Did You Hear About Us?',
notify_url => 'http://www.yoursite.com/cgi-bin/notify.cgi'
);
OUTPUT:
Location: https://www.paypal.com/cgi-bin/webscr
?cmd=_xclick
&business=nora@paypal.com
&amount=5.95
&item_number=123
&cancel_return=http://www.yoursite.com/cancel.htm
&undefined_quantity=1
&item_name=Baseball Hat
&on0=Color?
&os0=Red
&cn=How Did You Hear About Us?
&image_url=https://www.yoursite.com/logo.gif
&no_shipping=1
&return=http://www.yoursite.com/thankyou.htm
¬ify_url=http://www.yoursite.com/cgi-bin/notify.cgi
<!-- ANTBOMB WARNINGS -->
^ RAW DATA
^ HTTP response codes
DESCRIPTION:
Returns 2 referenced hashes to http_response_codes and
http_response_details (ie: 500=>'Internal Server Error' and
500=>'The server encountered an unexpected condition which
prevented it from fulfilling the request.' respectively)
USAGE:
$A->HTTP_RESPONSE();
PARAMETERS DESCRIPTION
^ Example: store response codes in array as ref hashes
my @codes=($A->HTTP_RESPONSE());
OUTPUT:
N/A - Returns 2 referenced hashes and stores them in the array codes
^ Example: print response code 202
my @codes=($A->HTTP_RESPONSE());
print $codes[0]->{'202'},$/,$codes[1]->{'202'};
OUTPUT:
Accepted
The request has been accepted for processing, but the processing has
not been completed. The request might or might not eventually be acted
upon, as it might be disallowed when processing actually takes place.
There is no facility for re-sending a status code from an asynchronous
operation such as this.
The 202 response is intentionally non-committal. Its purpose is to
allow a server to accept a request for some other process (perhaps
a batch-oriented process that is only run once per day) without
requiring that the user agent's connection to the server persist
until the process is completed. The entity returned with this
response SHOULD include an indication of the request's current
status and either a pointer to a status monitor or some estimate
of when the user can expect the request to be fulfilled.
NOTE:
New lines added for readability
^ US and Canada State/Territories
DESCRIPTION:
Returns a referenced hash to state abbreviation hash or full name
state hash. (hash 1 CA=>California, hash 2 California=>CA).
USAGE:
$A->STATES(HASH);
PARAMETERS DESCRIPTION
mode ------ determine order of returned referenced hash
accepts: NULL (''), r
^ Example: store all states (full names) in the array @states
my @states=values %{$A->STATES()};
OUTPUT:
N/A - Sores all states (full names) in the array @states
^ Example: store state, print value for CA
my $states=$A->STATES();
print $states->{'CA'};
OUTPUT:
California
^ Example: store reversed, print value for California
my $states=$A->STATES(mode=>'r');
print $states->{'California'}
OUTPUT:
CA
^ World Wide Country List
DESCRIPTION:
Returns a referenced hash to country numeric value hash or full name
country hash. (hash 1 177=>United States of America, hash 2
United States of America=>177).
USAGE:
$A->COUNTRIES();
PARAMETERS DESCRIPTION
mode ------ determine order of returned referenced hash
accepts: NULL (''), r
^ Example: store countries full names in array
my @countries=values %{$A->COUNTRIES()};
OUTPUT:
N/A - store countries full names in array @countries
^ Example: store country, print value for 177
my $countries=$A->COUNTRIES();
print $countries->{177};
OUTPUT:
United States of America
^ Example: store reversed country, print value United States of America
my $countries=$A->COUNTRIES(mode=>'r');
print $countries->{'United States of America'};
OUTPUT:
177
^ SENDMAIL
DESCRIPTION:
Send Mail interface (requires existing SMTP server)
NOTE:
All Params Required to send mail, but not to pull a previously
sent mail. By calling sm without ANY parameters, it will return
the last email sent out (will error out if no emails have already
been sent). If called with 'full' as the only parameter, it will
return the full dialog between the smtp server and the script of
the last email sent as well as the parameter list that was used
to send the mail (again, will error out if no emails have been sent.)
USAGE:
$A->SENDMAIL(HASH)
PARAMETERS DESCRIPTION
host ------ name of smtp server to mail from
accepts: any value
mode ------ type of action to perform
accepts: NULL (''), raw
To -------- Recipient (email)
ToName ---- Recipient (Real Name)
From ------ Sender (email)
FromName -- Sender (Real Name)
Reply-To -- Reply to address (if different than 'From')
Cc -------- Carbon Copy recipients (NOT working yet)
Bcc ------- Blind Carbon Copy recipients (NOT working yet)
Subject --- Subject line
Notify ---- Notification the mail has been viewd
body ------ message of the email
mode ------ type of action to perform
--- HTML EMAIL ---
Content-Type -------- content type (ex: text/html; charset="iso-8859-1")
Content-Disposition - content disposition (ex: inline)
MIME-Version -------- mime version (ex: 1.0)
--- AUTH LOGIN (ESMPT) ---
USER ---------------- username
PASS ---------------- password
SETUP FOR FOLLOWING EXAMPLES:
$smtp='perlhelp.com';
%head=('To'=>'support@perlhelp.com',
'From'=>'shawn@perlhelp.com',
'Subject'=>'How do I send mail?');
$body="Hello,\n I was wondering how I send out email?\nTIA,\nShawn";
^ Example: basic mail message
$A->SENDMAIL(host=>$smtp,%head,body=>$body);
OUTPUT:
N/A - Sends email with the head parameters and body supplied.
^ Example: print previously sent mail message
print $A->SENDMAIL();
NOTE: Previous email must have already been sent for this function.
OUTPUT:
To: support@perlhelp.com
From: shawn@baimc.com
Subject: How do I send mail?
Hello,
I was wondering how I send out email?
TIA,
Shawn
^ Example: print full headers of previously sent mail message
print $A->SENDMAIL(mode=>'full');
OUTPUT:
Parameters
--------------------------------------
Server: smtp.perlhelp.com
Port: 25
LocalHost: nam
AF_INET: 2
SOCK_STREAM: 1
SMTPAddr: À)
z
--------------------------------------
220 perlhelp.com ESMTP Sendmail 8.8.5 ready at Sat, 23 Mar 2002 00:25:59 -0700 (MST)
HELO nam
250 perlhelp.com Hello XXXXX.perlhelp.com [XXX.XXX.XXX.XXX], pleased to meet you
mail from: <shawn@baimc.com>;
250 <shawn@baimc.com>... Sender ok
rcpt to: <support@perlhelp.com>;
250 <support@perlhelp.com>;... Recipient ok
data
354 Enter mail, end with "." on a line by itself
To: support@perlhelp.com
From: shawn@baimc.com
Subject: How do I send mail?
I was wondering how I send out email?
TIA,
Shawn
.
250 XXXXXXXX Message accepted for delivery
221 perlhelp.com closing connection
^ Example: WORKING send mail & print previously sent message with headers
BEGIN {
use ANTBOMB2;
use vars qw($A);
$A=ANTBOMB2->new();
$A->DIAGNOSTICS
(
destroys=>'0',
warnings=>'Yes',
delayout=>'Yes',
debug=>'0',
queries=>'0'
);
}
use strict;
my $m='perlhelp.com';
my %h=(To=>'shawn@baimc.com',
From=>'shawn@secureshopper.com',
Subject=>'How do I send mail?');
my $b="Hello,\n I was wondering how I send out email?\nTIA,\nShawn";
$A->SENDMAIL(host=>$m,%h,body=>$b);
print $A->SENDMAIL();
OUTPUT:
From: shawn@secureshopper.com <shawn@secureshopper.com>
To: <shawn@baimc.com>
X-Mailer: ANTBOMB V2.001
Subject: How do I send mail?
Hello,
I was wondering how I send out email?
TIA,
Shawn
.
^ TEMPLATES
DESCRIPTION:
The templates were implemented to clean up perl code (remove HTML and
SQL code from the perl code as much as possible). Templates also
give programmers the ability to hand a designer (either HTML or
database) something to work with, and keep them out of your hair.
^ HTML TEMPLATES
DESCRIPTION:
Manipulate HTML templates
USAGE:
$A->HTML_TEMP(HASH)
PARAMETERS DESCRIPTION
mode ------ type of action to perform
accepts: NULL (''), set_dir, load, read, modify
NOTE: if mode is not specified and match is, modify is
will be used
dir ------- path to location of session files
accepts: NULL (''), raw
file ------ file name to manipulate
accepts: any value
text ------ string to manipulate
accepts: any value
match ----- string to replace in template
accepts: any value (can contain regex)
replace --- string to replace a with in template
accepts: any value (can contain regex)
modifiers - regex modifier(s)
accepts: g, s, m, e, o, i (or any combination)
SETUP FOR FOLLOWING EXAMPLES:
my $template=
"<html>
<head>
<title>test</title>
</head>
<body>
This is just a test.
</body>
</html>";
^ Example: set HTML template directory
$A->HTML_TEMP(mode=>'set_dir',dir=>'./templates/');
OUTPUT:
N/A - sets template file directory
^ Example: print current HTML template directory
print $A->HTML_TEMP(mode=>'set_dir');
OUTPUT:
./templates/
^ Example: load HTML template from file and store it in current object
$A->HTML_TEMP(mode=>'load',file=>'antbomb.tmp');
OUTPUT:
N/A - stores antbomb.tmp in template object
^ Example: load HTML template from text and store it in current object
$A->HTML_TEMP(mode=>'load',text=>$template);
OUTPUT:
N/A - stores $template in template object
^ Example: read HTML template from file
my $temp=$A->HTML_TEMP(mode=>'read',file=>$template);
OUTPUT:
N/A - stores antbomb.tmp in $temp
^ Example: read HTML template from text
my $temp=$A->HTML_TEMP(mode=>'read',text=>$template);
OUTPUT:
N/A - stores $template in $temp
^ Example: modify and print HTML template in current object
print $A->HTML_TEMP(mode=>'modify',match=>'test',replace=>'Test',modifiers=>'ig');
OUTPUT:
<html>
<head>
<title>Test</title>
</head>
<body>
This is just a Test.
</body>
</html>
^ QUERY TEMPLATES (for use with SQL)
DESCRIPTION:
Manipulate HTML templates
USAGE:
$A->QUERY_TEMP(HASH)
PARAMETERS DESCRIPTION
mode ------ type of action to perform
accepts: NULL (''), set_dir, load, read, modify
NOTE: if mode is not specified and match is, modify is
will be used
dir ------- path to location of session files
accepts: NULL (''), raw
file ------ file name to manilpulate
accepts: any value
text ------ string to manipulate
accepts: any value
match ----- string to replace in template
accepts: any value (can contain regex)
replace --- string to replace a with in template
accepts: any value (can contain regex)
modifiers - regex modifier(s)
accepts: g, s, m, e, o, i (or any combination)
SETUP FOR FOLLOWING EXAMPLES:
my $template=
'SELECT
*
FROM
user
WHERE
id=<!-- ID -->';
^ Example: set query template directory
$A->QUERY_TEMP(mode=>'set_dir',dir=>'./templates/');
OUTPUT:
N/A - sets template file directory
^ Example: print current query template directory
print $A->QUERY_TEMP(mode=>'set_dir');
OUTPUT:
./templates/
^ Example: load query template from file and store it in current object
$A->QUERY_TEMP(mode=>'load',file=>'antbomb.tmp');
OUTPUT:
N/A - stores antbomb.tmp in template object
^ Example: load query template from text and store it in current object
$A->QUERY_TEMP(mode=>'load',text=>$template);
OUTPUT:
N/A - stores $template in template object
^ Example: read query template from file and store it in current object
my $temp=$A->QUERY_TEMP(mode=>'read',file=>'antbomb.tmp');
OUTPUT:
N/A - stores antbomb.tmp in $temp
^ Example: read query template from text and store it in current object
my $temp=$A->QUERY_TEMP(mode=>'read',text=>$template);
OUTPUT:
N/A - stores $template in $temp
^ Example: modify and print query template in current object
print $A->QUERY_TEMP(mode=>'modify',match=>'<!-- ID -->',replace=>'1',modifiers=>'ig');
OUTPUT:
SELECT
*
FROM
user
WHERE
id=1
^ TIME & DATES
One unique feature of the ANTBOMB time calculations is that you are not
limited to the standard system epoch seconds. It can calculate properly
any date all the way back to 4713 BC and into the future up to 9999 AD.
An interesting note on time:
Julian Days start at noon, so move it backward 12 hours...
A Julian date is simply the number of days elapsed since the start of the
year -4712. Since optical astronomers of yore worked mostly by night, and
observed mostly from Europe, the Julian Day was defined to begin at noon,
12:00 Universal Time. This avoided the inconvenience of having an observing
session begin one day and end the next, as would occur were regular civil
dates used.
courtesy of John Walker
http://www.fourmilab.ch/earthview/help/timedate.html
^ Calendar
DESCRIPTION:
Formated simple calendar, calendar date layout, or max day of month
USAGE:
$A->CALENDAR(HASH)
PARAMETERS DESCRIPTION
mode ------ type of action to perform
accepts: text_year, text, html_year, html, nozero, max
cols ------ number of months to display on a row
accepts: 1, 2, 3, 4, 6, or 12 (defaults to 3)
month ----- month of calendar to display
accepts: 1-12 (defaults to current month)
year ------ year of calendar to display
accepts: any integer (defaults to current year)
(0 and below will be in BC starting at 1)
^ Example:print HTML calendar for March of 2002
print $A->CALENDAR(month=>3,year=>2002,mode=>'html');
OUTPUT:
<table border=1 cellpadding=2 cellspacing=2>
<tr>
<td colspan="7" align="center"><b>March 2002 AD</b></td>
</tr>
<tr>
<td><b>S</b></td>
<td><b>M</b></td>
<td><b>T</b></td>
<td><b>W</b></td>
<td><b>T</b></td>
<td><b>F</b></td>
<td><b>S</b></td>
</tr>
<tr>
<td align="center"><b> </b></td>
<td align="center"><b> </b></td>
<td align="center"><b> </b></td>
<td align="center"><b> </b></td>
<td align="center"><b> </b></td>
<td align="center"><b>1</b></td>
<td align="center"><b>2</b></td>
</tr>
<tr>
<td align="center"><b>3</b></td>
<td align="center"><b>4</b></td>
<td align="center"><b>5</b></td>
<td align="center"><b>6</b></td>
<td align="center"><b>7</b></td>
<td align="center"><b>8</b></td>
<td align="center"><b>9</b></td>
</tr>
<tr>
<td align="center"><b>10</b></td>
<td align="center"><b>11</b></td>
<td align="center"><b>12</b></td>
<td align="center"><b>13</b></td>
<td align="center"><b>14</b></td>
<td align="center"><b>15</b></td>
<td align="center"><b>16</b></td>
</tr>
<tr>
<td align="center"><b>17</b></td>
<td align="center"><b>18</b></td>
<td align="center"><b>19</b></td>
<td align="center"><b>20</b></td>
<td align="center"><b>21</b></td>
<td align="center"><b>22</b></td>
<td align="center"><b>23</b></td>
</tr>
<tr>
<td align="center"><b>24</b></td>
<td align="center"><b>25</b></td>
<td align="center"><b>26</b></td>
<td align="center"><b>27</b></td>
<td align="center"><b>28</b></td>
<td align="center"><b>29</b></td>
<td align="center"><b>30</b></td>
</tr>
<tr>
<td align="center"><b>31</b></td>
<td align="center"><b> </b></td>
<td align="center"><b> </b></td>
<td align="center"><b> </b></td>
<td align="center"><b> </b></td>
<td align="center"><b> </b></td>
<td align="center"><b> </b></td>
</tr>
</table>
^ Example: print text calendar for March of 2002
print $A->CALENDAR(month=>'3',year=>'2002',mode=>'text');
OUTPUT:
March 2002 AD
Su Mo Tu We Th Fr Sa
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
^ Example: print text calendar for 1752
print $A->CALENDAR(year=>'1752',mode=>'text_year');
OUTPUT:
January 1752 AD February 1752 AD March 1752 AD
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 1 1 2 3 4 5 6 7
5 6 7 8 9 10 11 2 3 4 5 6 7 8 8 9 10 11 12 13 14
12 13 14 15 16 17 18 9 10 11 12 13 14 15 15 16 17 18 19 20 21
19 20 21 22 23 24 25 16 17 18 19 20 21 22 22 23 24 25 26 27 28
26 27 28 29 30 31 23 24 25 26 27 28 29 29 30 31
April 1752 AD May 1752 AD June 1752 AD
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 1 2 1 2 3 4 5 6
5 6 7 8 9 10 11 3 4 5 6 7 8 9 7 8 9 10 11 12 13
12 13 14 15 16 17 18 10 11 12 13 14 15 16 14 15 16 17 18 19 20
19 20 21 22 23 24 25 17 18 19 20 21 22 23 21 22 23 24 25 26 27
26 27 28 29 30 24 25 26 27 28 29 30 28 29 30
31
July 1752 AD August 1752 AD September 1752 AD
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 1 1 2 14 15 16
5 6 7 8 9 10 11 2 3 4 5 6 7 8 17 18 19 20 21 22 23
12 13 14 15 16 17 18 9 10 11 12 13 14 15 24 25 26 27 28 29 30
19 20 21 22 23 24 25 16 17 18 19 20 21 22
26 27 28 29 30 31 23 24 25 26 27 28 29
30 31
October 1752 AD November 1752 AD December 1752 AD
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7 1 2 3 4 1 2
8 9 10 11 12 13 14 5 6 7 8 9 10 11 3 4 5 6 7 8 9
15 16 17 18 19 20 21 12 13 14 15 16 17 18 10 11 12 13 14 15 16
22 23 24 25 26 27 28 19 20 21 22 23 24 25 17 18 19 20 21 22 23
29 30 31 26 27 28 29 30 24 25 26 27 28 29 30
31
NOTE: YES, this is correct for September 1752...
^ Example: print text calendar for August 2003
my $html=qq~<table border=1 cellpadding=2 cellspacing=0>\n~;
$html.=qq~<tr>\n~;
$html.=qq~<td colspan="7" align="center"><b>~;
$html.=$A->time('fmon');
$html.=qq~ ~;
$html.=$A->time('year');
$html.=qq~</b></td>\n~;
$html.=qq~</tr>\n~;
$html.=qq~<tr>\n~;
$html.=qq~<td><b>S</b></td>\n~;
$html.=qq~<td><b>M</b></td>\n~;
$html.=qq~<td><b>T</b></td>\n~;
$html.=qq~<td><b>W</b></td>\n~;
$html.=qq~<td><b>T</b></td>\n~;
$html.=qq~<td><b>F</b></td>\n~;
$html.=qq~<td><b>S</b></td>\n~;
$html.=qq~</tr>\n~;
$html.=qq~<tr>\n~;
my $weekday;
for($A->CALENDAR()) {
$weekday++;
$_=" " if(!$_);
$html.=qq~<td align="center"><b>~;
$html.=qq~<a href ="somelink">~ if($_ eq $some_match);
$html.=qq~$_~;
$html.=qq~</a>~ if($_ eq $some_match);
$html.=qq~</b></td>\n~;
if($weekday%7==0) { $html.=qq~</tr>\n<tr>\n~; }
}
$html=~s/(.*)<tr>\n/$1/;
$html.=qq~</table>\n~;
print $html;
OUTPUT:
<table border=1 cellpadding=2 cellspacing=0>
<td colspan="7" align="center"><b>August 2003</b></td>
</tr>
<tr>
<td><b>S</b></td>
<td><b>M</b></td>
<td><b>T</b></td>
<td><b>W</b></td>
<td><b>T</b></td>
<td><b>F</b></td>
<td><b>S</b></td>
</tr>
<tr>
<td align='center'><b> </b></td>
<td align='center'><b> </b></td>
<td align='center'><b> </b></td>
<td align='center'><b> </b></td>
<td align='center'><b> </b></td>
<td align='center'><b>1</b></td>
<td align='center'><b>2</b></td>
</tr>
<tr>
<td align='center'><b>3</b></td>
<td align='center'><b>4</b></td>
<td align='center'><b>5</b></td>
<td align='center'><b>6</b></td>
<td align='center'><b>7</b></td>
<td align='center'><b>8</b></td>
<td align='center'><b>9</b></td>
</tr>
<tr>
<td align='center'><b>10</b></td>
<td align='center'><b>11</b></td>
<td align='center'><b>12</b></td>
<td align='center'><b>13</b></td>
<td align='center'><b>14</b></td>
<td align='center'><b>15</b></td>
<td align='center'><b>16</b></td>
</tr>
<tr>
<td align='center'><b>17</b></td>
<td align='center'><b>18</b></td>
<td align='center'><b>19</b></td>
<td align='center'><b>20</b></td>
<td align='center'><b>21</b></td>
<td align='center'><b>22</b></td>
<td align='center'><b>23</b></td>
</tr>
<tr>
<td align='center'><b>24</b></td>
<td align='center'><b>25</b></td>
<td align='center'><b>26</b></td>
<td align='center'><b>27</b></td>
<td align='center'><b>28</b></td>
<td align='center'><b>29</b></td>
<td align='center'><b>30</b></td>
</tr>
<tr>
<td align='center'><b>31</b></td>
<td align='center'><b> </b></td>
<td align='center'><b> </b></td>
<td align='center'><b> </b></td>
<td align='center'><b> </b></td>
<td align='center'><b> </b></td>
<td align='center'><b> </b></td>
</tr>
<tr>
</table>
NOTE:
Done on 8-23-2003.
^ Example: print max days for February 2004
print $A->CALENDAR(mode=>'max',month=>2,year=>04);
OUTPUT:
29
^ Example: print max days for February 2005
print $A->CALENDAR(mode=>'max',month=>2,year=>2005);
OUTPUT:
28
^ Epoch Time
DESCRIPTION:
Convert given date (or today) into epoch seconds format
USAGE:
$A->EPOCH_TIME(HASH)
PARAMETERS DESCRIPTION
seconds ---
accepts: 0-59 (defaults to current second)
minutes ---
accepts: 0-59 (defaults to current minute)
hours -----
accepts: 0-23 (defaults to current hour)
day -------
accepts: 1-31 (defaults to current day)
month -----
accepts: 1-12 (defaults to current month)
year ------
accepts: any integer (defaults to current year)
(0 and below will be in BC starting at 1)
^ Example: print current epoch seconds
print $A->EPOCH_TIME();
OUTPUT 1:
1010063753
^ Example: print epoch seconds for Mar 18, 1970 at 2:30 AM
print $A->EPOCH_TIME
(
seconds => 0,
minutes => 30,
hours => 2,
day => 18,
month => 3,
year => 1970
);
OUTPUT:
6597000
^ Example: print epoch seconds for Mar 18, 70 BC at 2:30 AM
print $A->EPOCH_TIME
(
seconds => 0,
minutes => 30,
hours => 2,
day => 18,
month => 3,
year => -69
);
OUTPUT:
-64338256801
^ Time
DESCRIPTION:
Convert given epoch seconds (or todays epoch seconds) into various formats
USAGE:
$A->TIMES(HASH)
PARAMETERS DESCRIPTION
mode ------ tyoe of action to perform
accepts:
MODE DESCRIPTION FORMAT
NULL ('') ---- unix format ------- DDD MMM DD HH:MM:SS YYYY
epoch -------- epoch seconds ----- DDDDDDDD
day ---------- day of week ------- DDD
date --------- day or month ------ DD
fmon --------- full month -------- MMMMMMM
smon --------- abbreviated month - MMM
nmon --------- numeric month ----- DD
year --------- full year --------- YYYY
yearbc ------- full year + ------- YYYY BC/AD
syear -------- short year -------- YY
mtime -------- military time ----- HH:MM:SS
hour --------- hour in military -- HH
aphour ------- hour in civilian -- HH
min ---------- minute ------------ MM
sec ---------- second ------------ SS
ampm --------- am or pm ---------- AM/PM
time --------- civilian time ----- HH:MM:SS AM/PM
timens ------- time no seconds --- HH:MM AM/PM
ndate -------- numeric date ------ MM/DD/YYYY
fdate -------- full date --------- MMMMMMM DD, YYYY
sdate -------- short date -------- MMM DD, YYYY
sdate_timens - sdate + timens ---- MMM DD, YYYY HH:MM AM/PM
raw ---------- unix format ------- DDD MMM DD HH:MM:SS YYYY
http --------- w3c format -------- DDD, DD MMM YYYY HH:MM:SS (+/- HH UT)
epoch ----- epoch seconds to gather results from
accepts: any integer (defaults to current epoch seconds)
seperator - set seperator on ndate to something other than /
^ Example: print with no arguments
print $A->TIMES();
OUTPUT
Thu Jan 3 21:18:16 2002
^ Example: print mtime
print $A->TIMES(mode=>'mtime');
OUTPUT
21:21:24
^ Example: print time
print $A->TIMES(mode=>'time');
OUTPUT
9:21:24 PM
^ Example: print timens
print $A->TIMES((mode=>'timens');
OUTPUT
9:21 PM
^ Example: print fdate
print $A->TIMES(mode=>'fdate');
OUTPUT
January 3, 2002
^ Example: print sdate_timens
print $A->TIMES(mode=>'sdate_timens');
OUTPUT
Jan 3, 2002 9:21 PM
^ Example: print http with epoch Mar 18, 1970 AD
print $A->TIMES(mode=>'http',epoch=>6597000);
OUTPUT
Thu, 18 Mar 1970 AD 02:30:00 (+06 UT)
^ Example: print http with epoch Mar 18, 70 BC
print $A->TIMES
(
mode=>'http',
epoch=>$A->EPOCH_TIME(day=>18,month=>3,year=>-69)
);
OUTPUT
Wed, 18 Mar 70 BC 00:00:00 (+06 UT)
^ Second Converter
DESCRIPTION:
Format seconds to weeks, days, hours, mins, secs
USAGE:
$A->SECONDS
PARAMETERS DESCRIPTION
second ---- number of seconds to convert
accepts: positive integer
mode ------ display format
accepts: NULL (''), formatted
^ Example: print formatted seconds
print $A->SECONDS( seconds=>'1209700', mode=>'formatted' );
OUTPUT 1:
2 Weeks, 0 Days, 0 Hours, 1 Mins, 40 Secs
^ Example: store array of weeks, days, hours, minutes, and seconds
my @format=$A->SECONDS( seconds=>'1209700' );
OUTPUT 2:
N/A - stores array [in this example: (2,0,0,1,40)]
^ AUTHOR
Shawn McKinley <shawn@perlhelp.com>
^ CREDITS
Most of these are fairly boring (not that this one is not), but given Perl is
Perl, and Larry said, 'Of course, in Perl culture, almost nothing is prohibited.
My feeling is that the rest of the world already has plenty of perfectly good
prohibitions, so why invent more?' http://www.perl.com/pub/a/1998/08/show/onion.html
I feel I am granted a bit of license on how I want to do my credits. There
is no one person or thing that I can contribute to the creation of this module.
So, here goes...
^ The center of the Apocalypse
This module has been built by standing on the shoulders of mental giants who
have a vision that I am only seeing the corona of:
Larry Wall (larry@wall.org) -
For creating such a great language and deciding to give it to the world
http://www.wall.org/~larry/
Randal L. Schwartz (merlyn@stonehenge.com) -
For teaching me Perl through 'Learning Perl', 'Learning Perl Objects,
References, & Modules', and various articles on the web
http://www.stonehenge.com/merlyn/columns.html
Lincoln D. Stein (lstein@cshl.org) -
This script would not have had a starting point without the immortal CGI.pm
http://stein.cshl.org/~lstein/
Tom Christiansen (tchrist@jhereg.perl.com) and
Nathan Torkington (gnat@frii.com) -
For the Perl Cookbook, I wouldn't have any hair without this book
Jeffrey E. F. Friedl (jfriedl@ora.com) -
For Mastering Regular Expressions, I've learned much from this book that
I see as indispensable while writing perl code!
http://regex.info/
Tim O'Reilly (ask_tim@oreilly.com) -
For the open source support and the wonderful books produced
http://tim.oreilly.com/
^ The knowledge base
I would never have learned Perl as quickly without the never ending stream of
information given by the Perl community. For the most part, they are tireless
givers who expect nothing in return. There are many, MANY more, but these are
the ones who consistently answered my questions and idly sat by and watched as
I made one stupid comment after another...
Bill '$Bill' Luebkert, Drieux (just Drieux), Tommy Butler, and Jeff 'Japhy'
Pinyan, Jendra Krynicky -
For answering questions day and night on mailing lists
(a lurker can learn a lot on these lists ;)
Jann Linder - http://www.perl.jann.com/index.php -
For a great email list devoted to asking and answering questions about CGI
ActiveState (activestate.com) -
For porting Perl over to a platform that I can 'fully' understand
I would also like to thank some of those who have lended knowledge in some
of the modules:
TIME.pm
Claus Tøndering - http://www.tondering.dk/claus/calendar.html
Many thanks for posting such a large amount of knowledge about the
history of time!
John Walker - http://www.fourmilab.ch/earthview/help/timedate.html
HTML.pm & HTML_FORMS.pm
w3c.org Thanks for keeping such tidy records of the HTML specification.
^ The close community
A while back, as I was still running from CGI.pm, my business partner found
a new Perl Mongers group not too far away from us. We decided to join, well,
since like everything else Perl, it was free, why not? We went to the
first meeting, and WOW, do these people know their stuff! It was here that
I had my first glimpse of the power of modules and OO programming. To their
credit, they listened to me whine about how 'I could do that without OO, so
why bother' without throwing anything at me. I thank all of you at that
meeting (and those who could not make it too) for sharing your ideas with
the rest of us!
Jasmine Merced-Ownbey -
For starting this group, and for playing the "Devil's Advocate"
Dana & Michelle Diederich -
Yes, I now understand why 'horns' work, thank you :-)
Page Underwood -
For the lengthy emails that made such good reading and discussion
Mike Marois -
Well, for just not bringing up a shotgun and shooting me for being too busy
^ The driving force
To a person I owe a lot, that I could never repay. He was the guy who said,
'Hey, there is this little language called Perl that I think we should take
a look at...' I still wonder if it is him on the other end of the phone
when it rings at 2 in the morning, and if I am going to get an earful of
'Where do you geeks come up with this $*@!, how am I supposed to debug this
crap?!!?! Learn to write longer variable names!!!!' Please, keep your
cement truck at home...
Bill Stephenson -
For pushing me to learn new ideas and constantly questioning my current ones
^ The center of my universe
Oh, and, lets not forget my wife and children, who consider themselves a
computer widow and computer orphans. They have given up movies, parties,
family gatherings, and basic companionship in my never-ending pursuit of
programming. Thank you for understanding, and not leaving me standing...
alone.
Tami Mckinley
Nathan McKinley
Seth McKinley
^ The Power of it all
I thank God for all the resources He has given the world. I thank Christ for
the thousands of second chances He has given me, and the abilty to grow from
these mistakes.