thanks for the help, if anyone cares:
package Table;
#
#
# Generic HTML Table Object
#
#
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = {};
$self->{TABLE_OPEN} = undef;
$self->{TABLE_CLOSE} = undef;
$self->{ROW_OPEN} = undef;
$self->{ROW_CLOSE} = undef;
$self->{COL_OPEN} = undef;
$self->{COL_CLOSE} = undef;
$self->{NAME} = undef;
$self->{VALUE} = undef;
bless ($self, $class);
return $self;
}
#################################################
sub table_open {
my $self = shift;
if (@_) { $self->{TABLE_OPEN} = shift }
return print "<table $self->{TABLE_OPEN}>\n";
}
sub table_close {
my $self = shift;
if (@_) { $self->{TABLE_CLOSE} = shift }
return print "</table>\n";
}
sub row_open {
my $self = shift;
if (@_) { $self->{ROW_OPEN} = shift }
return print "\t<tr $self->{ROW_OPEN}>\n";
}
sub row_close {
my $self = shift;
if (@_) { $self->{ROW_CLOSE} = shift }
return print "\t</tr>\n";
}
sub col_open {
my $self = shift;
if (@_) { $self->{COL_OPEN} = shift }
return print "\t\t<td $self->{COL_OPEN}>\n";
}
sub col_close {
my $self = shift;
if (@_) { $self->{COL_CLOSE} = shift }
return print "\t\t</td>\n";
}
sub name {
my $self = shift;
if (@_) { $self->{NAME} = shift }
return print "\t\t\t$self->{NAME}\n";
}
sub value {
my $self = shift;
if (@_) { $self->{VALUE} = shift }
return print "\t\t\t$self->{VALUE}\n";
}
1;
################################################
# script i'm using to interface
#!/usr/bin/perl -w
use CGI::Carp 'fatalsToBrowser';
use strict;
use Web; # my web processing module
use Table;
my ($website) = 'dev.merchantonline.com';
my ($i) = undef;
$|=1;
&parse();
# parse html post/get using the Web module
&check_referer($website);
# check refering url using the Web module
&check_required('test');
# check required fields using the Web module
print "Content-type:text/html\n\n";
print "<html>\n<body>\n";
print "test = " . $in{'test'} . "<br><br>\n";
my($table) = new Table();
$table->table_open('width=500');
foreach $i (sort keys %in){
$table->row_open();
$table->col_open();
$table->name($i);
$table->col_close;
$table->col_open;
$table->value($in{$i});
$table->col_close;
$table->row_close;
}
$table->table_close;
print "got here\n";
exit;
|