Problems with 52dbm_complex.t and Gofer-AutoProxy

Jens Rehsack <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Message-ID <[email protected]>
Hi Tim,

for next DBI DEV-release I tried to get 52dbm_complex.t running with
Gofer as Auto-Proxy, too.
Maybe you could take a look, please (to teach me where I'm wrong).

The attached patch contains the changes I made to get the test run with Gofer.
It fails with:
  DB<13> c DBD::File::Table::new
ok 84 - execute: SELECT * FROM APPL_17608_SDBM_File_Data_Dumper
Can't store item CODE(0x7f7ff884e1b0) at blib/lib/Storable.pm
(autosplit into blib/lib/auto/Storable/_freeze.al) line 339.
 at blib/lib/Storable.pm (autosplit into
blib/lib/auto/Storable/_freeze.al) line 339
	eval {...} called at blib/lib/Storable.pm (autosplit into
blib/lib/auto/Storable/_freeze.al) line 339
	Storable::_freeze('CODE(0x7f7ffbee4228)',
'DBI::Gofer::Request=HASH(0x7f7ff9359d98)') called at
blib/lib/Storable.pm (autosplit into
blib/lib/auto/Storable/nfreeze.al) line 327
	Storable::nfreeze('DBI::Gofer::Request=HASH(0x7f7ff9359d98)') called
at /usr/home/trevor/Projects/OSS/DBI.svn/blib/lib/DBI/Gofer/Serializer/Storable.pm
line 49
	DBI::Gofer::Serializer::Storable::serialize('DBI::Gofer::Serializer::Storable=HASH(0x7f7ff88a6510)',
'DBI::Gofer::Request=HASH(0x7f7ff9359d98)') called at
/usr/home/trevor/Projects/OSS/DBI.svn/blib/lib/DBI/Gofer/Transport/Base.pm
line 57
	eval {...} called at
/usr/home/trevor/Projects/OSS/DBI.svn/blib/lib/DBI/Gofer/Transport/Base.pm
line 51
	DBI::Gofer::Transport::Base::_freeze_data('DBD::Gofer::Transport::null=HASH(0x7f7ff88ac090)',
'DBI::Gofer::Request=HASH(0x7f7ff9359d98)') called at
/usr/home/trevor/Projects/OSS/DBI.svn/blib/lib/DBD/Gofer/Transport/null.pm
line 31
	DBD::Gofer::Transport::null::transmit_request_by_transport('DBD::Gofer::Transport::null=HASH(0x7f7ff88ac090)',
'DBI::Gofer::Request=HASH(0x7f7ff9359d98)') called at
/usr/home/trevor/Projects/OSS/DBI.svn/blib/lib/DBD/Gofer/Transport/Base.pm
line 92
	eval {...} called at
/usr/home/trevor/Projects/OSS/DBI.svn/blib/lib/DBD/Gofer/Transport/Base.pm
line 86
	DBD::Gofer::Transport::Base::__ANON__[/usr/home/trevor/Projects/OSS/DBI.svn/blib/lib/DBD/Gofer/Transport/Base.pm:103]()
called at /usr/home/trevor/Projects/OSS/DBI.svn/blib/lib/DBD/Gofer/Transport/Base.pm
line 125
	DBD::Gofer::Transport::Base::_transmit_request_with_retries('DBD::Gofer::Transport::null=HASH(0x7f7ff88ac090)',
'DBI::Gofer::Request=HASH(0x7f7ff9359d98)', 'CODE(0x7f7ff88bd588)')
called at /usr/home/trevor/Projects/OSS/DBI.svn/blib/lib/DBD/Gofer/Transport/Base.pm
line 105
	DBD::Gofer::Transport::Base::transmit_request('DBD::Gofer::Transport::null=HASH(0x7f7ff88ac090)',
'DBI::Gofer::Request=HASH(0x7f7ff9359d98)') called at
/usr/home/trevor/Projects/OSS/DBI.svn/blib/lib/DBD/Gofer.pm line 295
	DBD::Gofer::db::go_dbh_method('DBI::db=HASH(0x7f7ff88a6ee8)',
'HASH(0x7f7ff888bf90)', 'do', 'CREATE TABLE
APPL_17608_SDBM_File_Storable AS IMPORT (?)', 'HASH(0x7f7ff88c3390)',
'DBI::st=HASH(0x7f7ff8876ee8)') called at
/usr/home/trevor/Projects/OSS/DBI.svn/blib/lib/DBD/Gofer.pm line 450
	DBD::Gofer::db::do('DBI::db=HASH(0x7f7ff88a6ee8)', 'CREATE TABLE
APPL_17608_SDBM_File_Storable AS IMPORT (?)', 'HASH(0x7f7ff88c3390)',
'DBI::st=HASH(0x7f7ff8876ee8)') called at t/52dbm_complex.t line 131
	main::load_tables('SDBM_File', 'Storable') called at t/52dbm_complex.t line 253
	main::do_tests('SDBM_File', 'Storable') called at t/52dbm_complex.t line 345
SV = RV(0x7f7ff8b82298) at 0x7f7ff8b82288
  REFCNT = 1
  FLAGS = (ROK)
  RV = 0x7f7ff938d300
    SV = PVHV(0x7f7ff88a1de0) at 0x7f7ff938d300
      REFCNT = 3
      FLAGS = (OBJECT,SHAREKEYS)
      STASH = 0x7f7ffbd87450	"DBI::db"
      ARRAY = 0x7f7ffd725000  (0:13, 1:10, 2:7, 3:2)
      hash quality = 102.1%
      KEYS = 30
      FILL = 19
      MAX = 31
      RITER = -1
      EITER = 0x0
        Elt "dbm_type" HASH = 0xd91d0da4
        SV = PV(0x7f7ff8b1a9f8) at 0x7f7ff938d318
          REFCNT = 2
          FLAGS = (POK,pPOK)
          PV = 0x7f7ff93f6340 "SDBM_File"\0
          CUR = 9
          LEN = 16
        Elt "LongTruncOk" HASH = 0x1e326ba5
        SV = PV(0x7f7ff8b1aa08) at 0x7f7ff938d330
          REFCNT = 2
          FLAGS = (POK,pPOK)
          PV = 0x7f7ff8b608e0 ""\0
          CUR = 0
          LEN = 8
        Elt "State" HASH = 0x53261866
        SV = RV(0x7f7ff938d388) at 0x7f7ff938d378
          REFCNT = 2
          FLAGS = (ROK)
          RV = 0x7f7ff937ccc0
            SV = NULL(0x0) at 0x7f7ff937ccc0
              REFCNT = 3
              FLAGS = ()
	(in cleanup) dbih_getcom handle DBI::db=HASH(0x7f7ff938d300) is not a
DBI handle (has no magic) at blib/lib/Storable.pm (autosplit into
blib/lib/auto/Storable/thaw.al) line 415.
SV = RV(0x7f7ff8849cd0) at 0x7f7ff8849cc0
  REFCNT = 2
  FLAGS = (ROK)
  RV = 0x7f7ff8896ea0
    SV = PVHV(0x7f7ff88b87c8) at 0x7f7ff8896ea0
      REFCNT = 1
      FLAGS = (OBJECT,SHAREKEYS)
      STASH = 0x7f7ffc7a5858	"DBI::st"
      ARRAY = 0x7f7ffd724500  (0:16, 1:8, 2:6, 3:2)
      hash quality = 92.6%
      KEYS = 26
      FILL = 16
      MAX = 31
      RITER = -1
      EITER = 0x0
        Elt "NUM_OF_FIELDS" HASH = 0x572f0281
        SV = IV(0x7f7ff88570a0) at 0x7f7ff88570a8
          REFCNT = 1
          FLAGS = (IOK,pIOK)
          IV = 5
        Elt "go_cache" HASH = 0x3b627002
        SV = NULL(0x0) at 0x7f7ff899b750
          REFCNT = 1
          FLAGS = ()
        Elt "go_prepare_call" HASH = 0xa3c475a4
        SV = RV(0x7f7ff889d220) at 0x7f7ff889d210
          REFCNT = 1
          FLAGS = (ROK)
          RV = 0x7f7ff88bbdc8
            SV = PVAV(0x7f7ffd7805e8) at 0x7f7ff88bbdc8
              REFCNT = 1
              FLAGS = ()
              ARRAY = 0x7f7ff8b2a440
              FILL = 3
              MAX = 4
              ARYLEN = 0x0
              FLAGS = (REAL)
                Elt No. 0
                SV = IV(0x7f7ffd785850) at 0x7f7ffd785858
                  REFCNT = 1
                  FLAGS = (IOK,pIOK)
                  IV = 0
                Elt No. 1
                SV = PV(0x7f7ff8b1a1c8) at 0x7f7ff8f679d8
                  REFCNT = 1
                  FLAGS = (POK,pPOK)
                  PV = 0x7f7ff8b60620 "prepare"\0
                  CUR = 7
                  LEN = 8
                Elt No. 2
                SV = PV(0x7f7ff8b1a0b8) at 0x7f7ff886c2b8
                  REFCNT = 1
                  FLAGS = (POK,pPOK)
                  PV = 0x7f7ff8b2a4a0 "SELECT * FROM
APPL_17608_SDBM_File_Data_Dumper"\0
                  CUR = 46
                  LEN = 48
                Elt No. 3
                SV = NULL(0x0) at 0x7f7ff882b7f8
                  REFCNT = 1
                  FLAGS = ()
DBD::Gofer::db do failed: dbih_getcom handle
DBI::st=HASH(0x7f7ff8896ea0) is not a DBI handle (has no magic) at
/home/trevor/perl5/lib/perl5/SQL/Statement/Functions.pm line 592.
DBI-52dbm_complex.patch (application/octet-stream, 2 KB)
Index: t/52dbm_complex.t
===================================================================
--- t/52dbm_complex.t	(revision 14145)
+++ t/52dbm_complex.t	(working copy)
@@ -93,18 +93,32 @@
 mkpath $dir;
 
 plan skip_all => "These tests require SQL::Statement" unless ( $haveSS and @mldbm_types );
-plan skip_all => "Needs more love to run with Gofer, too" if( $using_dbd_gofer );
+#plan skip_all => "Needs more love to run with Gofer, too" if( $using_dbd_gofer );
 
 my $dbh = DBI->connect( 'dbi:DBM:', undef, undef, { f_dir => $dir, } );
 
 my $suffix;
+my $tbl_meta;
 
 sub load_tables
 {
-    my ( $dbmtype, $serializer ) = @_;
+    my ( $dbmtype, $dbmmldbm ) = @_;
+
+    if ($using_dbd_gofer)
+    {
+	$dbh->disconnect();
+	$dbh = DBI->connect( "dbi:DBM:", undef, undef, { f_dir => $dir, f_meta => $tbl_meta, dbm_type => $dbmtype, dbm_mldbm => $dbmmldbm } );
+    }
+    else
+    {
+	$dbh->{dbm_type}  = $dbmtype;
+	$dbh->{dbm_mldbm} = $dbmmldbm;
+    }
+
     my $last_suffix = $suffix;
-    $serializer =~ s/::/_/g;
+    (my $serializer = $dbmmldbm ) =~ s/::/_/g;
     $suffix = join( "_", $$, $dbmtype, $serializer );
+
     if ($last_suffix)
     {
         for my $table (qw(APPL_%s PREC_%s NODE_%s LANDSCAPE_%s CONTACT_%s NM_LANDSCAPE_%s APPL_CONTACT_%s))
@@ -216,6 +230,18 @@
             ok( $dbh->do($sql), $sql );
         }
     }
+
+    for my $table (qw(APPL_%s PREC_%s NODE_%s LANDSCAPE_%s CONTACT_%s NM_LANDSCAPE_%s APPL_CONTACT_%s))
+    {
+	my $tbl_name = lc sprintf($table, $suffix);
+	$tbl_meta->{$tbl_name} = { dbm_type => $dbmtype, dbm_mldbm => $dbmmldbm };
+    }
+
+    unless ($using_dbd_gofer)
+    {
+	my $tbl_known_meta = $dbh->dbm_get_meta( "+", [ qw(dbm_type dbm_mldbm) ] );
+	is_deeply( $tbl_known_meta, $tbl_meta, "Know meta" );
+    }
 }
 
 sub do_tests
@@ -224,9 +250,6 @@
 
     note "Running do_tests for $dbmtype + $serializer";
 
-    $dbh->{dbm_type}  = $dbmtype;
-    $dbh->{dbm_mldbm} = $serializer;
-
     load_tables( $dbmtype, $serializer );
 
     my %joins;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.