X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBM%2FDeep.pm;h=bf507fc952f637796a9810b93b1a9e4196ce422c;hb=350896ee7e5b32e5f965e84f445df47113573a72;hp=94c296faf73cdfe7ec15b9afc79161aa9f3f364b;hpb=19b913ce4f25ce69bd69b4bf4a95ca99d4aa007e;p=dbsrgits%2FDBM-Deep.git diff --git a/lib/DBM/Deep.pm b/lib/DBM/Deep.pm index 94c296f..bf507fc 100644 --- a/lib/DBM/Deep.pm +++ b/lib/DBM/Deep.pm @@ -57,73 +57,6 @@ sub new { my $args = $class->_get_args( @_ ); my $self; -=pod - if (exists $args->{dbi}) { - eval { - require DBIx::Abstract; - }; if ( $@ ) { - __PACKAGE__->_throw_error('DBIx::Abstract not installed. You cannot use the SQL mode.'); - } - unless (UNIVERSAL::isa($args->{dbi}, 'DBIx::Abstract')) { - $args->{dbi} = DBIx::Abstract->connect($args->{dbi}); - } - - if (defined $args->{id}) { - unless ($args->{id} =~ /^\d+$/ && $args->{id} > 0) { - __PACKAGE__->_throw_error('Invalid SQL record id'); - } - my $util = {dbi => $args->{dbi}}; - bless $util, 'DBM::Deep::SQL::Util'; - my $q = $util->_select( - table => 'rec_item', - fields => 'item_type', - where => {id => $args->{id}}, - ); - if ($q->[0]->[0] eq 'array') { - $args->{type} = TYPE_ARRAY; - } - elsif ($q->[0]->[0] eq 'hash') { - $args->{type} = TYPE_HASH; - } - else { - DBM::Deep->_throw_error('Unknown SQL record id'); - } - } - else { - my $util = {dbi => $args->{dbi}}; - bless $util, 'DBM::Deep::SQL::Util'; - if (defined($args->{type}) && $args->{type} eq TYPE_ARRAY) { - $args->{id} = $util->_create('array'); - } - else { - $args->{id} = $util->_create('hash'); - } - } - - if (defined($args->{type}) && $args->{type} eq TYPE_ARRAY) { - $class = 'DBM::Deep::SQL::Array'; - require DBM::Deep::SQL::Array; - tie @$self, $class, %$args; - if ($args->{prefetch}) { - (tied(@$self))->_prefetch(); - } - return bless $self, $class; - } - else { - $class = 'DBM::Deep::SQL::Hash'; - require DBM::Deep::SQL::Hash; - tie %$self, $class, %$args; - if ($args->{prefetch}) { - (tied(%$self))->_prefetch(); - } - return bless $self, $class; - } - } -=cut - - ## - # Check if we want a tied hash or array. - ## if (defined($args->{type}) && $args->{type} eq TYPE_ARRAY) { $class = 'DBM::Deep::Array'; require DBM::Deep::Array;