Apps/Database/ExtractGlobals.pm

filter: Statementstmt 66.6% 4 / 6 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 75.0% 6 / 8 CC 1 SCAR 1.4
CC
1
Cov
67%
BEGIN
1.3
BEGIN
1.0
CRAP 1.1
« Apps/Database/ExtractData.pm ↑ Summary Apps/Database/RemoveData.pm »
1 package XAS::Apps::Database::ExtractGlobals;
2  
3 our $VERSION = '0.02';
4  
5 1 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 use XAS::Class
7 0 ▶ version => $VERSION,
Subroutine BEGIN: called CC=1 SCAR=2.6
8 base => 'XAS::Lib::App',
9 accessors => 'file database',
10 0 ;
11  
12 # ----------------------------------------------------------------------
13 # Public Methods
14 # ----------------------------------------------------------------------
15  
16 sub parse_file {
17 my $self = shift;
18  
19 my $fh;
20 my $database = $self->database;
21  
22 open($fh, "<", $self->file);
23  
24 while (<$fh>) {
25  
26 if ($_ =~ m/^\\connect $database/) {
27  
28 print $_;
29  
30 while (<$fh>) {
31  
32 return if ($_ =~ m/^\\connect/);
33  
34 print $_;
35  
36 }
37  
38 }
39  
40 }
41  
42 }
43  
44 sub main {
45 my $self = shift;
46  
47 $self->log->debug('starting main section');
48  
49 $self->parse_file();
50  
51 $self->log->debug('ending main section');
52  
53 }
54  
55 sub options {
56 my $self = shift;
57  
58 $self->{'file'} = '';
59 $self->{'database'} = '';
60  
61 return {
62 'file=s' => \$self->{'file'},
63 'database=s' => \$self->{'database'},
64 };
65  
66 }
67  
68 # ----------------------------------------------------------------------
69 # Private Methods
70 # ----------------------------------------------------------------------
71  
72 1;
73  
74 __END__
« Apps/Database/ExtractData.pm ↑ Summary Apps/Database/RemoveData.pm »