[Handel] [ANNOUNCE] Handel 0.99_02 Released
Christopher H. Laco
claco at chrislaco.com
Tue Jun 6 14:58:29 CEST 2006
tom.kirkpatrick at virusbtn.com wrote:
>> Define "all injection code".... everything in
>> _configure_schema_instance(), or just the calls to load_components?
>>
>
> My copt of Storage.pm now looks like this and it runs a hell of a lot
> faster:
>
> sub _configure_schema_instance {
> my ($self) = @_;
> my $schema_instance = $self->schema_instance;
> my $schema_source = $self->schema_source;
> my $iterator_class = $self->iterator_class;
> my $item_class = $self->item_class;
> my $item_relationship = $self->item_relationship;
> my $source_class = $schema_instance->class($schema_source);
> my $item_source_class;
>
> if ($item_class) {
> eval "require $item_class";
>
> $item_source_class =
> $schema_instance->class($item_class->schema_source);
> };
>
> my $source = $schema_instance->source($schema_source);
> $source->resultset_class($iterator_class);
>
> if ($item_class) {
> if ($source->has_relationship($item_relationship)) {
>
> $source->related_source($item_relationship)->resultset_class($iterator_class);
> } else {
> throw Handel::Exception(-text =>
> translate('The source [_1] has no relationship named
> [_2].', $schema_source, $item_relationship)
> );
> };
> };
>
> $schema_instance->storage->dbh->{HandleError} =
> $self->can('process_error');
>
> ## load class and item class validation
> #if (my $profie = $self->validation_profile) {
> # $source_class->load_components('+Handel::Components::Validation');
> # $source_class->validation_profile($profie);
> #};
> #if ($item_class && $item_class->validation_profile) {
> #
> $item_source_class->load_components('+Handel::Components::Validation');
> #
> $item_source_class->validation_profile($item_class->validation_profile);
> #};
>
> ## load class and item class constraints
> #if (my $constraints = $self->constraints) {
> # $source_class->load_components('+Handel::Components::Constraints');
> # $source_class->constraints($constraints);
> #};
> #if ($item_class && $item_class->constraints) {
> #
> $item_source_class->load_components('+Handel::Components::Constraints');
> # $item_source_class->constraints($item_class->constraints);
> #};
>
> ## load class and item class default values
> #if (my $defaults = $self->default_values) {
> #
> $source_class->load_components('+Handel::Components::DefaultValues');
> # $source_class->default_values($defaults);
> #};
> #if ($item_class && $item_class->default_values) {
> #
> $item_source_class->load_components('+Handel::Components::DefaultValues');
> # $item_source_class->default_values($item_class->default_values);
> #};
> };
>
>
Right. Now try running that against the test suite and see what happens. :-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.rawmode.org/pipermail/handel/attachments/20060606/e6afe7a4/attachment.pgp
More information about the Handel
mailing list