sub list :Local {
# Retrieve the usual Perl OO '$self' for this object. $c is the Catalyst
# 'Context' that's used to 'glue together' the various components
# that make up the application
my ($self, $c) = @_;
# Retrieve all of the book records as book model objects and store in the
# stash where they can be accessed by the TT template
#$c->stash(resultset => [$c->model('DB::User')->all]);
$c->stash (resultset => $c->model('DB::User')->all);
use Data::Dumper;
my $aref = $c->model('User');
$c->log->debug( Dumper $aref );
# Set the TT template to use. You will almost always want to do this
# in your action methods (action methods respond to user input in
# your controllers).
$c->stash(template => 'main/list.tt');
}
####
[% cols = resultset.result_source.columns; FOREACH x IN cols; "" _ resultset.$x _ ""; END %]
[% # FOREACH row IN resultset %]Username: [% #row.username %]
[% #END %]
| User Name |
Password |
Email |
FName |
LName |
Active |
[% FOREACH row IN resultset %]
| [% row.username %] |
[% row.password %] |
[% row.email_address %] |
[% row.first_name %] |
[% row.last_name %] |
[% row.active %] |
[% END %]
####
$c->stash (resultset => $c->model('DB::User')->all);
####
$c->stash (resultset => [$c->model('DB::User')->all]);
####
# the long way
my $rs = $c->model('FilmDB')->schema->resultset('Actor');
# using the shortcut method on the model object
my $rs = $c->model('FilmDB')->resultset('Actor');
# using the generated class directly
my $rs = $c->model('FilmDB::Actor');
####
my $dbic = $c->model('FilmDB')->schema;
my $dbic = $c->model('DB::FilmDB')->schema;