DBIx-Class-Schema-Loader

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN


0.03001  Mon Jun  5 23:17:57 UTC 2006
        - load_from_connection deprecation notice now mentions
          upgrading Catalyst::Model::DBIC::Schema if that module
          seems to be in use.
        - DBIx::Class required version number fixed
        - Loader statement caching for better load-time performance
        - Improved Pg unique index loader, based on RDBO

0.03000  Tue May 23 12:56:05 UTC 2006
        - weakened the circular schema reference

0.02999_10  Mon May 22 18:58:20 UTC 2006
        - a few more small bugfixes
        - more dump/debug improvements
        - new exportable function "make_schema_at"

0.02999_09  Sun May 21 23:26:58 UTC 2006
        - More docs improvements
        - default uniq_info just warns and returns nothing now,
          instead of dying.  In theory, this allows unsupported

lib/DBIx/Class/Schema/Loader.pm  view on Meta::CPAN

package DBIx::Class::Schema::Loader;

use strict;
use warnings;
use base qw/DBIx::Class::Schema Class::Accessor::Grouped/;
use MRO::Compat;
use mro 'c3';
use Carp::Clan qw/^DBIx::Class/;
use Scalar::Util 'weaken';
use Sub::Util 'set_subname';
use DBIx::Class::Schema::Loader::Utils qw/array_eq sigwarn_silencer/;
use Try::Tiny;
use curry;
use namespace::clean;

# Always remember to do all digits for the version even if they're 0
# i.e. first release of 0.XX *must* be 0.XX000. This avoids fBSD ports
# brain damage and presumably various other packaging systems too
our $VERSION = '0.07053';

lib/DBIx/Class/Schema/Loader.pm  view on Meta::CPAN


=cut

sub clone {
    my $self = shift;

    my $clone = $self->next::method(@_);

    if($clone->_loader_args) {
        $clone->_loader_args->{schema} = $clone;
        weaken($clone->_loader_args->{schema});
    }

    $clone;
}

=head2 dump_to_dir

=over 4

=item Argument: $directory

lib/DBIx/Class/Schema/Loader/Column.pm  view on Meta::CPAN

package DBIx::Class::Schema::Loader::Column;

use strict;
use warnings;
use base 'Class::Accessor::Grouped';
use mro 'c3';
use Carp::Clan qw/^DBIx::Class/;
use Scalar::Util 'weaken';
use namespace::clean;

=head1 NAME

DBIx::Class::Schema::Loader::Column - Class for Columns in
L<DBIx::Class::Schema::Loader>

=head1 DESCRIPTION

Used for representing columns in

lib/DBIx/Class/Schema/Loader/Column.pm  view on Meta::CPAN

The constructor. Takes L</table> and L</name> key-value parameters.

=cut

sub new {
    my $class = shift;

    my $self = { @_ };
    croak "table is required" unless ref $self->{table};

    weaken $self->{table};

    return bless $self, $class;
}

=head2 table

The L</DBIx::Class::Schema::Loader::Table> object this column belongs to.
Required parameter for L</new>

=head2 name

lib/DBIx/Class/Schema/Loader/DBObject.pm  view on Meta::CPAN

package DBIx::Class::Schema::Loader::DBObject;

use strict;
use warnings;
use base 'Class::Accessor::Grouped';
use mro 'c3';
use Carp::Clan qw/^DBIx::Class/;
use Scalar::Util 'weaken';
use namespace::clean;

=head1 NAME

DBIx::Class::Schema::Loader::DBObject - Base Class for Database Objects Such as
Tables and Views in L<DBIx::Class::Schema::Loader>

=head1 METHODS

=head2 loader

lib/DBIx/Class/Schema/Loader/DBObject.pm  view on Meta::CPAN


=cut

sub new {
    my $class = shift;

    my $self = { @_ };

    croak "loader is required" unless ref $self->{loader};

    weaken $self->{loader};

    $self->{_schema} = delete $self->{schema};

    return bless $self, $class;
}

=head2 clone

Make a shallow copy of the object.

lib/DBIx/Class/Schema/Loader/RelBuilder.pm  view on Meta::CPAN

package DBIx::Class::Schema::Loader::RelBuilder;

use strict;
use warnings;
use base 'Class::Accessor::Grouped';
use mro 'c3';
use Carp::Clan qw/^DBIx::Class/;
use Scalar::Util 'weaken';
use DBIx::Class::Schema::Loader::Utils qw/split_name slurp_file array_eq apply uniq/;
use Try::Tiny;
use List::Util qw/all any first/;
use namespace::clean;
use Lingua::EN::Inflect::Phrase ();
use Lingua::EN::Tagger ();
use String::ToIdentifier::EN ();
use String::ToIdentifier::EN::Unicode ();
use Class::Unload ();
use Class::Inspector ();

lib/DBIx/Class/Schema/Loader/RelBuilder.pm  view on Meta::CPAN

    my $self = {
        loader             => $loader,
        (map { $_ => $loader->$_ } qw(
            schema inflect_plural inflect_singular
            relationship_attrs rel_collision_map
            rel_name_map allow_extra_m2m_cols
        )),
        _temp_classes      => [],
    };

    weaken $self->{loader}; #< don't leak

    bless $self => $class;

    # validate the relationship_attrs arg
    if( defined $self->relationship_attrs ) {
        (ref $self->relationship_attrs eq 'HASH' || ref $self->relationship_attrs eq 'CODE')
            or croak "relationship_attrs must be a hashref or coderef";
    }

    return $self;

t/backcompat/0.04006/lib/dbixcsl_test_dir.pm  view on Meta::CPAN

package dbixcsl_test_dir;

use strict;
use warnings;
use File::Path 'rmtree';
use File::Temp 'tempdir';
use Scalar::Util 'weaken';
use namespace::clean;
use DBI ();

use base qw/Exporter/;
our @EXPORT_OK = '$tdir';

die "/t does not exist, this can't be right...\n"
    unless -d 't';

my $tbdir = 't/var';

t/backcompat/0.04006/lib/dbixcsl_test_dir.pm  view on Meta::CPAN


no warnings 'redefine';

my $connect = \&DBI::connect;

my @handles;

*DBI::connect = sub {
    my $dbh = $connect->(@_);
    push @handles, $dbh;
    weaken $handles[-1];
    return $dbh;
};

END {
    if (not $ENV{SCHEMA_LOADER_TESTS_NOCLEANUP}) {
        foreach my $dbh (@handles) {
            $dbh->disconnect if $dbh;
        }

        rmtree($tdir, 1, 1);

t/lib/dbixcsl_test_dir.pm  view on Meta::CPAN

package dbixcsl_test_dir;

use strict;
use warnings;
use File::Path 'rmtree';
use File::Temp 'tempdir';
use Scalar::Util 'weaken';
use namespace::clean;
use DBI ();

use base qw/Exporter/;
our @EXPORT_OK = '$tdir';

die "/t does not exist, this can't be right...\n"
    unless -d 't';

my $tbdir = 't/var';

t/lib/dbixcsl_test_dir.pm  view on Meta::CPAN


no warnings 'redefine';

my $connect = \&DBI::connect;

my @handles;

*DBI::connect = sub {
    my $dbh = $connect->(@_);
    push @handles, $dbh;
    weaken $handles[-1];
    return $dbh;
};

END {
    if (not $ENV{SCHEMA_LOADER_TESTS_NOCLEANUP}) {
        foreach my $dbh (@handles) {
            $dbh->disconnect if $dbh;
        }

        rmtree($tdir, 1, 1);



( run in 0.682 second using v1.01-cache-2.11-cpan-65fba6d93b7 )