This is just a rough example.
Check out some of the tutorials on Modules
package <path>::CommonModule;
use strict;
sub new {
my $self = bless({}, shift);
## So you could parse a multiple-valued hash if needed
for (my $i=0; $i<@_; $i+=2) {
defined($_[($i + 1)]) || die("CommonModule called with odd number
+of parameters");
$self->{$_[$i]} = $_[($i+1)];
}
return $self;
}
sub process_data {
my $self = shift;
## something similar to your current cgi script processing
my $form_item = $self->{formdata}->param('formname'); # get the for
+m data
...
...
my %templ_hash = (
#just like you would create your template hash
...
);
return %templ_hash;
}
1; # Don't forget to add this.