Re: [CDBI] Subroutine redefined
[prev]
[thread]
[next]
[Date index for 2004/09/03]
--=-dRSGqiGuzlUrppB7PrCj
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
On Fri, 2004-09-03 at 15:05, William McKee wrote:
> I understand! I've been a regular in the dazed and confused camp myself.
> As for the redefined error, my interpretation is that it has to do with
> how CDBI is handling the relationship behind the scenes. The actual
> error is being generated by CDBI. If you get it, there's a good
> indication you are incorrectly setting up CDBI.
My contention though is that the names, and the documentation, would
seem to lead people to set it up incorrectly.
>=20
> > I also have a mnemonic problem - an applicant might have a reviewer
> > ... but they might not have been assigned one yet, so wouldn't the
> > has_a cause a problem at run time?!?
>=20
> No. See yesterday's discussion that Peter Pimley started. There appears
> to be no restriction by either CDBI or SQL that dictates that a has_a
> must have a corresponding record. The foreign key field appears to fine
> if left undef.
Hmmm. Even if you define a constraint in the database for the foreign
key field that requires the parent to exist?
Even if so, that doesn't make my argument invalid, IMO. I think the
names are misleading, since has_a and might_have don't seem to be the
real difference between the two methods - _particularly_ if the has_a is
intended to not mean it 'has a'.
I don't mean to say that the methods aren't useful. I'm just suggesting
that the names don't really seem to indicate the appropriate usage, or
the difference between the two methods. I'll re-read the docs again and
play with them some and maybe it will make more sense to me. But that is
my first impression.
> Something looks wrong here. You are declaring the package as
> BioInfo::DB::Qualifiers but then are setting the columns for
> BioInfo::DB::PETP. I would rewrite that as the following:
=3Dsnip
> See if that fixes the problem. At least it will prevent typos.
DOH, user error! Thanks for pointing that typo out!
>=20
> > Threw this error:
> > PERL_DL_NONLAZY=3D1 /usr/bin/perl "-MExtUtils::Command::MM" "-e"
> > "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
> > t/Class....has_a needs a valid column at
> > /usr/lib/perl5/site_perl/5.8.3/Class/DBI/Relationship/HasA.pm line 12
> > Compilation failed in require at t/Class.t line 10.
> > BEGIN failed--compilation aborted at t/Class.t line 10.
>=20
> I suspect that's because you are not setting any columns.
>=20
>=20
> > But changing _that_ definition to:
> > BioInfo::DB::Qualifiers->might_have(Student =3D> 'BioInfo::DB::Students=
');
>=20
> might_have must be a bit less picky about the columns not existing.
Odd
> > <sigh> ... I'm going to have to read a lot of source code this weekend,
> > eh? ;-}
>=20
> It takes awhile to get familiar with CDBI. Read the wiki and keep
> rereading the docs--they'll eventually start to make more sense to you.
Docs shouldn't, IMHO, have to be reread a bunch of times to make sense.
Of course, I've been told that a lot of the docs I've written which
seemed to make perfect sense to me, were mind-bendingly unclear. =3DD
Thanks for everyone's help! I now have the database fully declared as
classes and compiling. I think I'll leave it there for the weekend and
try writing some code using next it week. Have a great weekend!
--=20
Sean Quinlan <seanq@xxxxxx.xx.xxx>
BMERC, Boston University
--=-dRSGqiGuzlUrppB7PrCj
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQBBOMqrnv2yYfTgGZsRAgG6AKCTwk8WmkHXvA9aZlTXcjNGEIotYQCgkeH9
NWZIMKn4J5zbMH2Qh+L9QSA=
=0wcU
-----END PGP SIGNATURE-----
--=-dRSGqiGuzlUrppB7PrCj--