| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Pg::CLI::pg_dump; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1659
|
use strict; |
|
|
1
|
|
|
|
|
7
|
|
|
|
1
|
|
|
|
|
26
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
21
|
|
|
5
|
1
|
|
|
1
|
|
421
|
use namespace::autoclean; |
|
|
1
|
|
|
|
|
18959
|
|
|
|
1
|
|
|
|
|
3
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.14'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
582
|
use Moose; |
|
|
1
|
|
|
|
|
450015
|
|
|
|
1
|
|
|
|
|
6
|
|
|
10
|
1
|
|
|
1
|
|
7879
|
use MooseX::SemiAffordanceAccessor; |
|
|
1
|
|
|
|
|
12832
|
|
|
|
1
|
|
|
|
|
4
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
with qw( Pg::CLI::Role::Connects Pg::CLI::Role::Executable ); |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
__PACKAGE__->meta()->make_immutable(); |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
1; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# ABSTRACT: Wrapper for the F<pg_dump> utility |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
__END__ |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=pod |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=encoding UTF-8 |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 NAME |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Pg::CLI::pg_dump - Wrapper for the F<pg_dump> utility |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 VERSION |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
version 0.14 |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $pg_dump = Pg::CLI::pg_dump->new( |
|
37
|
|
|
|
|
|
|
username => 'foo', |
|
38
|
|
|
|
|
|
|
password => 'bar', |
|
39
|
|
|
|
|
|
|
host => 'pg.example.com', |
|
40
|
|
|
|
|
|
|
port => 5433, |
|
41
|
|
|
|
|
|
|
); |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
$pg_dump->run( |
|
44
|
|
|
|
|
|
|
database => 'database', |
|
45
|
|
|
|
|
|
|
options => [ '-C' ], |
|
46
|
|
|
|
|
|
|
); |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my $sql; |
|
49
|
|
|
|
|
|
|
$pg_dump->run( |
|
50
|
|
|
|
|
|
|
database => 'database', |
|
51
|
|
|
|
|
|
|
options => [ '-C' ], |
|
52
|
|
|
|
|
|
|
stdout => \$sql, |
|
53
|
|
|
|
|
|
|
); |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
This class provides a wrapper for the F<pg_dump> utility. |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 METHODS |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
This class provides the following methods: |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 Pg::CLI::pg_dump->new( ... ) |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
The constructor accepts a number of parameters: |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=over 4 |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=item * executable |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
The path to F<pg_dump>. By default, this will look for F<pg_dump> in your path |
|
72
|
|
|
|
|
|
|
and throw an error if it cannot be found. |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=item * username |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
The username to use when connecting to the database. Optional. |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item * password |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
The password to use when connecting to the database. Optional. |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item * host |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
The host to use when connecting to the database. Optional. |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item * port |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
The port to use when connecting to the database. Optional. |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item * require_ssl |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
If this is true, then the C<PGSSLMODE> environment variable will be set to |
|
93
|
|
|
|
|
|
|
"require" when connecting to the database. |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=back |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head2 $pg_dump->run( database => ..., options => [ ... ] ) |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
This method dumps the specified database. Any values passed in C<options> will |
|
100
|
|
|
|
|
|
|
be passed on to pg_dump. |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
This method also accepts optional C<stdin>, C<stdout>, and C<stderr> |
|
103
|
|
|
|
|
|
|
parameters. These parameters can be any defined value that could be passed as |
|
104
|
|
|
|
|
|
|
the relevant parameter to L<IPC::Run3>'s C<run3> subroutine. |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Notably, you can capture the dump output in a scalar reference for the |
|
107
|
|
|
|
|
|
|
C<stdout> output. |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head2 $pg_dump->version() |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Returns a the three part version as a string. |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head2 $pg_dump->two_part_version() |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Returns the first two decimal numbers in the version. |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 SUPPORT |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Bugs may be submitted at L<http://rt.cpan.org/Public/Dist/Display.html?Name=Pg-CLI> or via email to L<bug-pg-cli@rt.cpan.org|mailto:bug-pg-cli@rt.cpan.org>. |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>. |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 SOURCE |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
The source code repository for Pg-CLI can be found at L<https://github.com/houseabsolute/Pg-CLI>. |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 AUTHOR |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
This software is Copyright (c) 2018 by Dave Rolsky. |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
This is free software, licensed under: |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
The full text of the license can be found in the |
|
140
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=cut |