Factory

[prev] [thread] [next] [Date index for 2005/04/13]

From: Barry Dancis
Subject: Factory
Date: 16:10 on 13 Apr 2005
This is a multi-part message in MIME format.

------=_NextPart_000_0212_01C54021.D65350D0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi --

    I am closing in on the problem.

The code

my $rebase =3D Class::DBI::Factory->new;
   $rebase->set_db ({db_type =3D> 'mysql',
                 db_name =3D> 'rebase',
                 db_username =3D> 'barry',
                 db_password =3D> '',
                });
   print "user: " . $rebase->config->get('db_username') . =20
       " pw: " . $rebase->config->get('db_password');=20


correctly gives:

user: barry pw:=20

but the next code executed:

   $rebase->use_classes (qw/Enzyme EnzymeSite Site/);
  my $enzyme =3D $rebase->retrieve('enzyme', name =3D> 'EcoRI'); =20

when it gets to the cdf::_dbc code of

  $self->config->get('db_username'),=20
  $self->config->get('db_password'),=20

gives:

db_username: no such variable
db_password: no such variable

and the retrieve fails.

Why does $rebase find the values and $self does not?=20

I did notice that $rebase and $self have different timestamps indicating =
that they are different instances. The $self instance first appears in =
CDF::dbh. It that what  is supposed to happen?

TIA,

Barry
------=_NextPart_000_0212_01C54021.D65350D0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2604" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi --</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; I am closing in on =
the=20
problem.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The code</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D2>my $rebase =3D=20
Class::DBI::Factory-&gt;new;<BR>&nbsp;&nbsp; $rebase-&gt;set_db =
({db_type =3D&gt;=20
'mysql',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
db_name =3D&gt;=20
'rebase',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
db_username =3D&gt;=20
'barry',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
db_password =3D&gt;=20
'',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;=20
});<BR>&nbsp;&nbsp; print "user: " . =
$rebase-&gt;config-&gt;get('db_username')=20
.&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " pw: " .=20
$rebase-&gt;config-&gt;get('db_password'); </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>correctly gives:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D2>user: barry pw: </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>but the next code =
executed:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D2>&nbsp;&nbsp; =
$rebase-&gt;use_classes=20
(qw/Enzyme EnzymeSite Site/);</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2>&nbsp; my $enzyme =3D=20
$rebase-&gt;retrieve('enzyme', name =3D&gt; 'EcoRI');&nbsp; =
<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>when it gets to the cdf::_dbc code =
of</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New"=20
size=3D2>&nbsp;&nbsp;$self-&gt;config-&gt;get('db_username'),=20
<BR>&nbsp;&nbsp;$self-&gt;config-&gt;get('db_password'), =
<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>gives:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2><FONT face=3D"Courier New">db_username: no such=20
variable<BR>db_password: no such variable</FONT></DIV></FONT>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>and the retrieve fails.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Why does $rebase find the values and =
$self does=20
not? </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I did notice that $rebase and $self =
have different=20
timestamps indicating that they are different instances. The $self =
instance=20
first appears in CDF::dbh. It that what&nbsp; is supposed to=20
happen?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>TIA,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Barry</FONT></DIV></BODY></HTML>

------=_NextPart_000_0212_01C54021.D65350D0--


Factory
Barry Dancis 16:10 on 13 Apr 2005

Re: Factory
William Ross 10:47 on 14 Apr 2005

Re: Factory
Barry Dancis 15:43 on 14 Apr 2005

Generated at 12:49 on 16 Apr 2005 by mariachi v0.52