line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bio::GMOD::Util::Status; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# This simple module doesn't do much of interest |
4
|
|
|
|
|
|
|
# It provides several some methods for generating |
5
|
|
|
|
|
|
|
# warnings and handling errors |
6
|
|
|
|
|
|
|
|
7
|
14
|
|
|
14
|
|
27392
|
use strict; |
|
14
|
|
|
|
|
49
|
|
|
14
|
|
|
|
|
474
|
|
8
|
14
|
|
|
14
|
|
7022
|
use Bio::GMOD::Util::Rearrange; |
|
14
|
|
|
|
|
35
|
|
|
14
|
|
|
|
|
6654
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
######################################################### |
11
|
|
|
|
|
|
|
# Utilities |
12
|
|
|
|
|
|
|
######################################################### |
13
|
|
|
|
|
|
|
# This is appended to the messages log to signify to the application |
14
|
|
|
|
|
|
|
# that the update process has ended |
15
|
|
|
|
|
|
|
#sub end { |
16
|
|
|
|
|
|
|
# my $msg = shift; |
17
|
|
|
|
|
|
|
# print MESSAGES "__UPDATE_$msg" . "__\n"; |
18
|
|
|
|
|
|
|
# logit('===========================================================',1); |
19
|
|
|
|
|
|
|
# logit("Updating complete: $msg"); |
20
|
|
|
|
|
|
|
# logit('===========================================================',1); |
21
|
|
|
|
|
|
|
# close MESSAGES; |
22
|
|
|
|
|
|
|
#} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub logit { |
26
|
2
|
|
|
2
|
1
|
8
|
my ($self,@p) = @_; |
27
|
2
|
|
|
|
|
15
|
my ($msg,$die,$emphasis) = rearrange([qw/MSG DIE EMPHASIS/],@p); |
28
|
2
|
|
|
|
|
17
|
my $date = $self->fetch_date; |
29
|
2
|
|
|
|
|
34
|
$msg =~ s/\n$//; |
30
|
2
|
50
|
|
|
|
51
|
if ($emphasis) { |
31
|
0
|
|
|
|
|
0
|
print STDERR "$msg...\n"; |
32
|
0
|
0
|
|
|
|
0
|
print STDERR '=' x (length "$msg...") . "\n" if $emphasis; |
33
|
|
|
|
|
|
|
} else { |
34
|
2
|
|
|
|
|
368
|
print STDERR "[$date] $msg...\n"; |
35
|
|
|
|
|
|
|
} |
36
|
2
|
50
|
|
|
|
970
|
die if $die; |
37
|
|
|
|
|
|
|
# my $adaptor = $self->adaptor; |
38
|
|
|
|
|
|
|
# $self->gui_messages($msg) if $adaptor->gui_messages; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# For recording non-fatal errors |
43
|
|
|
|
|
|
|
sub warning { |
44
|
0
|
|
|
0
|
1
|
0
|
my ($self,@p) = @_; |
45
|
0
|
|
|
|
|
0
|
my ($msg) = rearrange([qw/MSG/],@p); |
46
|
0
|
|
|
|
|
0
|
print STDERR "----> $msg\n"; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub test_for_error { |
50
|
0
|
|
|
0
|
1
|
0
|
my ($self,$result,$msg) = @_; |
51
|
0
|
0
|
|
|
|
0
|
if ($result != 0) { |
52
|
0
|
|
|
|
|
0
|
$self->logit(-msg => "----> $msg: failed, $!\n", |
53
|
|
|
|
|
|
|
-die => 1,); |
54
|
|
|
|
|
|
|
} else { |
55
|
0
|
|
|
|
|
0
|
$self->logit(-msg => "$msg: succeeded"); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub fetch_date { |
60
|
|
|
|
|
|
|
# my $date = `date '+%Y %h %d (%a) at %H:%M'`; |
61
|
2
|
|
|
2
|
1
|
22933
|
my $date = `date '+%Y %h %d %H:%M'`; |
62
|
2
|
|
|
|
|
49
|
chomp $date; |
63
|
2
|
|
|
|
|
70
|
return $date; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# DEPRECATED? |
68
|
|
|
|
|
|
|
# The messages log is used to display brief messages |
69
|
|
|
|
|
|
|
# above the progress meter of the application |
70
|
|
|
|
|
|
|
sub gui_messages { |
71
|
0
|
|
|
0
|
0
|
|
my ($self,$msg) = @_; |
72
|
|
|
|
|
|
|
# print MESSAGES "$msg...\n"; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
__END__ |