Re: [CDBI] Subroutine redefined

[prev] [thread] [next] [Date index for 2004/09/03]

From: Sean Quinlan
Subject: Re: [CDBI] Subroutine redefined
Date: 17:56 on 03 Sep 2004
--=-85JkQfnaMUi4GqXwqjWT
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Fri, 2004-09-03 at 12:26, Dave Cash wrote:
> I think the problems are coming from these two lines.  When you
> declare a might_have with a list of column names, it means you want
> those columns to be directly accessible via BioInfo::DB::Applicants
> objects (i.e. $applicant->Duties rather than
> $applicant->Reviewer1->Duties).  When you declare your second
> might_have, Class::DBI tries to create accessor/mutators in
> BioInfo::DB::Applicant for ID. Institution, Department, Title and
> Duties again and thus the subroutine redefined messages.
>=20
> If I understand your data model (from the bit of it you posted), it
> seems to me like you won't want to declare your might_haves with a
> trailing list of column names.  If I did something like
> $applicant->Duties, I would expect to get back the duties of the
> applicant, not one of the reviewers.  Here's how I suggest you
> declare these might_haves:
>=20
>   BioInfo::DB::Applicants->might_have(Reviewer1 =3D> 'BioInfo::DB::Facult=
y');
>   BioInfo::DB::Applicants->might_have(Reviewer2 =3D> 'BioInfo::DB::Facult=
y');
>=20
> Then you can get to a reviewer's duties like this:
>=20
>   $applicant->Reviewer1->Duties
>=20
> which I think is what you meant.

Dave,
	Indeed that is the functionality I'm aiming for, thanks! I was trying
to follow the documentation which doesn't seem to indicate that the
column args are optional.=20

	Unfortunately, while making the the change you suggest gets rid of the
'ID' redefined, etc, I do still get errors for the columns used:
cp Class.pm blib/lib/BioInfo/DB/Class.pm
PERL_DL_NONLAZY=3D1 /usr/bin/perl "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/Class....Subroutine BioInfo::DB::Applicants::Reviewer1 redefined at
/usr/lib/perl5/site_perl/5.8.3/Class/DBI/Relationship.pm line 62.
Subroutine BioInfo::DB::Applicants::Reviewer2 redefined at
/usr/lib/perl5/site_perl/5.8.3/Class/DBI/Relationship.pm line 62.



--=20
Sean Quinlan <seanq@xxxxxx.xx.xxx>
BMERC, Boston University

--=-85JkQfnaMUi4GqXwqjWT
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)

iD8DBQBBOLAznv2yYfTgGZsRAjx9AKCMBEWkNcbh6a2ZHEEWiOs97HFDeACeOj5q
PDfoPeAzXBf51tRFAQK37oc=
=E+/o
-----END PGP SIGNATURE-----

--=-85JkQfnaMUi4GqXwqjWT--

Subroutine redefined
Sean Quinlan 15:06 on 03 Sep 2004

Re: [CDBI] Subroutine redefined
William McKee 16:48 on 03 Sep 2004

Re: [CDBI] Subroutine redefined
Sean Quinlan 18:08 on 03 Sep 2004

Re: [CDBI] Subroutine redefined
William McKee 19:05 on 03 Sep 2004

Re: [CDBI] Subroutine redefined
Sean Quinlan 19:48 on 03 Sep 2004

Re: [CDBI] Subroutine redefined
William McKee 20:34 on 03 Sep 2004

Re: [CDBI] Subroutine redefined
Sean Quinlan 17:56 on 03 Sep 2004

Re: [CDBI] Subroutine redefined
Drew Taylor 18:12 on 03 Sep 2004

Generated at 11:35 on 01 Dec 2004 by mariachi v0.52