CatalystX-ListFramework
view release on metacpan or search on metacpan
t/lib/TestApp/Controller/Root.pm view on Meta::CPAN
9293949596979899100101102103104105106107108109110111112
$c
->view(
'JSON'
)->process(
$c
);
}
sub
resetdb :Path(
'/start'
) {
my
(
$self
,
$c
) =
@_
;
my
$dbfile
=
"/tmp/__listframework_testapp.sqlite"
;
if
(-e
$dbfile
) {
unlink
$dbfile
or
die
"Failed to unlink $dbfile: $!"
; }
my
$dbh
= DBI->
connect
(
"dbi:SQLite2:dbname=$dbfile"
,
""
,
""
);
open
my
$sql_fh
,
$c
->config()->{
'sql_path'
}.
'/test_app.sql'
or
die
"Can't read SQL file: $!"
;
local
$/ =
""
;
## empty line(s) are delimeters
while
(
my
$sql
= <
$sql_fh
>) {
$dbh
->
do
(
$sql
);
}
$dbh
->disconnect;
close
$sql_fh
;
$c
->res->redirect(
"/listsearch/track"
);
#$c->res->output('reset ok');
}
( run in 0.228 second using v1.01-cache-2.11-cpan-9b1e4054eb1 )