/usr/share/perl5/Catalyst/Model/CDBI.pm is in libcatalyst-model-cdbi-perl 0.12-1.
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 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | package Catalyst::Model::CDBI;
# work around CDBI being incompatible with C3 mro, due to both Ima::DBI and Class::DBI::__::Base
# inheriting from Class::Data::Inheritable in an inconsistent order.
BEGIN {
require Class::DBI;
@Class::DBI::__::Base::ISA = grep { $_ ne 'Class::Data::Inheritable' } @Class::DBI::__::Base::ISA;
}
use strict;
use base qw/Catalyst::Component Class::DBI/;
use MRO::Compat;
use Class::DBI::Loader;
our $VERSION = '0.12';
__PACKAGE__->mk_accessors('loader');
=head1 NAME
Catalyst::Model::CDBI - [DEPRECATED] CDBI Model Class
=head1 SYNOPSIS
# use the helper
create model CDBI CDBI dsn user password
# lib/MyApp/Model/CDBI.pm
package MyApp::Model::CDBI;
use base 'Catalyst::Model::CDBI';
__PACKAGE__->config(
dsn => 'dbi:Pg:dbname=myapp',
password => '',
user => 'postgres',
options => { AutoCommit => 1 },
relationships => 1
);
1;
# As object method
$c->comp('MyApp::Model::CDBI::Table')->search(...);
# As class method
MyApp::Model::CDBI::Table->search(...);
=head1 DESCRIPTION
This is the C<Class::DBI> model class. It's built on top of
C<Class::DBI::Loader>. C<Class::DBI> is generally not used for new
applications, with C<DBIx::Class> being preferred instead. As such
this model is deprecated and (mostly) unmaintained.
It is preserved here for older applications which still need it for
backwards compatibility.
=head2 new
Initializes Class::DBI::Loader and loads classes using the class
config. Also attempts to borg all the classes.
=cut
sub new {
my $class = shift;
my $self = $class->next::method( @_ );
my $c = shift;
$self->{namespace} ||= ref $self;
$self->{additional_base_classes} ||= ();
push @{ $self->{additional_base_classes} }, ref $self;
eval { $self->loader( Class::DBI::Loader->new(%$self) ) };
if ($@) {
Catalyst::Exception->throw( message => $@ );
}
else {
$c->log->debug(
'Loaded tables "' . join( ' ', $self->loader->tables ) . '"' )
if $c->debug;
}
for my $class ( $self->loader->classes ) {
$class->autoupdate(1);
$c->components->{$class} ||= bless {%$self}, $class;
no strict 'refs';
*{"$class\::new"} = sub { bless {%$self}, $class };
}
return $self;
}
=head1 SEE ALSO
L<Catalyst>, L<Class::DBI> L<Class::DBI::Loader>
=head1 AUTHOR
Sebastian Riedel, C<sri@cpan.org>
=head1 CONTRIBUTORS
mst: Matt S Trout C<mst@shadowcat.co.uk>
Arathorn: Matthew Hodgson C<matthew@arasphere.net>
=head1 COPYRIGHT
Copyright (c) 2005 - 2010 the Catalyst::Model::CDBI L</AUTHOR> and
L</CONTRIBUTORS> as listed above.
This program is free software, you can redistribute it and/or modify it
under the same terms as Perl itself.
=cut
1;
|