-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlog.pm
46 lines (37 loc) · 786 Bytes
/
Blog.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package Blog;
use DBI;
use Data::Dumper;
use Moose;
extends 'DedicatedToServers';
our $dbh = DedicatedToServers->DbConnect();
sub new {
my $class = shift;
my $self = $class->SUPER::new; # attrs inherited from Employee
$self->{extended} = 1;
return $self;
}
sub GetIndex() {
my $sth = $dbh->prepare("
SELECT *
FROM Pages
WHERE
PageName = 'index'"
);
$sth->execute() or die $DBI::errstr;
my $results = $sth->fetchall_arrayref({});
return($results);
$sth->finish();
}
sub WhoAmI() {
my $sth = $dbh->prepare("
SELECT *
FROM Pages
WHERE
PageName = 'whoami'"
);
$sth->execute() or die $DBI::errstr;
my $results = $sth->fetchall_arrayref({});
$sth->finish();
return($results);
}
1;