line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pg::CLI::createdb; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1754
|
use strict; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
5
|
1
|
|
|
1
|
|
507
|
use namespace::autoclean; |
|
1
|
|
|
|
|
19640
|
|
|
1
|
|
|
|
|
3
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.14'; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
703
|
use Moose; |
|
1
|
|
|
|
|
511697
|
|
|
1
|
|
|
|
|
5
|
|
10
|
1
|
|
|
1
|
|
8049
|
use MooseX::SemiAffordanceAccessor; |
|
1
|
|
|
|
|
12953
|
|
|
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<createdb> utility |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
__END__ |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=pod |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=encoding UTF-8 |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 NAME |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Pg::CLI::createdb - Wrapper for the F<createdb> utility |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 VERSION |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
version 0.14 |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 SYNOPSIS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $createdb = Pg::CLI::createdb->new( |
37
|
|
|
|
|
|
|
username => 'foo', |
38
|
|
|
|
|
|
|
password => 'bar', |
39
|
|
|
|
|
|
|
host => 'pg.example.com', |
40
|
|
|
|
|
|
|
port => 5433, |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
$createdb->run( |
44
|
|
|
|
|
|
|
database => 'NewDB', |
45
|
|
|
|
|
|
|
options => [ |
46
|
|
|
|
|
|
|
'--encoding', 'UTF-8', |
47
|
|
|
|
|
|
|
'--owner', 'alice', |
48
|
|
|
|
|
|
|
], |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 DESCRIPTION |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
This class provides a wrapper for the F<createdb> utility. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 METHODS |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
This class provides the following methods: |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 Pg::CLI::createdb->new( ... ) |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
The constructor accepts a number of parameters: |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=over 4 |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=item * executable |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
The path to F<createdb>. By default, this will look for F<createdb> in your |
68
|
|
|
|
|
|
|
path and throw an error if it cannot be found. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=item * username |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
The username to use when connecting to the database. Optional. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=item * password |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
The password to use when connecting to the database. Optional. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item * host |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
The host to use when connecting to the database. Optional. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item * port |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
The port to use when connecting to the database. Optional. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item * require_ssl |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
If this is true, then the C<PGSSLMODE> environment variable will be set to |
89
|
|
|
|
|
|
|
"require" when connecting to the database. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=back |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head2 $createdb->run( database => $db, ... ) |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This method runs the createdb command with the given options. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
This method also accepts optional C<stdin>, C<stdout>, and C<stderr> |
98
|
|
|
|
|
|
|
parameters. These parameters can be any defined value that could be passed as |
99
|
|
|
|
|
|
|
the relevant parameter to L<IPC::Run3>'s C<run3> subroutine. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Most notably, you can pass scalar references to pipe data in via the C<stdin> |
102
|
|
|
|
|
|
|
parameter or capture output sent to C<stdout> or C<stderr> |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
This method accepts the following arguments: |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=over 4 |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item * database |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
The name of the database to create. Required. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item * options |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
A list of additional options to pass to the command. Optional. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=back |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 SUPPORT |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
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>. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 SOURCE |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
The source code repository for Pg-CLI can be found at L<https://github.com/houseabsolute/Pg-CLI>. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 AUTHOR |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
This software is Copyright (c) 2018 by Dave Rolsky. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
This is free software, licensed under: |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
The full text of the license can be found in the |
141
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=cut |