packaging one directory
|
1 |
package DBIx::Custom::Query; |
updatedd pod
|
2 |
use Object::Simple -base; |
update document
|
3 | |
cleanup
|
4 |
use Carp 'croak'; |
cleanup
|
5 |
use DBIx::Custom::Util '_subname'; |
cleanup
|
6 | |
- insert method id value is ...
|
7 |
has [qw/sth statement/], |
cleanup
|
8 |
sql => '', |
9 |
columns => sub { [] }; |
|
cleanup
|
10 | |
DBIx::Custom::Query filters ...
|
11 |
# DEPRECATED! |
12 |
has 'default_filter'; |
|
13 |
sub filters { |
|
cleanup
|
14 |
warn "DBIx::Custom::Query filters attribute method is DEPRECATED!"; |
15 |
my $self = shift; |
|
16 |
if (@_) { |
|
17 |
$self->{filters} = $_[0]; |
|
18 |
return $self; |
|
19 |
} |
|
20 |
return $self->{filters}; |
|
DBIx::Custom::Query filters ...
|
21 |
} |
DBIx::Custom::Query tables a...
|
22 | |
23 |
# DEPRECATED! |
|
24 |
sub tables { |
|
cleanup
|
25 |
warn "DBIx::Custom::Query tables attribute method is DEPRECATED!"; |
26 |
my $self = shift; |
|
27 |
if (@_) { |
|
28 |
$self->{tables} = $_[0]; |
|
29 |
return $self; |
|
30 |
} |
|
31 |
return $self->{tables} ||= []; |
|
DBIx::Custom::Query tables a...
|
32 |
} |
DBIx::Custom::Query filters ...
|
33 | |
34 |
#DEPRECATED! |
|
cleanup
|
35 |
sub filter { |
cleanup
|
36 |
Carp::carp "DBIx::Custom::Query filter method is DEPRECATED!"; |
37 |
my $self = shift; |
|
38 |
if (@_) { |
|
39 |
my $filter = {}; |
|
40 |
if (ref $_[0] eq 'HASH') { |
|
41 |
$filter = $_[0]; |
|
42 |
} |
|
43 |
else { |
|
44 |
my $ef = @_ > 1 ? [@_] : $_[0]; |
|
45 |
for (my $i = 0; $i < @$ef; $i += 2) { |
|
46 |
my $column = $ef->[$i]; |
|
47 |
my $f = $ef->[$i + 1]; |
|
48 |
if (ref $column eq 'ARRAY') { |
|
49 |
for my $c (@$column) { $filter->{$c} = $f } |
|
cleanup
|
50 |
} |
cleanup
|
51 |
else { $filter->{$column} = $f } |
52 |
} |
|
53 |
} |
|
54 |
for my $column (keys %$filter) { |
|
55 |
my $fname = $filter->{$column}; |
|
56 |
if (exists $filter->{$column} |
|
57 |
&& defined $fname |
|
58 |
&& ref $fname ne 'CODE') |
|
59 |
{ |
|
60 |
my $filters = $self->{filters} || {}; |
|
61 |
croak qq{Filter "$fname" is not registered" } . _subname |
|
62 |
unless exists $filters->{$fname}; |
|
63 |
$filter->{$column} = $filters->{$fname}; |
|
64 |
} |
|
cleanup
|
65 |
} |
cleanup
|
66 |
$self->{filter} = {%{$self->{filter} || {}}, %$filter}; |
67 |
return $self; |
|
68 |
} |
|
69 |
return $self->{filter} ||= {}; |
|
cleanup
|
70 |
} |
cleanup
|
71 | |
update document
|
72 |
1; |
73 | ||
packaging one directory
|
74 |
=head1 NAME |
75 | ||
DBIx::Custom::Query is DEPRE...
|
76 |
DBIx::Custom::Query - DEPRECATED! |
packaging one directory
|
77 |