My Perl Libs


     EL::cgi - Perl API to CGI an mod_perl programing


     use EL::cgi;
     my $cgi = EL::cgi->new;


     This lib  retry parameters  send by  HTTP POST  and GET  form submit
     method, valid and then create HTML out using a template. It do other
     things too, as embeded parameters in URL and redirection.
     This lib  uses the template  paradigm, therefore  I think to  be the
     more organized and productive way to CGI programing.


     $cgi->get($param) or $cgi->get()
         Get parameters send by HTTP POST and GET form submit method.
     $cgi->set($param,$value) or $cgi->set(%params)
         Set parameters that will be include in template file. Parameters
         receive  by  HTTP  POST  and  GET form  submit  method  are  set
         Get files submitted by '<input type="file">', where $info is:
             name: name of the file, the same that $cgi->get($param)
             size: size (in bytes) of the file
             type: type (ex.: text/html) of the file
             data: data of the file
         Embeded parameters in URLs.
         Redirect HTTP request to URL especified in `$url'.
     $cgi->valid({ %rex })
         Valid  parameters with  base in  regular expressions  defined in
         Send HTML output.


     -- PERL FILE:
     use strict;
     use EL::cgi;
     my $cgi = EL::cgi->new;
     my %h = (
         op1 => {
             dsc => 'Operator 1',
             rex => '\d+',
             msg => 'Type any number !!',
         ope => {
             dsc => 'Operation',
             rex => '[+-*/]',
             msg => 'Operation are "+", "-", "*", "/"',
         ope2 => {
             dsc => 'Operator 2',
             rex => '\d+',
             msg => 'Type any number',
     if (not $cgi->valid({%h})) {
     else {
         my $r = eval '$r = ' $cgi->get('op1') . $cgi->get('ope') . $cgi->get('op2');
     -- TEMPLATE FILE: calc.html
     <form action="" method="post">
         <input type="text" name="op1" value="<TMPL_VAR op1>">
         <select name="ope">
             <option value="+">
             <option value="-">
             <option value="*">
             <option value="/">
         <input type="text" name="op2" value="<TMPL_VAR op2>">
         <TMPL_VAR result>


     Ednardo Lobo <>


     EL::lib, HTML::Template