Something
public text v1 · immutableFrom lib/MyApp/Controller/Root.pm:
sub list_posts :Args(0) :Path {
my ($self, $c) = @_;
my @posts :Stashed = $c->model('MyDBI')->get_modems();
my $template :Stashed = 'allpost.tt2';
}
From lib/MyApp/Model/MyDBI.pm:
package MyApp::Model::MyDBI;
use strict;
use base 'Catalyst::Model::DBI';
__PACKAGE__->config(
dsn => 'dbi:mysql:dbname',
user => 'root',
password => '',
options => {},
);
sub get_modems {
my ($self, $c) = @_;
my $dbh = $c->model('MyDBI')->dbh;
}