From: Brandon L. Black Date: Sun, 26 Mar 2006 14:44:25 +0000 (+0000) Subject: converted tabs to spaces, removed trailing whitespace X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=75d079145a507a0e5ff89b2676d383f4fd1a5511;p=dbsrgits%2FDBIx-Class-Historic.git converted tabs to spaces, removed trailing whitespace --- diff --git a/lib/DBIx/Class.pm b/lib/DBIx/Class.pm index ff455c1..7df5165 100644 --- a/lib/DBIx/Class.pm +++ b/lib/DBIx/Class.pm @@ -32,7 +32,7 @@ sub _attr_cache { 1; -=head1 NAME +=head1 NAME DBIx::Class - Extensible and flexible object <-> relational mapper. @@ -134,12 +134,12 @@ JOIN, LEFT JOIN, COUNT, DISTINCT, GROUP BY and HAVING support. DBIx::Class can handle multi-column primary and foreign keys, complex queries and database-level paging, and does its best to only query the -database in order to return something you've directly asked for. If a -resultset is used as an iterator it only fetches rows off the statement -handle as requested in order to minimise memory usage. It has auto-increment +database in order to return something you've directly asked for. If a +resultset is used as an iterator it only fetches rows off the statement +handle as requested in order to minimise memory usage. It has auto-increment support for SQLite, MySQL, PostgreSQL, Oracle, SQL Server and DB2 and is known to be used in production on at least the first four, and is fork- -and thread-safe out of the box (although your DBD may not be). +and thread-safe out of the box (although your DBD may not be). This project is still under rapid development, so features added in the latest major release may not work 100% yet -- check the Changes if you run diff --git a/lib/DBIx/Class/AccessorGroup.pm b/lib/DBIx/Class/AccessorGroup.pm index 9ef0a51..4478f41 100644 --- a/lib/DBIx/Class/AccessorGroup.pm +++ b/lib/DBIx/Class/AccessorGroup.pm @@ -5,7 +5,7 @@ use warnings; use Carp::Clan qw/^DBIx::Class/; -=head1 NAME +=head1 NAME DBIx::Class::AccessorGroup - Lets you build groups of accessors @@ -290,7 +290,7 @@ sub get_component_class { return $self->{$get}; } else { $get = "_$get"; - return $self->can($get) ? $self->$get : undef; + return $self->can($get) ? $self->$get : undef; } } @@ -318,9 +318,9 @@ sub set_component_class { } else { $set = "_$set"; return $self->can($set) ? - $self->$set($val) : - $self->mk_classdata($set => $val); - } + $self->$set($val) : + $self->mk_classdata($set => $val); + } } 1; diff --git a/lib/DBIx/Class/CDBICompat.pm b/lib/DBIx/Class/CDBICompat.pm index 830a0e6..874c4c7 100644 --- a/lib/DBIx/Class/CDBICompat.pm +++ b/lib/DBIx/Class/CDBICompat.pm @@ -37,7 +37,7 @@ __PACKAGE__->load_own_components(qw/ #DBIx::Class::ObjIndexStubs 1; -=head1 NAME +=head1 NAME DBIx::Class::CDBICompat - Class::DBI Compatibility layer. @@ -51,12 +51,12 @@ DBIx::Class::CDBICompat - Class::DBI Compatibility layer. DBIx::Class features a fully featured compatibility layer with L to ease transition for existing CDBI users. In fact, this class is just a receipe containing all the features emulated. If you like, you can choose -which features to emulate by building your own class and loading it like +which features to emulate by building your own class and loading it like this: __PACKAGE__->load_own_components(qw/CDBICompat/); -this will automatically load the features included in My::DB::CDBICompat, +this will automatically load the features included in My::DB::CDBICompat, provided it looks something like this: package My::DB::CDBICompat; diff --git a/lib/DBIx/Class/CDBICompat/AttributeAPI.pm b/lib/DBIx/Class/CDBICompat/AttributeAPI.pm index 09c955f..b3d4752 100644 --- a/lib/DBIx/Class/CDBICompat/AttributeAPI.pm +++ b/lib/DBIx/Class/CDBICompat/AttributeAPI.pm @@ -1,4 +1,4 @@ -package # hide from PAUSE +package # hide from PAUSE DBIx::Class::CDBICompat::AttributeAPI; use strict; diff --git a/lib/DBIx/Class/CDBICompat/ColumnCase.pm b/lib/DBIx/Class/CDBICompat/ColumnCase.pm index 0e46a5c..9d0c96f 100644 --- a/lib/DBIx/Class/CDBICompat/ColumnCase.pm +++ b/lib/DBIx/Class/CDBICompat/ColumnCase.pm @@ -26,8 +26,8 @@ sub has_a { sub has_many { my ($class, $rel, $f_class, $f_key, @rest) = @_; - return $class->next::method($rel, $f_class, ( ref($f_key) ? - $f_key : + return $class->next::method($rel, $f_class, ( ref($f_key) ? + $f_key : lc($f_key) ), @rest); } diff --git a/lib/DBIx/Class/CDBICompat/ColumnGroups.pm b/lib/DBIx/Class/CDBICompat/ColumnGroups.pm index 0becde4..911fe2a 100644 --- a/lib/DBIx/Class/CDBICompat/ColumnGroups.pm +++ b/lib/DBIx/Class/CDBICompat/ColumnGroups.pm @@ -1,4 +1,4 @@ -package # hide from PAUSE +package # hide from PAUSE DBIx::Class::CDBICompat::ColumnGroups; use strict; diff --git a/lib/DBIx/Class/CDBICompat/GetSet.pm b/lib/DBIx/Class/CDBICompat/GetSet.pm index 204b38b..6b98e79 100644 --- a/lib/DBIx/Class/CDBICompat/GetSet.pm +++ b/lib/DBIx/Class/CDBICompat/GetSet.pm @@ -1,4 +1,4 @@ -package # hide from PAUSE +package # hide from PAUSE DBIx::Class::CDBICompat::GetSet; use strict; diff --git a/lib/DBIx/Class/CDBICompat/LiveObjectIndex.pm b/lib/DBIx/Class/CDBICompat/LiveObjectIndex.pm index d624bd3..fb8a77e 100644 --- a/lib/DBIx/Class/CDBICompat/LiveObjectIndex.pm +++ b/lib/DBIx/Class/CDBICompat/LiveObjectIndex.pm @@ -1,4 +1,4 @@ -package # hide from PAUSE +package # hide from PAUSE DBIx::Class::CDBICompat::LiveObjectIndex; use strict; diff --git a/lib/DBIx/Class/CDBICompat/Pager.pm b/lib/DBIx/Class/CDBICompat/Pager.pm index 5bf2c77..c4bc3a4 100644 --- a/lib/DBIx/Class/CDBICompat/Pager.pm +++ b/lib/DBIx/Class/CDBICompat/Pager.pm @@ -1,19 +1,19 @@ -package # hide from PAUSE - DBIx::Class::CDBICompat::Pager; +package # hide from PAUSE + DBIx::Class::CDBICompat::Pager; -use strict; -use warnings FATAL => 'all'; +use strict; +use warnings FATAL => 'all'; -*pager = \&page; +*pager = \&page; -sub page { - my $class = shift; +sub page { + my $class = shift; - my $rs = $class->search(@_); - unless ($rs->{page}) { - $rs = $rs->page(1); - } - return ( $rs->pager, $rs ); -} + my $rs = $class->search(@_); + unless ($rs->{page}) { + $rs = $rs->page(1); + } + return ( $rs->pager, $rs ); +} -1; +1; diff --git a/lib/DBIx/Class/CDBICompat/Stringify.pm b/lib/DBIx/Class/CDBICompat/Stringify.pm index 5633e1a..4d13171 100644 --- a/lib/DBIx/Class/CDBICompat/Stringify.pm +++ b/lib/DBIx/Class/CDBICompat/Stringify.pm @@ -1,4 +1,4 @@ -package # hide from PAUSE +package # hide from PAUSE DBIx::Class::CDBICompat::Stringify; use strict; diff --git a/lib/DBIx/Class/CDBICompat/TempColumns.pm b/lib/DBIx/Class/CDBICompat/TempColumns.pm index 2a3f5ee..95be2a8 100644 --- a/lib/DBIx/Class/CDBICompat/TempColumns.pm +++ b/lib/DBIx/Class/CDBICompat/TempColumns.pm @@ -1,4 +1,4 @@ -package # hide from PAUSE +package # hide from PAUSE DBIx::Class::CDBICompat::TempColumns; use strict; diff --git a/lib/DBIx/Class/Componentised.pm b/lib/DBIx/Class/Componentised.pm index a42befc..a8a17c3 100644 --- a/lib/DBIx/Class/Componentised.pm +++ b/lib/DBIx/Class/Componentised.pm @@ -1,4 +1,4 @@ -package # hide from PAUSE +package # hide from PAUSE DBIx::Class::Componentised; use strict; diff --git a/lib/DBIx/Class/Core.pm b/lib/DBIx/Class/Core.pm index c1b292c..96a6a9a 100644 --- a/lib/DBIx/Class/Core.pm +++ b/lib/DBIx/Class/Core.pm @@ -17,7 +17,7 @@ __PACKAGE__->load_components(qw/ 1; -=head1 NAME +=head1 NAME DBIx::Class::Core - Core set of DBIx::Class modules diff --git a/lib/DBIx/Class/DB.pm b/lib/DBIx/Class/DB.pm index d996c1a..aa5eeb3 100644 --- a/lib/DBIx/Class/DB.pm +++ b/lib/DBIx/Class/DB.pm @@ -29,7 +29,7 @@ sub resultset_instance { return $source->resultset; } -=head1 NAME +=head1 NAME DBIx::Class::DB - Non-recommended classdata schema component @@ -67,7 +67,7 @@ Sets or gets the storage backend. Defaults to L. ****DEPRECATED**** -Sets or gets the class to use for resolving a class. Defaults to +Sets or gets the class to use for resolving a class. Defaults to L, which returns whatever you give it. See resolve_class below. diff --git a/lib/DBIx/Class/InflateColumn.pm b/lib/DBIx/Class/InflateColumn.pm index 98b3c38..013c724 100644 --- a/lib/DBIx/Class/InflateColumn.pm +++ b/lib/DBIx/Class/InflateColumn.pm @@ -6,7 +6,7 @@ use warnings; use base qw/DBIx::Class::Row/; -=head1 NAME +=head1 NAME DBIx::Class::InflateColumn - Automatically create objects from column data @@ -25,13 +25,13 @@ the column data. It also "deflates" objects into an appropriate format for the database. It can be used, for example, to automatically convert to and from -L objects for your date and time fields. +L objects for your date and time fields. =head1 METHODS =head2 inflate_column -Instruct L to inflate the given column. +Instruct L to inflate the given column. In addition to the column name, you must provide C and C methods. The C method is called when you access diff --git a/lib/DBIx/Class/PK.pm b/lib/DBIx/Class/PK.pm index 0f4d0a7..d093d93 100644 --- a/lib/DBIx/Class/PK.pm +++ b/lib/DBIx/Class/PK.pm @@ -5,7 +5,7 @@ use warnings; use base qw/DBIx::Class::Row/; -=head1 NAME +=head1 NAME DBIx::Class::PK - Primary Key class @@ -13,7 +13,7 @@ DBIx::Class::PK - Primary Key class =head1 DESCRIPTION -This class contains methods for handling primary keys and methods +This class contains methods for handling primary keys and methods depending on them. =head1 METHODS @@ -70,7 +70,7 @@ sub id { =head2 ID Returns a unique id string identifying a row object by primary key. -Used by L and +Used by L and L. =cut @@ -88,7 +88,7 @@ sub _create_ID { my ($self,%vals) = @_; return undef unless 0 == grep { !defined } values %vals; return join '|', ref $self || $self, $self->result_source->name, - map { $_ . '=' . $vals{$_} } sort keys %vals; + map { $_ . '=' . $vals{$_} } sort keys %vals; } sub ident_condition { diff --git a/lib/DBIx/Class/PK/Auto.pm b/lib/DBIx/Class/PK/Auto.pm index 2174d34..b7ebda7 100644 --- a/lib/DBIx/Class/PK/Auto.pm +++ b/lib/DBIx/Class/PK/Auto.pm @@ -5,7 +5,7 @@ use base qw/DBIx::Class/; use strict; use warnings; -=head1 NAME +=head1 NAME DBIx::Class::PK::Auto - Automatic primary key class diff --git a/lib/DBIx/Class/PK/Auto/DB2.pm b/lib/DBIx/Class/PK/Auto/DB2.pm index 29ecf78..8c12ab2 100644 --- a/lib/DBIx/Class/PK/Auto/DB2.pm +++ b/lib/DBIx/Class/PK/Auto/DB2.pm @@ -9,7 +9,7 @@ __PACKAGE__->load_components(qw/PK::Auto/); 1; -=head1 NAME +=head1 NAME DBIx::Class::PK::Auto::DB2 - (DEPRECATED) Automatic primary key class for DB2 diff --git a/lib/DBIx/Class/PK/Auto/MSSQL.pm b/lib/DBIx/Class/PK/Auto/MSSQL.pm index 8ac2778..637cb32 100644 --- a/lib/DBIx/Class/PK/Auto/MSSQL.pm +++ b/lib/DBIx/Class/PK/Auto/MSSQL.pm @@ -9,7 +9,7 @@ __PACKAGE__->load_components(qw/PK::Auto/); 1; -=head1 NAME +=head1 NAME DBIx::Class::PK::Auto::MSSQL - (DEPRECATED) Automatic primary key class for MSSQL diff --git a/lib/DBIx/Class/PK/Auto/MySQL.pm b/lib/DBIx/Class/PK/Auto/MySQL.pm index 7a1f78e..3107819 100644 --- a/lib/DBIx/Class/PK/Auto/MySQL.pm +++ b/lib/DBIx/Class/PK/Auto/MySQL.pm @@ -9,7 +9,7 @@ __PACKAGE__->load_components(qw/PK::Auto/); 1; -=head1 NAME +=head1 NAME DBIx::Class::PK::Auto::MySQL - (DEPRECATED) Automatic primary key class for MySQL diff --git a/lib/DBIx/Class/PK/Auto/Oracle.pm b/lib/DBIx/Class/PK/Auto/Oracle.pm index 437246b..4d39f5e 100644 --- a/lib/DBIx/Class/PK/Auto/Oracle.pm +++ b/lib/DBIx/Class/PK/Auto/Oracle.pm @@ -9,7 +9,7 @@ __PACKAGE__->load_components(qw/PK::Auto/); 1; -=head1 NAME +=head1 NAME DBIx::Class::PK::Auto::Oracle - (DEPRECATED) Automatic primary key class for Oracle diff --git a/lib/DBIx/Class/PK/Auto/Pg.pm b/lib/DBIx/Class/PK/Auto/Pg.pm index 00cd24f..1a850b4 100644 --- a/lib/DBIx/Class/PK/Auto/Pg.pm +++ b/lib/DBIx/Class/PK/Auto/Pg.pm @@ -9,7 +9,7 @@ __PACKAGE__->load_components(qw/PK::Auto/); 1; -=head1 NAME +=head1 NAME DBIx::Class::PK::Auto::Pg - (DEPRECATED) Automatic primary key class for Pg diff --git a/lib/DBIx/Class/PK/Auto/SQLite.pm b/lib/DBIx/Class/PK/Auto/SQLite.pm index de42922..80bdc7c 100644 --- a/lib/DBIx/Class/PK/Auto/SQLite.pm +++ b/lib/DBIx/Class/PK/Auto/SQLite.pm @@ -9,7 +9,7 @@ __PACKAGE__->load_components(qw/PK::Auto/); 1; -=head1 NAME +=head1 NAME DBIx::Class::PK::Auto::SQLite - (DEPRECATED) Automatic primary key class for SQLite diff --git a/lib/DBIx/Class/Relationship.pm b/lib/DBIx/Class/Relationship.pm index c479e4c..77bfa8c 100644 --- a/lib/DBIx/Class/Relationship.pm +++ b/lib/DBIx/Class/Relationship.pm @@ -13,15 +13,15 @@ __PACKAGE__->load_own_components(qw/ Base /); -=head1 NAME +=head1 NAME DBIx::Class::Relationship - Inter-table relationships =head1 SYNOPSIS - MyDB::Schema::Actor->has_many('actorroles' => 'MyDB::Schema::ActorRole', + MyDB::Schema::Actor->has_many('actorroles' => 'MyDB::Schema::ActorRole', 'actor'); - MyDB::Schema::Role->has_many('actorroles' => 'MyDB::Schema::ActorRole', + MyDB::Schema::Role->has_many('actorroles' => 'MyDB::Schema::ActorRole', 'role'); MyDB::Schema::ActorRole->belongs_to('role' => 'MyDB::Schema::Role'); MyDB::Schema::ActorRole->belongs_to('actor' => 'MyDB::Schema::Actor'); @@ -65,10 +65,10 @@ we can do this instead: my $fredsbooks = $schema->resultset('Author')->find({ Name => 'Fred' })->books; -Each relationship sets up an accessor method on the +Each relationship sets up an accessor method on the L objects that represent the items of your table. From L objects, -the relationships can be searched using the "search_related" method. +the relationships can be searched using the "search_related" method. In list context, each returns a list of Row objects for the related class, in scalar context, a new ResultSet representing the joined tables is returned. Thus, the calls can be chained to produce complex queries. @@ -83,7 +83,7 @@ the data for an actual item, no time is wasted producing them. will produce a query something like: - SELECT * FROM Author me + SELECT * FROM Author me LEFT JOIN Books books ON books.author = me.id LEFT JOIN Prices prices ON prices.book = books.id WHERE prices.Price <= 5.00 @@ -112,7 +112,7 @@ See L for a list of valid attributes. my $author_obj = $obj->author; $obj->author($new_author_obj); -Creates a relationship where the calling class stores the foreign class's +Creates a relationship where the calling class stores the foreign class's primary key in one (or more) of its columns. If $cond is a column name instead of a join condition hash, that is used as the name of the column holding the foreign key. If $cond is not given, the relname is used as @@ -149,7 +149,7 @@ cascade or restrict will take precedence. =head2 might_have - My::DBIC::Schema::Author->might_have(pseudonym => + My::DBIC::Schema::Author->might_have(pseudonym => 'My::DBIC::Schema::Pseudonyms'); my $pname = $obj->pseudonym; # to get the Pseudonym object @@ -175,12 +175,12 @@ left join. =head2 many_to_many - My::DBIC::Schema::Actor->has_many( actor_roles => + My::DBIC::Schema::Actor->has_many( actor_roles => 'My::DBIC::Schema::ActorRoles', 'actor' ); - My::DBIC::Schema::ActorRoles->belongs_to( role => + My::DBIC::Schema::ActorRoles->belongs_to( role => 'My::DBIC::Schema::Role' ); - My::DBIC::Schema::ActorRoles->belongs_to( actor => + My::DBIC::Schema::ActorRoles->belongs_to( actor => 'My::DBIC::Schema::Actor' ); My::DBIC::Schema::Actor->many_to_many( roles => 'actor_roles', @@ -194,7 +194,7 @@ Creates an accessor bridging two relationships; not strictly a relationship in its own right, although the accessor will return a resultset or collection of objects just as a has_many would. To use many_to_many, existing relationships from the original table to the link -table, and from the link table to the end table must already exist, these +table, and from the link table to the end table must already exist, these relation names are then used in the many_to_many call. =cut diff --git a/lib/DBIx/Class/Relationship/Accessor.pm b/lib/DBIx/Class/Relationship/Accessor.pm index 6c93546..035661a 100644 --- a/lib/DBIx/Class/Relationship/Accessor.pm +++ b/lib/DBIx/Class/Relationship/Accessor.pm @@ -1,4 +1,4 @@ -package # hide from PAUSE +package # hide from PAUSE DBIx::Class::Relationship::Accessor; use strict; diff --git a/lib/DBIx/Class/Relationship/Base.pm b/lib/DBIx/Class/Relationship/Base.pm index a8d3d3c..6e6a4f4 100644 --- a/lib/DBIx/Class/Relationship/Base.pm +++ b/lib/DBIx/Class/Relationship/Base.pm @@ -5,7 +5,7 @@ use warnings; use base qw/DBIx::Class/; -=head1 NAME +=head1 NAME DBIx::Class::Relationship::Base - Inter-table relationships @@ -15,7 +15,7 @@ DBIx::Class::Relationship::Base - Inter-table relationships This class provides methods to describe the relationships between the tables in your database model. These are the "bare bones" relationships -methods, for predefined ones, look in L. +methods, for predefined ones, look in L. =head1 METHODS diff --git a/lib/DBIx/Class/Relationship/BelongsTo.pm b/lib/DBIx/Class/Relationship/BelongsTo.pm index ef25069..535fa75 100644 --- a/lib/DBIx/Class/Relationship/BelongsTo.pm +++ b/lib/DBIx/Class/Relationship/BelongsTo.pm @@ -18,9 +18,9 @@ sub belongs_to { my ($pri, $too_many) = keys %f_primaries; $class->throw_exception("Can't infer join condition for ${rel} on ${class}; ${f_class} has no primary keys") - unless defined $pri; + unless defined $pri; $class->throw_exception("Can't infer join condition for ${rel} on ${class}; ${f_class} has multiple primary keys") - if $too_many; + if $too_many; my $fk = defined $cond ? $cond : $rel; $class->throw_exception("Can't infer join condition for ${rel} on ${class}; $fk is not a column") diff --git a/lib/DBIx/Class/Relationship/HasMany.pm b/lib/DBIx/Class/Relationship/HasMany.pm index e43e9bc..a709d6a 100644 --- a/lib/DBIx/Class/Relationship/HasMany.pm +++ b/lib/DBIx/Class/Relationship/HasMany.pm @@ -1,4 +1,4 @@ -package # hide from PAUSE +package # hide from PAUSE DBIx::Class::Relationship::HasMany; use strict; diff --git a/lib/DBIx/Class/Relationship/ManyToMany.pm b/lib/DBIx/Class/Relationship/ManyToMany.pm index d3a699b..387fc0b 100644 --- a/lib/DBIx/Class/Relationship/ManyToMany.pm +++ b/lib/DBIx/Class/Relationship/ManyToMany.pm @@ -1,4 +1,4 @@ -package # hide from PAUSE +package # hide from PAUSE DBIx::Class::Relationship::ManyToMany; use strict; diff --git a/lib/DBIx/Class/Relationship/ProxyMethods.pm b/lib/DBIx/Class/Relationship/ProxyMethods.pm index 03658ee..11e4879 100644 --- a/lib/DBIx/Class/Relationship/ProxyMethods.pm +++ b/lib/DBIx/Class/Relationship/ProxyMethods.pm @@ -1,4 +1,4 @@ -package # hide from PAUSE +package # hide from PAUSE DBIx::Class::Relationship::ProxyMethods; use strict; diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index bd6ede7..9792511 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -51,7 +51,7 @@ In the examples below, the following table classes are used: =head1 METHODS -=head2 new +=head2 new =over 4 @@ -326,8 +326,8 @@ sub find { return keys %{$rs->{collapse}} ? $rs->next : $rs->single; } else { return keys %{$self->{collapse}} ? - $self->search($query)->next : - $self->single($query); + $self->search($query)->next : + $self->single($query); } } @@ -400,7 +400,7 @@ sub single { if ($where) { if (defined $attrs->{where}) { $attrs->{where} = { - '-and' => + '-and' => [ map { ref $_ eq 'ARRAY' ? [ -or => $_ ] : $_ } $where, delete $attrs->{where} ] }; @@ -504,8 +504,8 @@ sub next { return ($self->all)[0]; } my @row = (exists $self->{stashed_row} ? - @{delete $self->{stashed_row}} : - $self->cursor->next + @{delete $self->{stashed_row}} : + $self->cursor->next ); # warn Dumper(\@row); use Data::Dumper; return unless (@row); @@ -562,7 +562,7 @@ sub _collapse_result { my @collapse; if (defined $prefix) { @collapse = map { - m/^\Q${prefix}.\E(.+)$/ ? ($1) : () + m/^\Q${prefix}.\E(.+)$/ ? ($1) : () } keys %{$self->{collapse}} } else { @collapse = keys %{$self->{collapse}}; @@ -581,7 +581,7 @@ sub _collapse_result { my (@final, @raw); while ( !(grep { !defined($tree->[0]->{$_}) || - $co_check{$_} ne $tree->[0]->{$_} + $co_check{$_} ne $tree->[0]->{$_} } @co_key) ) { push(@final, $tree); last unless (@raw = $self->cursor->next); @@ -662,7 +662,7 @@ sub _count { # Separated out so pager can get the full count @distinct = ($column); last; } - } + } } $select = { count => { distinct => \@distinct } }; @@ -1420,7 +1420,7 @@ below. =back -Contains one or more relationships that should be fetched along with the main +Contains one or more relationships that should be fetched along with the main query (when they are accessed afterwards they will have already been "prefetched"). This is useful for when you know you will need the related objects, because it saves at least one query: @@ -1602,7 +1602,7 @@ revisit rows in your ResultSet: ... do stuff ... } - $rs->first; # without cache, this would issue a query + $rs->first; # without cache, this would issue a query By default, searches are not cached. diff --git a/lib/DBIx/Class/ResultSetManager.pm b/lib/DBIx/Class/ResultSetManager.pm index 5e10f67..a0911bc 100644 --- a/lib/DBIx/Class/ResultSetManager.pm +++ b/lib/DBIx/Class/ResultSetManager.pm @@ -4,7 +4,7 @@ use warnings; use base 'DBIx::Class'; use Class::Inspector; -=head1 NAME +=head1 NAME DBIx::Class::ResultSetManager - helpful methods for managing resultset classes (EXPERIMENTAL) @@ -50,7 +50,7 @@ sub table { my $ret = $self->next::method(@rest); if (@rest) { $self->_register_attributes; - $self->_register_resultset_class; + $self->_register_resultset_class; } return $ret; } @@ -96,7 +96,7 @@ sub _register_resultset_class { $self->result_source_instance->resultset_class($resultset_class); } else { $self->result_source_instance->resultset_class - ($self->base_resultset_class); + ($self->base_resultset_class); } } diff --git a/lib/DBIx/Class/ResultSource.pm b/lib/DBIx/Class/ResultSource.pm index 700d01e..68d16b2 100644 --- a/lib/DBIx/Class/ResultSource.pm +++ b/lib/DBIx/Class/ResultSource.pm @@ -17,7 +17,7 @@ __PACKAGE__->mk_group_accessors('simple' => qw/_ordered_columns __PACKAGE__->mk_group_accessors('component_class' => qw/resultset_class result_class/); -=head1 NAME +=head1 NAME DBIx::Class::ResultSource - Result source object @@ -63,7 +63,7 @@ keys are currently recognised/used by DBIx::Class: =over 4 -=item accessor +=item accessor Use this to set the name of the accessor for this column. If unset, the name of the column will be used. @@ -83,7 +83,7 @@ whatever your database supports. =item size The length of your column, if it is a column type that can have a size -restriction. This is currently not used by DBIx::Class. +restriction. This is currently not used by DBIx::Class. =item is_nullable @@ -105,7 +105,7 @@ foreign table. This is currently not used by DBIx::Class. Set this to the default value which will be inserted into a column by the database. Can contain either a value or a function. This is -currently not used by DBIx::Class. +currently not used by DBIx::Class. =item sequence @@ -167,16 +167,16 @@ of add_column for information on the contents of the hashref. sub column_info { my ($self, $column) = @_; - $self->throw_exception("No such column $column") + $self->throw_exception("No such column $column") unless exists $self->_columns->{$column}; #warn $self->{_columns_info_loaded}, "\n"; - if ( ! $self->_columns->{$column}{data_type} - and ! $self->{_columns_info_loaded} + if ( ! $self->_columns->{$column}{data_type} + and ! $self->{_columns_info_loaded} and $self->schema and $self->storage ) { $self->{_columns_info_loaded}++; my $info; - # eval for the case of storage without table + # eval for the case of storage without table eval { $info = $self->storage->columns_info_for($self->from) }; unless ($@) { foreach my $col ( keys %{$self->_columns} ) { @@ -219,7 +219,7 @@ called after C. Additionally, defines a unique constraint named C. The primary key columns are used by L to -retrieve automatically created values from the database. +retrieve automatically created values from the database. =cut @@ -292,7 +292,7 @@ clause contents. =head2 storage -Returns the storage handle for the current schema. +Returns the storage handle for the current schema. See also: L @@ -353,11 +353,11 @@ Then, assuming LinerNotes has an accessor named notes, you can do: =item accessor Specifies the type of accessor that should be created for the -relationship. Valid values are C (for when there is only a single -related object), C (when there can be many), and C (for -when there is a single related object, but you also want the relationship -accessor to double as a column accessor). For C accessors, an -add_to_* method is also created, which calls C for the +relationship. Valid values are C (for when there is only a single +related object), C (when there can be many), and C (for +when there is a single related object, but you also want the relationship +accessor to double as a column accessor). For C accessors, an +add_to_* method is also created, which calls C for the relationship. =back @@ -398,7 +398,7 @@ sub add_relationship { eval { $self->resolve_join($rel, 'me') }; if ($@) { # If the resolve failed, back out and re-throw the error - delete $rels{$rel}; # + delete $rels{$rel}; # $self->_relationships(\%rels); $self->throw_exception("Error creating relationship $rel: $@"); } @@ -431,7 +431,7 @@ name. sub relationship_info { my ($self, $rel) = @_; return $self->_relationships->{$rel}; -} +} =head2 has_relationship @@ -511,9 +511,9 @@ sub resolve_condition { while (my ($k, $v) = each %{$cond}) { # XXX should probably check these are valid columns $k =~ s/^foreign\.// || - $self->throw_exception("Invalid rel cond key ${k}"); + $self->throw_exception("Invalid rel cond key ${k}"); $v =~ s/^self\.// || - $self->throw_exception("Invalid rel cond val ${v}"); + $self->throw_exception("Invalid rel cond val ${v}"); if (ref $for) { # Object #warn "$self $k $for $v"; $ret{$k} = $for->get_column($v); @@ -577,7 +577,7 @@ in the supplied relationships. Examples: # 'artist.name', # 'producer.producerid', # 'producer.name' - #) + #) =cut @@ -719,7 +719,7 @@ See L. sub throw_exception { my $self = shift; - if (defined $self->schema) { + if (defined $self->schema) { $self->schema->throw_exception(@_); } else { croak(@_); diff --git a/lib/DBIx/Class/ResultSource/Table.pm b/lib/DBIx/Class/ResultSource/Table.pm index 95fdce0..1e56359 100644 --- a/lib/DBIx/Class/ResultSource/Table.pm +++ b/lib/DBIx/Class/ResultSource/Table.pm @@ -10,7 +10,7 @@ use Carp qw/croak/; use base qw/DBIx::Class/; __PACKAGE__->load_components(qw/ResultSource/); -=head1 NAME +=head1 NAME DBIx::Class::ResultSource::Table - Table object diff --git a/lib/DBIx/Class/ResultSourceProxy.pm b/lib/DBIx/Class/ResultSourceProxy.pm index 069a94b..3ae7ad6 100644 --- a/lib/DBIx/Class/ResultSourceProxy.pm +++ b/lib/DBIx/Class/ResultSourceProxy.pm @@ -1,4 +1,4 @@ -package # hide from PAUSE +package # hide from PAUSE DBIx::Class::ResultSourceProxy; use strict; @@ -22,20 +22,20 @@ sub add_columns { } } -sub has_column { - my ($self, $column) = @_; - return $self->result_source_instance->has_column($column); +sub has_column { + my ($self, $column) = @_; + return $self->result_source_instance->has_column($column); } -sub column_info { - my ($self, $column) = @_; - return $self->result_source_instance->column_info($column); +sub column_info { + my ($self, $column) = @_; + return $self->result_source_instance->column_info($column); } -sub columns { - return shift->result_source_instance->columns(@_); -} +sub columns { + return shift->result_source_instance->columns(@_); +} sub set_primary_key { shift->result_source_instance->set_primary_key(@_); diff --git a/lib/DBIx/Class/ResultSourceProxy/Table.pm b/lib/DBIx/Class/ResultSourceProxy/Table.pm index 1c93aed..b2921e6 100644 --- a/lib/DBIx/Class/ResultSourceProxy/Table.pm +++ b/lib/DBIx/Class/ResultSourceProxy/Table.pm @@ -10,9 +10,9 @@ __PACKAGE__->mk_group_accessors('component_class' => 'table_class'); __PACKAGE__->table_class('DBIx::Class::ResultSource::Table'); __PACKAGE__->mk_classdata('table_alias'); # FIXME: Doesn't actually do - # anything yet! + # anything yet! -=head1 NAME +=head1 NAME DBIx::Class::ResultSourceProxy::Table - provides a classdata table object and method proxies @@ -47,7 +47,7 @@ sub table { unless (ref $table) { $table = $class->table_class->new({ $class->can('result_source_instance') ? - %{$class->result_source_instance} : (), + %{$class->result_source_instance} : (), name => $table, result_class => $class, }); @@ -73,7 +73,7 @@ Returns 1 if the class has a column of this name, 0 otherwise. Returns the column metadata hashref for a column. For a description of the various types of column data in this hashref, see -L +L =cut diff --git a/lib/DBIx/Class/Row.pm b/lib/DBIx/Class/Row.pm index 1bdcd58..16745b5 100644 --- a/lib/DBIx/Class/Row.pm +++ b/lib/DBIx/Class/Row.pm @@ -10,7 +10,7 @@ __PACKAGE__->load_components(qw/AccessorGroup/); __PACKAGE__->mk_group_accessors('simple' => 'result_source'); -=head1 NAME +=head1 NAME DBIx::Class::Row - Basic row methods @@ -40,7 +40,7 @@ sub new { unless ref($attrs) eq 'HASH'; while (my ($k, $v) = each %$attrs) { $new->throw_exception("No such column $k on $class") - unless $class->has_column($k); + unless $class->has_column($k); $new->store_column($k => $v); } } @@ -122,8 +122,8 @@ sub update { $obj->delete -Deletes the object from the database. The object is still perfectly usable, -but ->in_storage() will now return 0 and the object must re inserted using +Deletes the object from the database. The object is still perfectly usable, +but ->in_storage() will now return 0 and the object must re inserted using ->insert() before ->update() can be used on it. =cut @@ -136,8 +136,8 @@ sub delete { $self->throw_exception("Cannot safely delete a row in a PK-less table") if ! keys %$ident_cond; foreach my $column (keys %$ident_cond) { - $self->throw_exception("Can't delete the object unless it has loaded the primary keys") - unless exists $self->{_column_data}{$column}; + $self->throw_exception("Can't delete the object unless it has loaded the primary keys") + unless exists $self->{_column_data}{$column}; } $self->result_source->storage->delete( $self->result_source->from, $ident_cond); @@ -280,9 +280,9 @@ Sets a column value without marking it as dirty. sub store_column { my ($self, $column, $value) = @_; - $self->throw_exception( "No such column '${column}'" ) + $self->throw_exception( "No such column '${column}'" ) unless exists $self->{_column_data}{$column} || $self->has_column($column); - $self->throw_exception( "set_column called for ${column} without value" ) + $self->throw_exception( "set_column called for ${column} without value" ) if @_ < 3; return $self->{_column_data}{$column} = $value; } @@ -312,7 +312,7 @@ sub inflate_result { if (ref($pre_val->[0]) eq 'ARRAY') { # multi my @pre_objects; foreach my $pre_rec (@$pre_val) { - unless ($pre_source->primary_columns == grep { exists $pre_rec->[0]{$_} + unless ($pre_source->primary_columns == grep { exists $pre_rec->[0]{$_} and defined $pre_rec->[0]{$_} } $pre_source->primary_columns) { next; } @@ -322,11 +322,11 @@ sub inflate_result { $new->related_resultset($pre)->set_cache(\@pre_objects); } elsif (defined $pre_val->[0]) { my $fetched; - unless ($pre_source->primary_columns == grep { exists $pre_val->[0]{$_} + unless ($pre_source->primary_columns == grep { exists $pre_val->[0]{$_} and !defined $pre_val->[0]{$_} } $pre_source->primary_columns) { $fetched = $pre_source->result_class->inflate_result( - $pre_source, @{$pre_val}); + $pre_source, @{$pre_val}); } my $accessor = $source->relationship_info($pre)->{attrs}{accessor}; $class->throw_exception("No accessor for prefetched $pre") diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm index e0cb8cc..0b9b969 100644 --- a/lib/DBIx/Class/Schema.pm +++ b/lib/DBIx/Class/Schema.pm @@ -99,7 +99,7 @@ sub register_source { $map{$source->result_class} = $moniker; $self->class_mappings(\%map); } -} +} =head2 class @@ -207,7 +207,7 @@ need to add C before your load_classes call. Example: My::Schema->load_classes(); # loads My::Schema::CD, My::Schema::Artist, - # etc. (anything under the My::Schema namespace) + # etc. (anything under the My::Schema namespace) # loads My::Schema::CD, My::Schema::Artist, Other::Namespace::Producer but # not Other::Namespace::LinerNotes nor My::Schema::Track @@ -263,9 +263,9 @@ sub load_classes { my $comp_class = "${prefix}::${comp}"; eval "use $comp_class"; # If it fails, assume the user fixed it if ($@) { - $comp_class =~ s/::/\//g; + $comp_class =~ s/::/\//g; die $@ unless $@ =~ /Can't locate.+$comp_class\.pm\sin\s\@INC/; - warn $@ if $@; + warn $@ if $@; } push(@to_register, [ $comp, $comp_class ]); } @@ -569,8 +569,8 @@ sub txn_do { $self->txn_begin; # If this throws an exception, no rollback is needed my $wantarray = wantarray; # Need to save this since the context - # inside the eval{} block is independent - # of the context that called txn_do() + # inside the eval{} block is independent + # of the context that called txn_do() eval { # Need to differentiate between scalar/list context to allow for @@ -599,7 +599,7 @@ sub txn_do { my $rollback_error = $@; my $exception_class = "DBIx::Class::Storage::NESTED_ROLLBACK_EXCEPTION"; $self->throw_exception($error) # propagate nested rollback - if $rollback_error =~ /$exception_class/; + if $rollback_error =~ /$exception_class/; $self->throw_exception( "Transaction aborted: $error. Rollback failed: ${rollback_error}" @@ -674,7 +674,7 @@ sub populate { =head2 throw_exception -=over 4 +=over 4 =item Arguments: $message diff --git a/lib/DBIx/Class/Serialize/Storable.pm b/lib/DBIx/Class/Serialize/Storable.pm index 45a8285..b3ac604 100644 --- a/lib/DBIx/Class/Serialize/Storable.pm +++ b/lib/DBIx/Class/Serialize/Storable.pm @@ -21,7 +21,7 @@ sub STORABLE_thaw { __END__ -=head1 NAME +=head1 NAME DBIx::Class::Serialize::Storable - hooks for Storable freeze/thaw diff --git a/lib/DBIx/Class/Storage.pm b/lib/DBIx/Class/Storage.pm index af90340..5295341 100644 --- a/lib/DBIx/Class/Storage.pm +++ b/lib/DBIx/Class/Storage.pm @@ -1,4 +1,4 @@ -package # hide from PAUSE +package # hide from PAUSE DBIx::Class::Storage; use strict; diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index f97ed8d..a6d50c9 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -236,7 +236,7 @@ sub throw_exception { croak($msg); } -=head1 NAME +=head1 NAME DBIx::Class::Storage::DBI - DBI storage handler @@ -406,7 +406,7 @@ sub txn_commit { $self->dbh->commit unless $self->dbh->{AutoCommit}; } else { - $self->dbh->commit if --$self->{transaction_depth} == 0; + $self->dbh->commit if --$self->{transaction_depth} == 0; } } @@ -453,10 +453,10 @@ sub _execute { $self->throw_exception("no sth generated via sql: $sql") unless $sth; @bind = map { ref $_ ? ''.$_ : $_ } @bind; # stringify args my $rv; - if ($sth) { + if ($sth) { $rv = $sth->execute(@bind) or $self->throw_exception("Error executing '$sql': " . $sth->errstr); - } else { + } else { $self->throw_exception("'$sql' did not generate a statement."); } return (wantarray ? ($rv, $sth, @bind) : $rv); @@ -600,7 +600,7 @@ sub deployment_statements { eval "use SQL::Translator"; $self->throw_exception("Can't deploy without SQL::Translator: $@") if $@; eval "use SQL::Translator::Parser::DBIx::Class;"; - $self->throw_exception($@) if $@; + $self->throw_exception($@) if $@; eval "use SQL::Translator::Producer::${type};"; $self->throw_exception($@) if $@; my $tr = SQL::Translator->new(%$sqltargs); @@ -614,7 +614,7 @@ sub deploy { foreach(split(";\n", @statements)) { $self->debugfh->print("$_\n") if $self->debug; $self->dbh->do($_) or warn "SQL was:\n $_"; - } + } } sub DESTROY { shift->disconnect } diff --git a/lib/DBIx/Class/Storage/DBI/DB2.pm b/lib/DBIx/Class/Storage/DBI/DB2.pm index a6e1452..83e2bc7 100644 --- a/lib/DBIx/Class/Storage/DBI/DB2.pm +++ b/lib/DBIx/Class/Storage/DBI/DB2.pm @@ -23,7 +23,7 @@ sub last_insert_id 1; -=head1 NAME +=head1 NAME DBIx::Class::Storage::DBI::DB2 - Automatic primary key class for DB2 diff --git a/lib/DBIx/Class/Storage/DBI/MSSQL.pm b/lib/DBIx/Class/Storage/DBI/MSSQL.pm index 7a30b65..171c17a 100644 --- a/lib/DBIx/Class/Storage/DBI/MSSQL.pm +++ b/lib/DBIx/Class/Storage/DBI/MSSQL.pm @@ -1,39 +1,39 @@ -package DBIx::Class::Storage::DBI::MSSQL; +package DBIx::Class::Storage::DBI::MSSQL; -use strict; -use warnings; +use strict; +use warnings; -use base qw/DBIx::Class::Storage::DBI/; +use base qw/DBIx::Class::Storage::DBI/; -# __PACKAGE__->load_components(qw/PK::Auto/); +# __PACKAGE__->load_components(qw/PK::Auto/); -sub last_insert_id { - my( $id ) = $_[0]->_dbh->selectrow_array('SELECT @@IDENTITY' ); - return $id; -} +sub last_insert_id { + my( $id ) = $_[0]->_dbh->selectrow_array('SELECT @@IDENTITY' ); + return $id; +} -1; +1; -=head1 NAME +=head1 NAME -DBIx::Class::Storage::DBI::MSSQL - Automatic primary key class for MSSQL +DBIx::Class::Storage::DBI::MSSQL - Automatic primary key class for MSSQL -=head1 SYNOPSIS +=head1 SYNOPSIS - # In your table classes - __PACKAGE__->load_components(qw/PK::Auto Core/); - __PACKAGE__->set_primary_key('id'); + # In your table classes + __PACKAGE__->load_components(qw/PK::Auto Core/); + __PACKAGE__->set_primary_key('id'); -=head1 DESCRIPTION +=head1 DESCRIPTION -This class implements autoincrements for MSSQL. +This class implements autoincrements for MSSQL. -=head1 AUTHORS +=head1 AUTHORS -Brian Cassidy +Brian Cassidy -=head1 LICENSE +=head1 LICENSE -You may distribute this code under the same terms as Perl itself. +You may distribute this code under the same terms as Perl itself. -=cut +=cut diff --git a/lib/DBIx/Class/Storage/DBI/Oracle.pm b/lib/DBIx/Class/Storage/DBI/Oracle.pm index 5fa4fce..53d657a 100644 --- a/lib/DBIx/Class/Storage/DBI/Oracle.pm +++ b/lib/DBIx/Class/Storage/DBI/Oracle.pm @@ -14,7 +14,7 @@ sub last_insert_id { my $seq = ($source->column_info($col)->{sequence} ||= $self->get_autoinc_seq($source,$col)); my $sql = "SELECT " . $seq . ".currval FROM DUAL"; my ($id) = $self->_dbh->selectrow_array($sql); - return $id; + return $id; } sub get_autoinc_seq { @@ -40,7 +40,7 @@ sub get_autoinc_seq { 1; -=head1 NAME +=head1 NAME DBIx::Class::Storage::DBI::Oracle - Automatic primary key class for Oracle diff --git a/lib/DBIx/Class/Storage/DBI/Pg.pm b/lib/DBIx/Class/Storage/DBI/Pg.pm index 75b22e4..1352c25 100644 --- a/lib/DBIx/Class/Storage/DBI/Pg.pm +++ b/lib/DBIx/Class/Storage/DBI/Pg.pm @@ -22,11 +22,11 @@ sub get_autoinc_seq { : (undef,$source->name); while (my $col = shift @pri) { my $info = $dbh->column_info(undef,$schema,$table,$col)->fetchrow_arrayref; - if (defined $info->[12] and $info->[12] =~ + if (defined $info->[12] and $info->[12] =~ /^nextval\(+'([^']+)'::(?:text|regclass)\)/) { return $1; # may need to strip quotes -- see if this works - } + } } } @@ -36,7 +36,7 @@ sub sqlt_type { 1; -=head1 NAME +=head1 NAME DBIx::Class::Storage::DBI::Pg - Automatic primary key class for PostgreSQL diff --git a/lib/DBIx/Class/Storage/DBI/SQLite.pm b/lib/DBIx/Class/Storage/DBI/SQLite.pm index 6893398..6b7e749 100644 --- a/lib/DBIx/Class/Storage/DBI/SQLite.pm +++ b/lib/DBIx/Class/Storage/DBI/SQLite.pm @@ -11,7 +11,7 @@ sub last_insert_id { 1; -=head1 NAME +=head1 NAME DBIx::Class::PK::Auto::SQLite - Automatic primary key class for SQLite diff --git a/lib/DBIx/Class/Storage/DBI/mysql.pm b/lib/DBIx/Class/Storage/DBI/mysql.pm index d601f1d..8c14b1b 100644 --- a/lib/DBIx/Class/Storage/DBI/mysql.pm +++ b/lib/DBIx/Class/Storage/DBI/mysql.pm @@ -17,7 +17,7 @@ sub sqlt_type { 1; -=head1 NAME +=head1 NAME DBIx::Class::Storage::DBI::mysql - Automatic primary key class for MySQL diff --git a/lib/DBIx/Class/Test/SQLite.pm b/lib/DBIx/Class/Test/SQLite.pm index e5bc012..72a3c10 100644 --- a/lib/DBIx/Class/Test/SQLite.pm +++ b/lib/DBIx/Class/Test/SQLite.pm @@ -6,20 +6,20 @@ DBIx::Class::Test::SQLite - Base class for running Class::DBI tests against DBIx =head1 SYNOPSIS - use base 'DBIx::Class::Test::SQLite'; - - __PACKAGE__->set_table('test'); - __PACKAGE__->columns(All => qw/id name film salary/); - - sub create_sql { - return q{ - id INTEGER PRIMARY KEY, - name CHAR(40), - film VARCHAR(255), - salary INT - } - } - + use base 'DBIx::Class::Test::SQLite'; + + __PACKAGE__->set_table('test'); + __PACKAGE__->columns(All => qw/id name film salary/); + + sub create_sql { + return q{ + id INTEGER PRIMARY KEY, + name CHAR(40), + film VARCHAR(255), + salary INT + } + } + =head1 DESCRIPTION This provides a simple base class for DBIx::Class::CDBICompat tests using @@ -52,7 +52,7 @@ __PACKAGE__->storage->dbh->do("PRAGMA synchronous = OFF"); =head2 set_table - __PACKAGE__->set_table('test'); + __PACKAGE__->set_table('test'); This combines creating the table with the normal DBIx::Class table() call. @@ -60,29 +60,29 @@ call. =cut sub set_table { - my ($class, $table) = @_; - $class->table($table); - $class->_create_test_table; + my ($class, $table) = @_; + $class->table($table); + $class->_create_test_table; } sub _create_test_table { - my $class = shift; - my @vals = $class->sql__table_pragma->select_row; - $class->sql__create_me($class->create_sql)->execute unless @vals; + my $class = shift; + my @vals = $class->sql__table_pragma->select_row; + $class->sql__create_me($class->create_sql)->execute unless @vals; } =head2 create_sql This is an abstract method you must override. - sub create_sql { - return q{ - id INTEGER PRIMARY KEY, - name CHAR(40), - film VARCHAR(255), - salary INT - } - } + sub create_sql { + return q{ + id INTEGER PRIMARY KEY, + name CHAR(40), + film VARCHAR(255), + salary INT + } + } This should return, as a text string, the schema for the table represented by this class. diff --git a/lib/DBIx/Class/UUIDColumns.pm b/lib/DBIx/Class/UUIDColumns.pm index b7e4e7c..fdd6adc 100644 --- a/lib/DBIx/Class/UUIDColumns.pm +++ b/lib/DBIx/Class/UUIDColumns.pm @@ -13,7 +13,7 @@ __PACKAGE__->uuid_class( __PACKAGE__->_find_uuid_module ); sub uuid_columns { my $self = shift; for (@_) { - $self->throw_exception("column $_ doesn't exist") unless $self->has_column($_); + $self->throw_exception("column $_ doesn't exist") unless $self->has_column($_); } $self->uuid_auto_columns(\@_); } @@ -39,8 +39,8 @@ sub uuid_class { sub insert { my $self = shift; for my $column (@{$self->uuid_auto_columns}) { - $self->store_column( $column, $self->get_uuid ) - unless defined $self->get_column( $column ); + $self->store_column( $column, $self->get_uuid ) + unless defined $self->get_column( $column ); } $self->next::method(@_); } diff --git a/lib/DBIx/Class/Validation.pm b/lib/DBIx/Class/Validation.pm index b51c9c8..4592a89 100644 --- a/lib/DBIx/Class/Validation.pm +++ b/lib/DBIx/Class/Validation.pm @@ -95,14 +95,14 @@ And then somewhere else: auto => 1, ); -Calls validation_module(), validation_profile(), and validation_auto() if the corresponding +Calls validation_module(), validation_profile(), and validation_auto() if the corresponding argument is defined. =head2 validation_module __PACKAGE__->validation_module('Data::FormValidator'); -Sets the validation module to use. Any module that supports a check() method just like +Sets the validation module to use. Any module that supports a check() method just like Data::FormValidator's can be used here, such as FormValidator::Simple. Defaults to FormValidator::Simple. @@ -119,24 +119,24 @@ Sets the profile that will be passed to the validation module. __PACKAGE__->validation_auto( 1 ); -This flag, when enabled, causes any updates or inserts of the class +This flag, when enabled, causes any updates or inserts of the class to call validate() before actually executing. =head2 validate $obj->validate(); -Validates all the data in the object against the pre-defined validation -module and profile. If there is a problem then a hard error will be -thrown. If you put the validation in an eval you can capture whatever +Validates all the data in the object against the pre-defined validation +module and profile. If there is a problem then a hard error will be +thrown. If you put the validation in an eval you can capture whatever the module's check() method returned. =head2 auto_validate __PACKAGE__->auto_validate( 0 ); -Turns on and off auto-validation. This feature makes all UPDATEs and -INSERTs call the validate() method before doing anything. The default +Turns on and off auto-validation. This feature makes all UPDATEs and +INSERTs call the validate() method before doing anything. The default is for auto-validation to be on. Defaults to on. diff --git a/lib/SQL/Translator/Parser/DBIx/Class.pm b/lib/SQL/Translator/Parser/DBIx/Class.pm index 92a6204..b638fd0 100644 --- a/lib/SQL/Translator/Parser/DBIx/Class.pm +++ b/lib/SQL/Translator/Parser/DBIx/Class.pm @@ -1,4 +1,4 @@ -package # hide from PAUSE +package # hide from PAUSE SQL::Translator::Parser::DBIx::Class; # AUTHOR: Jess Robinson @@ -94,9 +94,9 @@ sub parse { my ($refkey) = $cond =~ /^\w+\.(\w+)$/; my ($key) = $rel_info->{cond}->{$cond} =~ /^\w+\.(\w+)$/; if($rel_table && $refkey) - { + { $table->add_constraint( - type => 'foreign_key', + type => 'foreign_key', name => "fk_${key}", fields => $key, reference_fields => $refkey, @@ -106,6 +106,6 @@ sub parse { } } -} +} 1; diff --git a/lib/SQL/Translator/Producer/DBIx/Class/File.pm b/lib/SQL/Translator/Producer/DBIx/Class/File.pm index cfc8d92..300ce50 100644 --- a/lib/SQL/Translator/Producer/DBIx/Class/File.pm +++ b/lib/SQL/Translator/Producer/DBIx/Class/File.pm @@ -8,7 +8,7 @@ SQL::Translator::Producer::DBIx::Class::File - DBIx::Class file producer use SQL::Translator; - my $t = SQL::Translator->new( parser => '...', + my $t = SQL::Translator->new( parser => '...', producer => 'DBIx::Class::File' ); print $translator->translate( $file ); @@ -48,7 +48,7 @@ sub produce my $output = ''; # Steal the XML producers "prefix" arg for our namespace? - my $dbixschema = $translator->producer_args()->{prefix} || + my $dbixschema = $translator->producer_args()->{prefix} || $schema->name || 'My::Schema'; my $pkclass = $parser2PK{$translator->parser_type} || ''; @@ -81,7 +81,7 @@ __PACKAGE__->table('${tname}'); }; - my @fields = map + my @fields = map { { $_->name => { name => $_->name, is_auto_increment => $_->is_auto_increment, @@ -98,7 +98,7 @@ __PACKAGE__->table('${tname}'); { local $Data::Dumper::Terse = 1; $output .= "\n '" . (keys %$f)[0] . "' => " ; - my $colinfo = + my $colinfo = Data::Dumper->Dump([values %$f], [''] # keys %$f] ); @@ -120,11 +120,11 @@ __PACKAGE__->table('${tname}'); # print Data::Dumper::Dumper($cont->type); if($cont->type =~ /foreign key/i) { -# $output .= "\n__PACKAGE__->belongs_to('" . +# $output .= "\n__PACKAGE__->belongs_to('" . # $cont->fields->[0]->name . "', '" . # "${dbixschema}::" . $cont->reference_table . "');\n"; - $tableextras{$table->name} .= "\n__PACKAGE__->belongs_to('" . + $tableextras{$table->name} .= "\n__PACKAGE__->belongs_to('" . $cont->fields->[0]->name . "', '" . "${dbixschema}::" . $cont->reference_table . "');\n"; @@ -142,7 +142,7 @@ __PACKAGE__->table('${tname}'); foreach my $to (keys %tableoutput) { $output .= $tableoutput{$to}; - $schemaoutput .= "\n__PACKAGE__->register_class('${to}', '${dbixschema}::${to}');\n"; + $schemaoutput .= "\n__PACKAGE__->register_class('${to}', '${dbixschema}::${to}');\n"; } foreach my $te (keys %tableextras)