Subroutine redefined
[prev]
[thread]
[next]
[Date index for 2004/09/03]
--=-oKOzn7uWFqIony/hHcKo
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
Hi! I saw the article on perl.com for Class::DBI a while ago and was
very intrigued. I'm working on a database project to track certain
student information in our department, and I just started working on a=20
data entry/edit interface for a set of tables. I thought this would be
an ideal project for trying out Class:DBI, since the interactions would
all be fairly straight forward.
I'm having a lot of trouble getting past make test however with even a
simple set of class declarations. I've got a single file containing the
set of classes for this database. The parent and first table's class
seem to go fine, but on the second table I get a bunch of 'Subroutine
redefined' errors. I've re-read the docs and looked through
www.class-dbi.com but can't seem to find a mention of this problem, so I
assume it's me ;-}. I'd appreciate any help identifying my mistake
please!
Here's the code declaring the package and first two tables:
package BioInfo::DB::Class;
use 5.006;
use strict;
use warnings;
use base 'Class::DBI::mysql';
BioInfo::DB::Class->connection('dbi:mysql:BioInfo', 'xxxx', 'xxxx');
our $VERSION =3D '0.01';
1;
package BioInfo::DB::Applicant_Documents;
use strict;
use warnings;
use base 'BioInfo::DB::Class';
BioInfo::DB::Applicant_Documents->table('Applicant_Documents');
BioInfo::DB::Applicant_Documents->columns(Primary =3D> qw/Applicant URI/);
BioInfo::DB::Applicant_Documents->columns(Essential =3D> qw/Type
Comment/);
BioInfo::DB::Applicant_Documents->has_a(Applicant =3D>
'BioInfo::DB::Applicant');
1;
package BioInfo::DB::Applicants;
use strict;
use warnings;
use base 'BioInfo::DB::Class';
BioInfo::DB::Applicants->table('Applicants');
BioInfo::DB::Applicants->columns(All =3D> qw/ID Application_Date
First_Name
Last_Name Sex DOB Lives_Locally International_Student Program
Enrollment_Semester Enrollment_Year Enrollment_Status Recommender1
Recommender2 Recommender3 GRE_V V_pct GRE_Q Q_pct GRE_A A_pct TOEFL
Comments Previous_College Interests Positive_Traits Negative_Traits
Requires_Financial_Aid Reviewer1_Decision
Reviewer1_Rejection_Reasons Reviewer1_Comments Reviewer1_Signature
Reviewer2 Reviewer2_Decision Reviewer2_Rejection_Reasons
Reviewer2_Comments Reviewer2_Signature Application_Status/);
BioInfo::DB::Applicants->might_have(Reviewer1 =3D> 'BioInfo::DB::Faculty'
=3D> qw/ID Institution Department Title Dutites/);
BioInfo::DB::Applicants->might_have(Reviewer2 =3D> 'BioInfo::DB::Faculty'
=3D> qw/ID Institution Department Title Dutites/);
1;
I've tried basing just Class::DBI instead of Class::DBI::mysql and get
the same errors. The PRIMARY KEY for the Applicants table is ID. Here
are some of the errors I get - I've only included the ones for the
tables above - the rest look just like it.
152: 10:44am % make test
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::ID redefined at
/usr/lib/perl5/site_perl/5.8.3/Class/DBI/Relationship.pm line 62.
Subroutine BioInfo::DB::Applicants::Dutites redefined at
/usr/lib/perl5/site_perl/5.8.3/Class/DBI/Relationship.pm line 62.
Subroutine BioInfo::DB::Applicants::Department redefined at
/usr/lib/perl5/site_perl/5.8.3/Class/DBI/Relationship.pm line 62.
Subroutine BioInfo::DB::Applicants::ID redefined at
/usr/lib/perl5/site_perl/5.8.3/Class/DBI/Relationship.pm line 62.
Subroutine BioInfo::DB::Applicants::Institution 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.
Subroutine BioInfo::DB::Applicants::Title redefined at
/usr/lib/perl5/site_perl/5.8.3/Class/DBI/Relationship.pm line 62.
I noticed that removing Reviewer1 from the columns declaration resulted
in no error being thrown for that column. I'm working on a SuSE 9.1
distro running Perl 5.8.3 and kernel 2.6.5-7.108.
Thanks!
=20
--=20
Sean Quinlan <seanq@xxxxxx.xx.xxx>
BMERC, Boston University
--=-oKOzn7uWFqIony/hHcKo
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)
iD8DBQBBOIhgnv2yYfTgGZsRAlAuAJ4r05Qy+LHiStpUt+GMFXyn1Qe6rwCeIVjt
QQKLo4oTdlRGv+hrNlbkZKg=
=IWYA
-----END PGP SIGNATURE-----
--=-oKOzn7uWFqIony/hHcKo--
|
Subroutine redefined
Sean Quinlan 15:06 on 03 Sep 2004
|