/usr/share/perl5/Class/DBI/Loader/Pg.pm is in libclass-dbi-loader-perl 0.34-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | package Class::DBI::Loader::Pg;
use strict;
use base 'Class::DBI::Loader::Generic';
use vars '$VERSION';
use DBI;
use Carp;
require Class::DBI::Pg;
require Class::DBI::Loader::Generic;
$VERSION = '0.30';
=head1 NAME
Class::DBI::Loader::Pg - Class::DBI::Loader Postgres Implementation.
=head1 SYNOPSIS
use Class::DBI::Loader;
# $loader is a Class::DBI::Loader::Pg
my $loader = Class::DBI::Loader->new(
dsn => "dbi:Pg:dbname=dbname",
user => "postgres",
password => "",
namespace => "Data",
);
my $class = $loader->find_class('film'); # $class => Data::Film
my $obj = $class->retrieve(1);
=head1 DESCRIPTION
See L<Class::DBI::Loader>, L<Class::DBI::Loader::Generic>.
=cut
sub _db_class { return 'Class::DBI::Pg' }
sub _tables {
my $self = shift;
my $dbh = DBI->connect( @{ $self->{_datasource} } ) or croak($DBI::errstr);
# we do this check here because we don't really want to include this as
# a pre-requisite in the Makefile.PL for all those non-Pg users
my $sth = $dbh->prepare("SELECT version()");
$sth->execute();
my($vstr) = $sth->fetchrow_array();
$sth->finish;
my($pg_version) = $vstr =~ /^PostgreSQL ([\d\.]{3})/;
if ($pg_version >= 8 && $Class::DBI::Pg::VERSION < 0.07) {
die "Class::DBI::Pg $Class::DBI::Pg::VERSION does not support PostgreSQL > 8.x";
}
my @tables = ( $DBD::Pg::VERSION >= 1.31 ) ?
$dbh->tables( undef, "public", "", "table",
{ noprefix => 1, pg_noprefix => 1 } ) :
$dbh->tables;
$dbh->disconnect;
return @tables;
}
=head1 SEE ALSO
L<Class::DBI::Loader>, L<Class::DBI::Loader::Generic>
=cut
1;
|