NAME
webtools - Full featured WEB Development Tools (compare with Php language) in Perl syntax
DESCRIPTION
This package is written in pure Perl and its main purpose is: to help all Web developers. It brings in self many features of modern Web developing:
- Grabs best of Php but in Perl syntax.
- Embedded Perl into HTML files.
- Buffered output.
- Easy reading input forms and cookies using global variables.
- Flat files database support.
- MySQL/MS Access support.
- Full Sessions support (via flat files or via DB)
- Easy User support (SignIn / SignUp)
- Cookies support.
- Attached variables.
- Html/SQL templates and variables.
- Mail functions (plain/html mails/uploads)
- Upload/download functions via Perl scripts.
- DES III encription/decription in MIME style
and more...
SYNOPSIS
Follow example show session capabilities, when WebTools is configured with
Flat file session support(default):
<?perl
$sid = session_start();
%h = read_hash('myhash');
if($h{'city'} ne "Pleven")
{
print "<B>New session started!</B>";
%h = (city=>"Pleven",country=>"Bulgaria");
$reg_data = register_var('hash','myhash',%h);
# $reg_data .= register_var('scalar','scl_name',$cnt);
# $reg_data .= register_var('array',''arrname',@arr);
session_register($reg_data);
}
else
{
print "Current session is: <B>$sid</B> <BR> and registrated data are:<BR>";
print "Country: <B>".$h{'country'}."</B><BR>";
print "City: <B>".$h{'city'}."</B><BR>";
session_destroy();
print "Session Destroyed!";
}
Header(type=>'content',val=>'text/html; charset=Windows-1251');
# SURPRISE: We send header after html data??? (Is Php capable of this? ;-)
?>
Above code can be saved in 'htmls' directory under 'test.whtml' file name and you can
run it in browser location with follow line:
http://your_host.com/cgi-bin/webtools/process.cgi?file=test.whtml
Code below show how easy is to send e-mails with WebTools
(Don't forget to set $debug_mail = 'off' in config.pl)
<?perl
require 'mail.pl';
$to = 'some@where.com';
$from = 'me@myhost.com';
$subject = 'Test';
$body = 'Hello there!';
$orginal_filename = $uploaded_original_file_names{'myupload'};
# 'myupload' is name of input field in html form.
$fn = $uploaded_files{'myupload'};
set_mail_attachment($orginal_filename,$fn);
send_mail($from,$to,$subject,$body);
print 'Mail sent!';
?>
Above code can be saved in 'htmls' directory under 'mail.whtml' file name and you can
run it in browser location with follow line:
http://your_host.com/cgi-bin/webtools/process.cgi?file=mail.whtml
Please read HELP.doc and see all examples in docs/examples directory