line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pg::CLI::createdb; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$Pg::CLI::createdb::VERSION = '0.11'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
2603
|
use Moose; |
|
1
|
|
|
|
|
307345
|
|
|
1
|
|
|
|
|
5
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5062
|
use namespace::autoclean; |
|
1
|
|
|
|
|
5766
|
|
|
1
|
|
|
|
|
2
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
471
|
use MooseX::SemiAffordanceAccessor; |
|
1
|
|
|
|
|
7885
|
|
|
1
|
|
|
|
|
3
|
|
11
|
1
|
|
|
1
|
|
5403
|
use MooseX::Types::Moose qw( Str ); |
|
1
|
|
|
|
|
32622
|
|
|
1
|
|
|
|
|
7
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
with qw( Pg::CLI::Role::Connects Pg::CLI::Role::Executable ); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
__PACKAGE__->meta()->make_immutable(); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
1; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# ABSTRACT: Wrapper for the F<createdb> utility |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
__END__ |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=pod |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 NAME |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Pg::CLI::createdb - Wrapper for the F<createdb> utility |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 VERSION |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
version 0.11 |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 SYNOPSIS |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my $createdb = Pg::CLI::createdb->new( |
36
|
|
|
|
|
|
|
username => 'foo', |
37
|
|
|
|
|
|
|
password => 'bar', |
38
|
|
|
|
|
|
|
host => 'pg.example.com', |
39
|
|
|
|
|
|
|
port => 5433, |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
$createdb->run( |
43
|
|
|
|
|
|
|
database => 'NewDB', |
44
|
|
|
|
|
|
|
options => [ |
45
|
|
|
|
|
|
|
'--encoding', 'UTF-8', |
46
|
|
|
|
|
|
|
'--owner', 'alice', |
47
|
|
|
|
|
|
|
], |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 DESCRIPTION |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
This class provides a wrapper for the F<createdb> utility. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 METHODS |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
This class provides the following methods: |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 Pg::CLI::createdb->new( ... ) |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
The constructor accepts a number of parameters: |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=over 4 |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=item * executable |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
The path to F<createdb>. By default, this will look for F<createdb> in your |
67
|
|
|
|
|
|
|
path and throw an error if it cannot be found. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=item * username |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
The username to use when connecting to the database. Optional. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=item * password |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
The password to use when connecting to the database. Optional. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item * host |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
The host to use when connecting to the database. Optional. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item * port |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
The port to use when connecting to the database. Optional. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item * require_ssl |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
If this is true, then the C<PGSSLMODE> environment variable will be set to |
88
|
|
|
|
|
|
|
"require" when connecting to the database. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=back |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 $createdb->run( database => $db, ... ) |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
This method runs the createdb command with the given options. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
This method also accepts optional C<stdin>, C<stdout>, and C<stderr> |
97
|
|
|
|
|
|
|
parameters. These parameters can be any defined value that could be passed as |
98
|
|
|
|
|
|
|
the relevant parameter to L<IPC::Run3>'s C<run3> subroutine. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Most notably, you can pass scalar references to pipe data in via the C<stdin> |
101
|
|
|
|
|
|
|
parameter or capture output sent to C<stdout> or C<stderr> |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
This method accepts the following arguments: |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=over 4 |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=item * database |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
The name of the database to create. Required. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item * options |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
A list of additional options to pass to the command. Optional. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=back |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 BUGS |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
See L<Pg::CLI> for bug reporting details. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 AUTHOR |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
This software is Copyright (c) 2013 by Dave Rolsky. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
This is free software, licensed under: |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=cut |