package Max; use strict; use DBI; my $robi; <------------ DEFINE THIS VARIABLE AT LOAD TIME my $dbh = DBI->connect("dbi:SQLite:dbname=$robi", "", "",{RaiseError=>1, AutoCommit=>1}); print "$robi"; ################################################## sub new { ################################################## my ($class) = @_; my $hash = {}; bless($hash,$class); } ################################################## sub createtable{ ################################################## my ($self, %arg)=@_; my $form = $self->{form}=$arg{form}; my $tabler = $self->{table}=$arg{table}; $self->drop(argument => $tabler); my $stm = "create table $tabler ($form)"; $self->do_it_db(argument => $stm); } ################################################## sub do_it_db { ################################################## my ($self, %arg) =@_; my $stm = $self->{argument}=$arg{argument}; my $st = $dbh->prepare($stm); $st ->execute(); } ################################################## sub drop { ################################################## my ($self,%arg) = @_; my $arg = $self->{argument}=$arg{argument}; my $statement = "drop table if exists $arg"; $self-> do_it_db(argument => $statement) } 1;