sub controller {
my ( $c, $name, @args ) = @_;
my $container = $c->container->get_sub_container('controller');
- unshift @args, $c;
if( $name ) {
# Direct component hash lookup to avoid costly regexps
- return $container->get_component($name, \@args)
+ return $container->get_component( $name, $c, @args )
if $container->has_service($name) && !ref $name;
- return $container->get_component_regexp( $c, $name, \@args );
+ return $container->get_component_regexp( $name, $c, @args );
}
return $c->component( $c->action->class );
my ( $c, $name, @args ) = @_;
my $appclass = ref($c) || $c;
my $container = $c->container->get_sub_container('model');
- unshift @args, $c;
if( $name ) {
# Direct component hash lookup to avoid costly regexps
- return $container->get_component($name, \@args)
+ return $container->get_component( $name, $c, @args )
if $container->has_service($name) && !ref $name;
- return $container->get_component_regexp( $c, $name, \@args );
+ return $container->get_component_regexp( $name, $c, @args );
}
if (ref $c) {
$c->log->warn( 'NB: in version 5.81, the "random" behavior will not work at all.' );
}
- return $container->get_component( $comp, \@args );
+ return $container->get_component( $comp, $c, @args );
}
my ( $c, $name, @args ) = @_;
my $appclass = ref($c) || $c;
my $container = $c->container->get_sub_container('view');
- unshift @args, $c;
if( $name ) {
# Direct component hash lookup to avoid costly regexps
- return $container->get_component($name, \@args)
+ return $container->get_component( $name, $c, @args )
if !ref $name && $container->has_service($name);
$c->log->warn( "Attempted to use view '$name', but does not exist" );
- return $container->get_component_regexp( $c, $name, \@args );
+ return $container->get_component_regexp( $name, $c, @args );
}
if (ref $c) {
$c->log->warn( 'NB: in version 5.81, the "random" behavior will not work at all.' );
}
- return $container->get_component( $comp, \@args );
+ return $container->get_component( $comp, $c, @args );
}
=head2 $c->controllers
my ($type, $name) = _get_component_type_name($component);
# FIXME: shouldn't the service name be $name?
- $containers->{$type}->add_service(Catalyst::BlockInjection->new( name => $name, block => sub { return $class->setup_component($component) } ));
+ $containers->{$type}->add_service(Catalyst::IOC::BlockInjection->new( name => $name, block => sub { return $class->setup_component($component) } ));
}
return $class->$orig($components);
my %args = %{ $class->config || {} };
- my @container_classes = ( "${class}::Container", 'Catalyst::Container');
+ my @container_classes = ( "${class}::Container", 'Catalyst::IOC::Container');
unshift @container_classes, delete $args{container_class} if exists $args{container_class};
my $container_class = Class::MOP::load_first_existing_class(@container_classes);
- my $container = $container_class->new( %args, name => "$class" );
+ my $container = $container_class->new( %args,
+ name => "$class",
+ disable_regex_fallback =>
+ $class->config->{disable_component_resolution_regex_fallback},
+ );
$class->container($container);
my $config = $container->resolve(service => 'config');
$class->finalize_config; # back-compat
}
-=head $c->finalize_config
+=head2 $c->finalize_config
=cut
for my $component (@comps) {
my $instance = $class->components->{ $component } = $class->setup_component($component);
if ( my ($type, $name) = _get_component_type_name($component) ) {
- $containers->{$type}->add_service(Catalyst::BlockInjection->new( name => $name, block => sub { return $instance } ));
+ $containers->{$type}->add_service(Catalyst::IOC::BlockInjection->new( name => $name, block => sub { return $instance } ));
}
my @expanded_components = $instance->can('expand_modules')
? $instance->expand_modules( $component, $config )
) if $deprecatedcatalyst_component_names;
if (my ($type, $name) = _get_component_type_name($component)) {
- $containers->{$type}->add_service(Catalyst::BlockInjection->new( name => $name, block => sub { return $class->setup_component($component) } ));
+ $containers->{$type}->add_service(Catalyst::IOC::BlockInjection->new( name => $name, block => sub { return $class->setup_component($component) } ));
}
$class->components->{ $component } = $class->setup_component($component);
Andrew Ruthven
+André Walker
+
andyg: Andy Grundman <andy@hybridized.org>
audreyt: Audrey Tang