Discussion:
Class::DBI->set() called with broke stuff
Christopher Hicks
2005-02-11 01:07:12 UTC
Permalink
I've been trying to get Maypole to work this table "contact":

+------------------+------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------------+------------+------+-----+---------+----------------+
| id | int(14) | | PRI | NULL | auto_increment |
| internic_handle | char(31) | YES | MUL | NULL | |
| finilever_handle | char(31) | | UNI | | |
| first_name | char(64) | | | | |
| last_name | char(64) | | | | |
| org_name | char(64) | | | | |
| address1 | char(64) | | | | |
| address2 | char(64) | | | | |
| address3 | char(64) | | | | |
| city | char(64) | | | | |
| state | char(32) | | | | |
| postal_code | char(32) | | | | |
| country | char(2) | | | | |
| phone | char(20) | | | | |
| fax | char(20) | | | | |
| pager | char(20) | | | | |
| cell | char(20) | | | | |
| afterhours | char(255) | | | | |
| email | char(255) | | | | |
| url | char(255) | | | | |
| client | int(10) | YES | | NULL | |
| autogen | tinyint(1) | | | 0 | |
+------------------+------------+------+-----+---------+----------------+

The pager column seems to be causing the problem. I've tried with the
pager column in and out of printable columns and the results are the same.
The Class::DBI->set() seems to be getting called with wacky stuff. I put
this code:
if (scalar(@_) % 2) {
cluck("odd array");
}
in to show what's happening and cut on Maypole debugging:

