File Coverage

blib/lib/Pg/CLI/dropdb.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 20 100.0


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