Repository navigation
Expand file tree
/
Copy pathMGRAST.pm
More file actions
61 lines (40 loc) · 1.3 KB
/
Copy pathMGRAST.pm
File metadata and controls
61 lines (40 loc) · 1.3 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package DataHandler::MGRAST;
# DataHandler::RAST - data handler to the PPO RAST database
# $Id: MGRAST.pm,v 1.2 2009-10-12 13:40:43 paczian Exp $
use strict;
use warnings;
use base qw( DataHandler );
use DBMaster;
use Conf;
=pod
=head1 NAME
DataHandler::MGRAST - data handler to the PPO MGRAST database
=head1 DESCRIPTION
This module returns the DBMaster object to the MGRAST database stored in the root
job directory of a MGRAST server. It requires the Conf.pm to specify the
$mgrast_jobs directory.
Refer to WebApplication/DataHandler.pm for the full documentation.
=head1 METHODS
=over 4
=item * B<handle> ()
Returns the enclosed data handle. Returns undef if it fails to open the Jobs database
=cut
sub handle {
my ($self) = @_;
unless (exists $self->{_handle}) {
eval {
$self->{_handle} = DBMaster->new( -database => $Conf::mgrast_jobcache_db || 'JobCacheMGRast',
-host => $Conf::mgrast_jobcache_host,
-user => $Conf::mgrast_jobcache_user,
-password => $Conf::mgrast_jobcache_password );
};
if ($@) {
warn "Unable to connect to MGRAST database: $@\n";
$self->{_handle} = undef;
}
}
$self->{_handle}->{_application} = $self->application;
$self->{_handle}->{_user} = $self->application->session->user;
return $self->{_handle};
}
1;