Pg::CLI::pg_dump - Wrapper for the pg_dump utility
my $pg_dump = Pg::CLI::pg_dump->new( username => 'foo', password => 'bar', host => 'pg.example.com', port => 5433, ); $pg_dump->run( database => 'database', options => [ '-C' ], ); my $sql; $pg_dump->run( database => 'database', options => [ '-C' ], stdout => \$sql, );
This class provides a wrapper for the pg_dump utility.
This class provides the following methods:
The constructor accepts a number of parameters:
The path to pg_dump. By default, this will look for pg_dump in your path and throw an error if it cannot be found.
The username to use when connecting to the database. Optional.
The password to use when connecting to the database. Optional.
The host to use when connecting to the database. Optional.
The port to use when connecting to the database. Optional.
If this is true, then the
PGSSLMODE environment variable will be set to "require" when connecting to the database.
This method dumps the specified database. Any values passed in
options will be passed on to pg_dump.
This method also accepts optional
stderr parameters. These parameters can be any defined value that could be passed as the relevant parameter to IPC::Run3's
Notably, you can capture the dump output in a scalar reference for the
Returns a the three part version as a string.
Returns the first two decimal numbers in the version.
Bugs may be submitted at http://rt.cpan.org/Public/Dist/Display.html?Name=Pg-CLI or via email to email@example.com.
I am also usually active on IRC as 'autarch' on
The source code repository for Pg-CLI can be found at https://github.com/houseabsolute/Pg-CLI.
Dave Rolsky <firstname.lastname@example.org>
This software is Copyright (c) 2018 by Dave Rolsky.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
The full text of the license can be found in the LICENSE file included with this distribution.