Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package null::DB;
- use strict;
- use warnings;
- use DBI;
- use Mojo::Home;
- use Data::Dumper;
- my $user = "";
- my $password = "";
- my $dbh;
- my $sth;
- sub blog {
- my $self = shift;
- return $dbh if $dbh;
- my $home = Mojo::Home->new->detect('null');
- $dbh = DBI->connect("dbi:mysql:nullim", "$user", "$password");
- $sth = $dbh->prepare("SELECT * FROM posts ORDER BY id DESC");
- $sth->execute();
- # ->stash(posts => $model->blog('whatever'));
- my @output = $sth->fetchrow_array();
- return @output;
- }
- 1;
Add Comment
Please, Sign In to add comment