line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::Changeset::App; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
38196
|
use warnings; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
63
|
|
4
|
2
|
|
|
2
|
|
17
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
66
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
10
|
use base qw/App::Cmd/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1701
|
|
7
|
2
|
|
|
2
|
|
95113
|
use YAML 'LoadFile'; |
|
2
|
|
|
|
|
16304
|
|
|
2
|
|
|
|
|
139
|
|
8
|
2
|
|
|
2
|
|
1625
|
use Path::Class 'file'; |
|
2
|
|
|
|
|
113468
|
|
|
2
|
|
|
|
|
174
|
|
9
|
2
|
|
|
2
|
|
7708
|
use Hash::Merge qw( merge ); |
|
2
|
|
|
|
|
6142
|
|
|
2
|
|
|
|
|
160
|
|
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
18
|
use vars qw{$VERSION}; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
102
|
|
12
|
|
|
|
|
|
|
BEGIN { |
13
|
2
|
|
|
2
|
|
450
|
$VERSION = '1.11'; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
DBIx::Changeset::App - Main App File to the command line app |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Main App File to the command line app |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
create a script like so: |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
#!/usr/bin/env perl |
27
|
|
|
|
|
|
|
use DBIx::Changeset::App; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $cmd = DBIx::Changeset::App->new(); |
30
|
|
|
|
|
|
|
$cmd->config('config.yml'); |
31
|
|
|
|
|
|
|
$cmd->run; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 METHODS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head2 config |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Load Given YAML files as config |
39
|
|
|
|
|
|
|
expects a YAML File with following format |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
globaloption: |
42
|
|
|
|
|
|
|
command: |
43
|
|
|
|
|
|
|
commandoption: |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
46
|
|
|
|
|
|
|
sub config { |
47
|
3
|
|
|
3
|
1
|
10059
|
my ($app,$config) = @_; |
48
|
|
|
|
|
|
|
|
49
|
3
|
|
|
|
|
20
|
$app->{'config'} = {}; |
50
|
3
|
|
|
|
|
21
|
Hash::Merge::set_behavior( 'RIGHT_PRECEDENT' ); |
51
|
|
|
|
|
|
|
|
52
|
3
|
|
|
|
|
64
|
my @config_files; |
53
|
3
|
100
|
66
|
|
|
34
|
if ( defined $config && ref $config eq 'ARRAY' ) { |
54
|
2
|
|
|
|
|
4
|
@config_files = @{$config}; |
|
2
|
|
|
|
|
7
|
|
55
|
|
|
|
|
|
|
} else { |
56
|
1
|
|
50
|
|
|
13
|
my $config_file = $config || 'config.yml'; |
57
|
1
|
|
|
|
|
4
|
push @config_files, $config_file; |
58
|
|
|
|
|
|
|
} |
59
|
3
|
|
|
|
|
9
|
foreach my $config_file ( @config_files ) { |
60
|
5
|
50
|
|
|
|
23
|
$config_file = file('.', $config_file) unless file($config_file)->is_absolute; |
61
|
5
|
50
|
|
|
|
1453
|
next unless -e $config_file; |
62
|
5
|
|
|
|
|
283
|
my $conf = LoadFile($config_file); |
63
|
5
|
|
|
|
|
31121
|
%{$app->{'config'}} = %{ merge( $app->{'config'}, $conf ) }; |
|
5
|
|
|
|
|
2765
|
|
|
5
|
|
|
|
|
28
|
|
64
|
|
|
|
|
|
|
} |
65
|
3
|
|
|
|
|
26
|
return; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head2 default_plugin |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Called by App::Cmd to set the default command when none is given this should automatically be |
71
|
|
|
|
|
|
|
'help' with documented default_command method but doest work so must be a bug in App::Cmd.. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub default_plugin { |
76
|
0
|
|
|
0
|
1
|
|
return 'help'; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Copyright 2004-2008 Grox Pty Ltd. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
84
|
|
|
|
|
|
|
under the same terms as Perl itself. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
The full text of the license can be found in the LICENSE file included with this module. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=cut |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; # End of DBIx::Changeset |