[Thu Feb 10 19:48:18 2005] [error] [client 205.166.143.252] Debugging
enabled at /usr/lib/perl5/site_perl/5.8.3/Maypole/Application.pm line 24.,
referer: http://www.finilever.com/cgi/test
[Thu Feb 10 19:48:19 2005] [error] [client 205.166.143.252] Loaded tables:
client,contact,domain,invoice,invoiceitem,invoiceserving,invoicework,invoiceworkold,latenotes,nameserver,nameserverset,partialpay,pricing,project,services,serving,servingspan,work,workerpay,workers,workerworked,workticket,worktype
at /usr/lib/perl5/site_perl/5.8.3/Maypole/Model/CDBI.pm line 244.,
referer: http://www.finilever.com/cgi/test
[Thu Feb 10 19:48:19 2005] [error] [client 205.166.143.252] odd array at
/usr/lib/perl5/site_perl/5.8.3/Class/DBI.pm line 864, referer:
http://www.finilever.com/cgi/test
[Thu Feb 10 19:48:19 2005] [error] [client 205.166.143.252]
\tClass::DBI::set('FINI::FiniLever::Maypole::Contact','pager',50,'undef')
called at /usr/lib/perl5/site_perl/5.8.3/Class/Accessor.pm line 346,
referer: http://www.finilever.com/cgi/test
[Thu Feb 10 19:48:19 2005] [error] [client 205.166.143.252]
\tClass::Accessor::__ANON__('FINI::FiniLever::Maypole::Contact',50,'undef')
called at /usr/lib/perl5/site_perl/5.8.3/Maypole/Model/CDBI.pm line 196,
referer: http://www.finilever.com/cgi/test
[Thu Feb 10 19:48:19 2005] [error] [client 205.166.143.252]
\tMaypole::Model::CDBI::do_pager('FINI::FiniLever::Maypole::Contact','FINI::FiniLever::Maypole=HASH(0x1093d10)')
called at /usr/lib/perl5/site_perl/5.8.3/Maypole/Model/CDBI.pm line 216,
referer: http://www.finilever.com/cgi/test
[Thu Feb 10 19:48:19 2005] [error] [client 205.166.143.252]
\tMaypole::Model::CDBI::list('FINI::FiniLever::Maypole::Contact','FINI::FiniLever::Maypole=HASH(0x1093d10)','undef')
called at /usr/lib/perl5/site_perl/5.8.3/Maypole/Model/Base.pm line 20,
referer: http://www.finilever.com/cgi/test
[Thu Feb 10 19:48:19 2005] [error] [client 205.166.143.252]
\tMaypole::Model::Base::process('FINI::FiniLever::Maypole::Contact','FINI::FiniLever::Maypole=HASH(0x1093d10)')
called at /usr/lib/perl5/site_perl/5.8.3/Maypole.pm line 113, referer:
http://www.finilever.com/cgi/test
[Thu Feb 10 19:48:19 2005] [error] [client 205.166.143.252] \teval {...}
called at /usr/lib/perl5/site_perl/5.8.3/Maypole.pm line 113, referer:
http://www.finilever.com/cgi/test
[Thu Feb 10 19:48:19 2005] [error] [client 205.166.143.252]
\tMaypole::handler_guts('FINI::FiniLever::Maypole=HASH(0x1093d10)') called
at /usr/lib/perl5/site_perl/5.8.3/Maypole.pm line 74, referer:
http://www.finilever.com/cgi/test
[Thu Feb 10 19:48:19 2005] [error] [client 205.166.143.252]
\tMaypole::handler('FINI::FiniLever::Maypole','FINI::FiniLever::Maypole')
called at /usr/lib/perl5/site_perl/5.8.3/Maypole.pm line 32, referer:
http://www.finilever.com/cgi/test
[Thu Feb 10 19:48:19 2005] [error] [client 205.166.143.252]
\tMaypole::__ANON__('FINI::FiniLever::Maypole') called at
/usr/lib/perl5/site_perl/5.8.3/CGI/Maypole.pm line 13, referer:
http://www.finilever.com/cgi/test
[Thu Feb 10 19:48:19 2005] [error] [client 205.166.143.252]
\tCGI::Maypole::run('FINI::FiniLever::Maypole') called at
/www/sys/finilever/cgi/test line 10, referer:
http://www.finilever.com/cgi/test
[Thu Feb 10 19:48:19 2005] [error] [client 205.166.143.252] Odd number of
elements in anonymous hash at /usr/lib/perl5/site_perl/5.8.3/Class/DBI.pm
line 867., referer: http://www.finilever.com/cgi/test
[Thu Feb 10 19:48:19 2005] [error] [client 205.166.143.252] Use of
uninitialized value in anonymous hash ({}) at
/usr/lib/perl5/site_perl/5.8.3/Class/DBI.pm line 867., referer:
http://www.finilever.com/cgi/test
[Thu Feb 10 19:48:19 2005] [error] [client 205.166.143.252] caught model
error: No such column: , referer: http://www.finilever.com/cgi/test
[Thu Feb 10 19:48:19 2005] [error] [client 205.166.143.252] Use of
uninitialized value in concatenation (.) or string at
/usr/lib/perl5/site_perl/5.8.3/Maypole/View/Base.pm line 75., referer:
http://www.finilever.com/cgi/test
[Thu Feb 10 19:48:19 2005] [error] [client 205.166.143.252] No such
column: , referer: http://www.finilever.com/cgi/test
[Thu Feb 10 19:48:19 2005] [error] [client 205.166.143.252] : at
/usr/lib/perl5/site_perl/5.8.3/Maypole.pm line 118, referer:
http://www.finilever.com/cgi/test
[Thu Feb 10 19:48:19 2005] [error] [client 205.166.143.252] Use of
uninitialized value in pattern match (m//) at
/usr/lib/perl5/site_perl/5.8.3/Maypole/View/Base.pm line 76., referer:
http://www.finilever.com/cgi/test
[Thu Feb 10 19:48:19 2005] [error] [client 205.166.143.252] Use of
uninitialized value in length at
/usr/lib/perl5/site_perl/5.8.3/CGI/Maypole.pm line 59., referer:
http://www.finilever.com/cgi/test
[Thu Feb 10 19:48:19 2005] [error] [client 205.166.143.252] Use of
uninitialized value in print at
/usr/lib/perl5/site_perl/5.8.3/CGI/Maypole.pm line 66., referer:
http://www.finilever.com/cgi/test

I've got another table working with my Maypole config, so I doubt my
script is breaking this.
--
</chris>

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Dave Howorth
2005-02-11 10:11:37 UTC
Permalink
Post by Christopher Hicks
The pager column seems to be causing the problem. I've tried with the
pager column in and out of printable columns and the results are the
same. The Class::DBI->set() seems to be getting called with wacky
Maypole::Model::CDBI uses Class::DBI::Pager, which defines a pager
method in your model classes. So you can't have a column called pager
unless you do something different.

The simplest thing to do is change the name of your column. If you can
live with that, I'd definitely recommend you to do that. If not, you
need to investigate Class::DBI::accessor_name to change the column's
accessor name or else change the way paging is done in your model. I
expect either of those routes will cause you some pain along the way!

Cheers, Dave

Loading...