Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- EX.pm
- -----
- has forumdb => sub {
- my $self = shift;
- my $dbh = DBI->connect(
- 'dbi:mysql:database=php_BB;host=localhost','user', 'pass',
- {RaiseError => 1}
- );
- return $dbh;
- };
- # This method will run once at server start
- sub startup {
- my $self = shift;
- # setup the DB connector here, because mysql disappears, this will stop that from happening
- $self->helper('forumdb' => sub { return shift->app->forumdb });
- $self->plugin('EX::DBHelpers');
- }
- ------------
- DBHelpers.pm
- ------------
- eval { $sth = $self->forumdb->prepare($sql) };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement