Codebase list libcatalyst-model-dbic-schema-perl / f27a05e
use BUILD's $args instead of %$self Rafael Kitover 14 years ago
1 changed file(s) with 9 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
468468 );
469469
470470 sub BUILD {
471 my $self = shift;
471 my ($self, $args) = @_;
472472 my $class = $self->_original_class_name;
473473 my $schema_class = $self->schema_class;
474474
504504
505505 $self->schema($self->composed_schema->clone);
506506
507 $self->_pass_options_to_schema;
507 $self->_pass_options_to_schema($args);
508508
509509 $self->schema->storage_type($self->storage_type)
510510 if $self->storage_type;
620620 }
621621
622622 sub _pass_options_to_schema {
623 my $self = shift;
624
625 my @attributes = map $_->name, $self->meta->get_all_attributes;
623 my ($self, $args) = @_;
624
625 my @attributes = map {
626 $_->init_arg || ()
627 } $self->meta->get_all_attributes;
628
626629 my %attributes;
627630 @attributes{@attributes} = ();
628631
629 for my $opt (keys %$self) {
632 for my $opt (keys %$args) {
630633 if (not exists $attributes{$opt}) {
631634 next unless $self->schema->can($opt);
632635 $self->schema->$opt($self->{$opt});