File: stag-check-resources.pl

package info (click to toggle)
libdbix-dbstag-perl 0.12-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,420 kB
  • sloc: perl: 6,152; sql: 588; xml: 221; lisp: 59; makefile: 20
file content (49 lines) | stat: -rwxr-xr-x 780 bytes parent folder | download | duplicates (3)
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
#!/usr/local/bin/perl

# cjm@fruitfly.org

use strict;
use Carp;
use DBIx::DBStag;
use Data::Stag qw(:all);
use Data::Dumper;
use Getopt::Long;

my $h = {};

my $term;
my @hist = ();

my $match = shift;
# parent dbh
my $sdbh = 
  DBIx::DBStag->new;

my $resources = $sdbh->resources_list;
foreach my $r (@$resources) {
    next unless $r->{type} eq 'rdb';
    my $name = $r->{name};
    eval {
        my $testdbh = DBIx::DBStag->connect($name);
        $testdbh->disconnect;
    };
    my $ok = $@ ? 'FAIL' : 'PASS';
    printf "%12s $ok\n", $name;
}
exit 0;

__END__

=head1 NAME 

stag-check-resources.pl

=head1 SYNOPSIS

  stag-check-resources.pl

=head1 DESCRIPTION

Iterates all resources pointed at in DBSTAG_DBIMAP_FILE and determines if they are accessible or not

=cut