Skip to content

Commit

Permalink
Tidied all code
Browse files Browse the repository at this point in the history
  • Loading branch information
autarch committed Jun 14, 2015
1 parent 8a8bb25 commit 4b07297
Show file tree
Hide file tree
Showing 24 changed files with 179 additions and 134 deletions.
2 changes: 1 addition & 1 deletion lib/Fey/FK.pm
Expand Up @@ -43,7 +43,7 @@ has column_pairs => (

# really, the inner array refs must always contain 2 columns,
# but we don't have structured constraints quite yet.
isa => ArrayRef[ArrayRef[Column]],
isa => ArrayRef [ ArrayRef [Column] ],
lazy_build => 1,
init_arg => undef,
);
Expand Down
2 changes: 1 addition & 1 deletion lib/Fey/Literal/Term.pm
Expand Up @@ -47,7 +47,7 @@ sub sql {
blessed($_) && $_->can('sql_or_alias')
? $_->sql_or_alias($dbh)
: $_
} @{ $self->term() }
} @{ $self->term() }
);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Fey/Role/SQL/HasLimitClause.pm
Expand Up @@ -29,7 +29,7 @@ sub limit {
my $self = shift;
my ( $limit, $offset ) = pos_validated_list(
\@_,
{ isa => (PosInteger | Undef) },
{ isa => ( PosInteger | Undef ) },
{
isa => PosOrZeroInteger,
optional => 1,
Expand Down
2 changes: 1 addition & 1 deletion lib/Fey/Role/SetOperation.pm
Expand Up @@ -31,7 +31,7 @@ has 'is_all' => (
has '_set_elements' => (
traits => ['Array'],
is => 'bare',
isa => ArrayRef[SetOperationArg],
isa => ArrayRef [SetOperationArg],
default => sub { [] },
handles => {
_add_set_elements => 'push',
Expand Down
2 changes: 1 addition & 1 deletion lib/Fey/SQL/Fragment/Join.pm
Expand Up @@ -52,7 +52,7 @@ sub BUILD {
my $self = shift;

param_error 'You cannot join two tables without a foreign key'
if $self->_has_table2() && ! $self->_has_fk();
if $self->_has_table2() && !$self->_has_fk();

return;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Fey/SQL/Fragment/Where/Comparison.pm
Expand Up @@ -28,7 +28,7 @@ has '_operator' => (

has '_rhs' => (
is => 'ro',
isa => ArrayRef[WhereClauseSide],
isa => ArrayRef [WhereClauseSide],
required => 1,
);

Expand Down
6 changes: 3 additions & 3 deletions lib/Fey/SQL/Insert.pm
Expand Up @@ -8,7 +8,7 @@ our $VERSION = '0.41';

use Fey::Types
qw( ArrayRef HashRef CanQuote IntoElement NonNullableInsertValue
NullableInsertValue );
NullableInsertValue );
use overload ();
use Scalar::Util qw( blessed );

Expand All @@ -34,7 +34,7 @@ has '_values_spec' => (
has '_values' => (
traits => ['Array'],
is => 'bare',
isa => ArrayRef[HashRef],
isa => ArrayRef [HashRef],
default => sub { [] },
handles => {
_add_values => 'push',
Expand Down Expand Up @@ -165,7 +165,7 @@ sub values_clause {
&& $val->does('Fey::Role::SQL::ReturnsData')
? "($sql)"
: $sql
} @cols
} @cols
);

$v .= ')';
Expand Down
14 changes: 7 additions & 7 deletions lib/Fey/SQL/Select.pm
Expand Up @@ -258,7 +258,7 @@ sub _check_join_arguments {
'the first two arguments to from() were not valid (not tables or something else joinable).'
unless
all { blessed $_ && $_->can('is_joinable') && $_->is_joinable() }
@_[ 0, 1 ];
@_[ 0, 1 ];
}

sub _fk_for_join {
Expand Down Expand Up @@ -334,9 +334,9 @@ sub _check_outer_join_arguments {

param_error 'from() was called with invalid arguments'
unless $_[0]->can('is_joinable')
&& $_[0]->is_joinable()
&& $_[2]->can('is_joinable')
&& $_[2]->is_joinable();
&& $_[0]->is_joinable()
&& $_[2]->can('is_joinable')
&& $_[2]->is_joinable();
}

sub group_by {
Expand Down Expand Up @@ -487,9 +487,9 @@ sub bind_params {

return (
(
map { $_->bind_params() }
grep { $_->can('bind_params') }
$self->select_clause_elements()
map { $_->bind_params() }
grep { $_->can('bind_params') }
$self->select_clause_elements()
),

(
Expand Down
15 changes: 7 additions & 8 deletions lib/Fey/SQL/Update.pm
Expand Up @@ -8,9 +8,8 @@ our $VERSION = '0.41';

use Fey::Exceptions qw( param_error );
use Fey::Literal;
use Fey::Types
qw( ArrayRef CanQuote ColumnWithTable NonNullableUpdateValue
NullableUpdateValue Table );
use Fey::Types qw( ArrayRef CanQuote ColumnWithTable NonNullableUpdateValue
NullableUpdateValue Table );
use overload ();
use Scalar::Util qw( blessed );

Expand Down Expand Up @@ -41,7 +40,7 @@ has '_update' => (
has '_set_pairs' => (
traits => ['Array'],
is => 'bare',
isa => ArrayRef[ArrayRef],
isa => ArrayRef [ArrayRef],
default => sub { [] },
handles => {
_add_set_pair => 'push',
Expand Down Expand Up @@ -149,14 +148,14 @@ sub set_clause {
'SET ' . (
join ', ',
map {
my $val = $_->[1];
my $val = $_->[1];
my $val_sql = $val->sql($dbh);
$val_sql = "($val_sql)"
if blessed $val
&& $val->can('does')
&& $val->does('Fey::Role::SQL::ReturnsData');
&& $val->can('does')
&& $val->does('Fey::Role::SQL::ReturnsData');
$self->$col_quote( $_->[0], $dbh ) . ' = ' . $val_sql;
} $self->_set_pairs()
} $self->_set_pairs()
)
);
}
Expand Down
3 changes: 2 additions & 1 deletion lib/Fey/Schema.pm
Expand Up @@ -10,7 +10,8 @@ use Fey::Exceptions qw( param_error );
use Fey::NamedObjectSet;
use Fey::SQL;
use Fey::Table;
use Fey::Types qw( FK HashRef NamedObjectSet Str Table TableLikeOrName TableOrName );
use Fey::Types
qw( FK HashRef NamedObjectSet Str Table TableLikeOrName TableOrName );
use Scalar::Util qw( blessed );

use Moose 0.90;
Expand Down
6 changes: 3 additions & 3 deletions lib/Fey/Table.pm
Expand Up @@ -51,7 +51,7 @@ has 'is_view' => (
has '_keys' => (
traits => ['Array'],
is => 'bare',
isa => ArrayRef[NamedObjectSet],
isa => ArrayRef [NamedObjectSet],
default => sub { [] },
handles => {
_keys => 'elements',
Expand Down Expand Up @@ -82,7 +82,7 @@ has 'schema' => (

has 'candidate_keys' => (
is => 'ro',
isa => ArrayRef[ArrayRef[Column]],
isa => ArrayRef [ ArrayRef [Column] ],
clearer => '_clear_candidate_keys',
lazy_build => 1,
init_arg => undef,
Expand All @@ -92,7 +92,7 @@ after '_add_key', '_delete_key' => sub { $_[0]->_clear_candidate_keys() };

has 'primary_key' => (
is => 'ro',
isa => ArrayRef[Column],
isa => ArrayRef [Column],
clearer => '_clear_primary_key',
lazy_build => 1,
init_arg => undef,
Expand Down
2 changes: 1 addition & 1 deletion lib/Fey/Table/Alias.pm
Expand Up @@ -38,7 +38,7 @@ has 'alias_name' => (
has '_columns' => (
traits => ['Hash'],
is => 'bare',
isa => HashRef[Column],
isa => HashRef [Column],
default => sub { {} },
handles => {
_get_column => 'get',
Expand Down
3 changes: 1 addition & 2 deletions lib/Fey/Types.pm
Expand Up @@ -8,8 +8,7 @@ use base 'MooseX::Types::Combine';
our $VERSION = '0.41';

__PACKAGE__->provide_types_from(
qw( MooseX::Types::Moose Fey::Types::Internal )
);
qw( MooseX::Types::Moose Fey::Types::Internal ) );

1;

Expand Down

0 comments on commit 4b07297

Please sign in to comment.