MANIFEST
Changes
-lib/Apache/MVC/Model/Base.pm
-lib/Apache/MVC/Model/CDBI.pm
-lib/Apache/MVC/Workflow.pod
-lib/Apache/MVC/View/TT.pm
+lib/Maypole/Model/Base.pm
+lib/Maypole/Model/CDBI.pm
+lib/Maypole/View/TT.pm
+lib/Maypole/Workflow.pod
+lib/Maypole.pm
lib/Apache/MVC.pm
lib/BeerDB.pm
t/1.t
use Class::DBI::Loader::Relationship;
# This line is required if you don't have Apache calling Perl handlers
# as methods.
-sub handler { Apache::MVC::handler(__PACKAGE__, @_) }
+sub handler { Maypole::handler(__PACKAGE__, @_) }
# This is the sample application. Change this to the path to your
# database. (or use mysql or something)
use Lingua::EN::Inflect::Number qw(to_PL);
use Class::DBI::AsForm;
use Class::DBI::FromCGI;
+use Class::DBI::Loader;
use Class::DBI::AbstractSearch;
use Class::DBI::Plugin::RetrieveAll;
use Class::DBI::Pager;
$r->objects([ $self->retrieve_all ]);
}
}
+
+sub setup_database {
+ my ($self, $config, $namespace, $dsn) = @_;
+ $config->{dsn} = $dsn;
+ $config->{loader} = Class::DBI::Loader->new(
+ namespace => $namespace,
+ dsn => $dsn
+ );
+ $config->{classes} = [ $config->{loader}->classes ];
+ $config->{tables} = [ $config->{loader}->tables ];
+}
+
+sub class_of {
+ my ($self, $r, $table) = @_;
+ return $r->config->{loader}->_table2class($table);
+}
+
1;