File Coverage

blib/lib/Pg/CLI/dropdb.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


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