Skip to content

Commit b5ce674

Browse files
committed
is_X_value functions introduced in 3705e3b migrated to SQLA with fixups
1 parent 5f35ba0 commit b5ce674

File tree

13 files changed

+26
-87
lines changed

13 files changed

+26
-87
lines changed

Makefile.PL

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ my $runtime_requires = {
8585
'namespace::clean' => '0.24',
8686
'Path::Class' => '0.18',
8787
'Scope::Guard' => '0.03',
88-
'SQL::Abstract' => '1.78',
88+
'SQL::Abstract' => '1.78_02', # TEMPORARY
8989
'Try::Tiny' => '0.07',
9090

9191
# Technically this is not a core dependency - it is only required

lib/DBIx/Class/FilterColumn.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use strict;
33
use warnings;
44

55
use base 'DBIx::Class::Row';
6-
use DBIx::Class::_Util 'is_literal_value';
6+
use SQL::Abstract 'is_literal_value';
77
use namespace::clean;
88

99
sub filter_column {

lib/DBIx/Class/InflateColumn.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use strict;
44
use warnings;
55

66
use base 'DBIx::Class::Row';
7-
use DBIx::Class::_Util 'is_literal_value';
7+
use SQL::Abstract 'is_literal_value';
88
use namespace::clean;
99

1010
=head1 NAME

lib/DBIx/Class/Row.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use Scalar::Util 'blessed';
99
use List::Util 'first';
1010
use Try::Tiny;
1111
use DBIx::Class::Carp;
12-
use DBIx::Class::_Util 'is_literal_value';
12+
use SQL::Abstract 'is_literal_value';
1313

1414
###
1515
### Internal method

lib/DBIx/Class/Storage/DBI.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use Sub::Name 'subname';
1414
use Context::Preserve 'preserve_context';
1515
use Try::Tiny;
1616
use Data::Compare (); # no imports!!! guard against insane architecture
17-
use DBIx::Class::_Util qw(is_plain_value is_literal_value);
17+
use SQL::Abstract qw(is_plain_value is_literal_value);
1818
use namespace::clean;
1919

2020
# default cursor class, overridable in connect_info attributes

lib/DBIx/Class/Storage/DBI/SQLite.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ use warnings;
66
use base qw/DBIx::Class::Storage::DBI/;
77
use mro 'c3';
88

9-
use DBIx::Class::_Util qw(modver_gt_or_eq sigwarn_silencer is_plain_value);
9+
use SQL::Abstract 'is_plain_value';
10+
use DBIx::Class::_Util qw(modver_gt_or_eq sigwarn_silencer);
1011
use DBIx::Class::Carp;
1112
use Try::Tiny;
1213
use namespace::clean;

lib/DBIx/Class/Storage/DBIHacks.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ use mro 'c3';
1616
use List::Util 'first';
1717
use Scalar::Util 'blessed';
1818
use Sub::Name 'subname';
19-
use DBIx::Class::_Util qw(is_plain_value is_literal_value UNRESOLVABLE_CONDITION);
19+
use DBIx::Class::_Util 'UNRESOLVABLE_CONDITION';
20+
use SQL::Abstract qw(is_plain_value is_literal_value);
2021
use namespace::clean;
2122

2223
#

lib/DBIx/Class/_Util.pm

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,11 @@ use DBIx::Class::Carp '^DBIx::Class|^DBICTest';
5252
use Carp 'croak';
5353
use Scalar::Util qw(weaken blessed reftype);
5454
use List::Util qw(first);
55-
use overload ();
5655

5756
use base 'Exporter';
5857
our @EXPORT_OK = qw(
5958
sigwarn_silencer modver_gt_or_eq fail_on_internal_wantarray
6059
refdesc refcount hrefaddr is_exception
61-
is_plain_value is_literal_value
6260
UNRESOLVABLE_CONDITION
6361
);
6462

@@ -168,47 +166,6 @@ sub modver_gt_or_eq ($$) {
168166
eval { $mod->VERSION($ver) } ? 1 : 0;
169167
}
170168

171-
sub is_literal_value ($) {
172-
(
173-
ref $_[0] eq 'SCALAR'
174-
or
175-
( ref $_[0] eq 'HASH' and keys %{$_[0]} == 1 and defined $_[0]->{-ident} and ! length ref $_[0]->{-ident} )
176-
or
177-
( ref $_[0] eq 'REF' and ref ${$_[0]} eq 'ARRAY' )
178-
) ? 1 : 0;
179-
}
180-
181-
# FIXME XSify - this can be done so much more efficiently
182-
sub is_plain_value ($) {
183-
no strict 'refs';
184-
(
185-
# plain scalar
186-
(! length ref $_[0])
187-
or
188-
(
189-
blessed $_[0]
190-
and
191-
# deliberately not using Devel::OverloadInfo - the checks we are
192-
# intersted in are much more limited than the fullblown thing, and
193-
# this is a relatively hot piece of code
194-
(
195-
# FIXME - DBI needs fixing to stringify regardless of DBD
196-
#
197-
# either has stringification which DBI SHOULD prefer out of the box
198-
#first { *{$_ . '::(""'}{CODE} } @{ mro::get_linear_isa( ref $_[0] ) }
199-
overload::Method($_[0], '""')
200-
or
201-
# has nummification and fallback is *not* disabled
202-
(
203-
$_[1] = first { *{"${_}::(0+"}{CODE} } @{ mro::get_linear_isa( ref $_[0] ) }
204-
and
205-
( ! defined ${"$_[1]::()"} or ${"$_[1]::()"} )
206-
)
207-
)
208-
)
209-
) ? 1 : 0;
210-
}
211-
212169
{
213170
my $list_ctx_ok_stack_marker;
214171

t/53lean_startup.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ BEGIN {
106106
107107
Class::Accessor::Grouped
108108
Class::C3::Componentised
109+
SQL::Abstract
109110
));
110111

111112
require DBICTest::Schema;
@@ -129,7 +130,6 @@ BEGIN {
129130
{
130131
register_lazy_loadable_requires(qw(
131132
DBI
132-
SQL::Abstract
133133
Hash::Merge
134134
));
135135

t/55namespaces_cleaned.t

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,18 @@ for my $mod (@modules) {
149149
last;
150150
}
151151
}
152-
fail ("${mod}::${name} appears to have entered inheritance chain by import into "
153-
. ($via || 'UNKNOWN')
154-
);
152+
153+
# exception time
154+
if (
155+
( $name eq 'import' and $via = 'Exporter' )
156+
) {
157+
pass("${mod}::${name} is a valid uncleaned import from ${name}");
158+
}
159+
else {
160+
fail ("${mod}::${name} appears to have entered inheritance chain by import into "
161+
. ($via || 'UNKNOWN')
162+
);
163+
}
155164
}
156165
}
157166

0 commit comments

Comments
 (0)