Subject: | instance of Class::DBI::FormBuilder::Meta::Table not stored in $Instances |
Hi,
PERL: This is perl, v5.8.6 built for i386-freebsd-64int
OS: FreeBSD banzai.gnarst.net 4.11-STABLE FreeBSD 4.11-STABLE
Distribution: Class-DBI-FormBuilder-0.48
An instance of Class::DBI::FormBuilder::Meta::Table is not storing $self in $Instances
So the (in postgress) very expensive operation $DBI::PG->column_info is called each time Class::DBI::FormBuilder::Meta::Table->instance is called. I've inlcuded a patch which speeds up form generation on PostgreSQL about 20 times.
The patch stores $self at the end of instance. And make Singleton work at line 66 :
return $Instances{$cdbi_class} if $Instances{$cdbi_class};
Thanks for lots of saving programming hours building forms!
With best regards,
Brendan Bank
===================================================================
RCS file: FormBuilder/Meta/Table.pm,v
retrieving revision 1.1
diff -C4 -r1.1 FormBuilder/Meta/Table.pm
*** FormBuilder/Meta/Table.pm 2005/12/12 13:04:10 1.1
--- FormBuilder/Meta/Table.pm 2005/12/12 13:24:30
***************
*** 77,84 ****
--- 77,86 ----
$self->schema( $args{schema} || undef );
$self->_load_meta;
+
+ $Instances{$cdbi_class} = $self;
return $self;
}
}