NAME

DBIx::HTMLView::CGIView - For creating CGI userinterfacees to DBI databases.

SYNOPSIS

package MyCGIViewer;

use DBIx::HTMLView::CGIView; @ISA = ("DBIx::HTMLView::CGIView");

sub new { my ($class,$db,$fmt,$query)=@_; my $self = $class->SUPER::new($db,$fmt,$query);

  my $table=$self->{'Form'}{'_Table'};
	$self->InitDb($table);

	return $self;
}

sub PrintPage { my ($self, $script) =@_;

	# Generate page...
  foreach ($self->List("SELECT * FROM $self->{'Form'}{'_Table'}",', ')) { 
	  print "$_->[1]: ". $self->ml($script, $_->[0], "Show") . "<br>\n";
  }

  $self->Foot();
}

# Overriden and new methods follow here...

# And then to test it use CGI; use MyCGIViewer;

my $query=new CGI({'_Table' => 'Test'}); my $db="DBI:mSQL:HTMLViewTester:athena.af.lu.se:1114"; new MyCGIViewer($db, {}, $query)->PrintPage("View.cgi");

DESCRIPTION

This is a subclass of DBIx::HTMLView to create cgi interfaces.

METHODS

$v=new DBIx::HTMLView::CGIView($db,$fmt,$query);

Creates a new CGIView object passing $db and $fmt to the DBIx::HTMLView constructor. It will also take care of the CGI input in $query, which should be a new CGI object, and place the key/value pairs in a hash in $v->{'Form'}, and call the $v->Head method to generate the headder.

It also makes sure thet the current table in the _Table varibale in $query is svaed in future calls by using SetParam.

$v->Head

Prints the page headder to stdout. The idea is to override this method if you want to chnage the headder.

$v->Foot

Prints the page footer to stdout. The idea is to override this method if you want to chnage the footer.

Author

Hakan Ardo <hakan@debian.org>