X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst.pm;h=7861b5f2893fdaa293e9eb7b5f2359629bbaf6ea;hb=1601aed5f75e09f1190a3f9a16cdd32df11834d1;hp=9c7dec24edef217135cf642b5ad0d566d25bfc6e;hpb=add5e412d1a0b3c464c49596ed547f271c604c95;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 9c7dec2..7861b5f 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -1020,11 +1020,20 @@ EOF if ( $class->debug and - my $comps = $class->container->get_all_components($class) + my $comps = $class->container->get_all_component_services($class) ) { - my $column_width = Catalyst::Utils::term_width() - 8 - 9; - my $t = Text::SimpleTable->new( [ $column_width, 'Class' ], [ 8, 'Type' ] ); - $t->row( $_ => ref($comps->{$_}) ? 'instance' : 'class' ) for keys %$comps; + my $column_width = Catalyst::Utils::term_width() - 16 - 9; + my $t = Text::SimpleTable->new( [ $column_width, 'Class' ], [ 16, 'Lifecycle' ] ); + + # FIXME + # I don't really know what we're going to show here + while (my ($class, $info) = each %$comps) { + my $lifecycle = $info->{backcompat_service} + ? $info->{backcompat_service}->lifecycle + : $info->{service}->lifecycle + ; + $t->row( $class, $lifecycle ); + } $class->log->debug( "Loaded components:\n" . $t->draw . "\n" ); } @@ -1449,16 +1458,28 @@ Returns a hash of components. sub components { my ( $class, $comps ) = @_; + # FIXME + # this is very wrong # people create components calling this sub directly, before setup + # also, $class->log doesn't work before setup_log $class->setup_config unless $class->container; my $container = $class->container; if ( $comps ) { + $class->log->warn(q{You are adding components using Catalyst's components method.}); + $class->log->warn(q{This behaviour is deprecated, please read}); + $class->log->warn(q{Catalyst::IOC::Container's documentation for better ways to do that.}); $container->add_component( $_ ) for keys %$comps; } - return $container->get_all_components($class); + # FIXME: + # t0m says should be "ref($c) ? $c->container->get_all_singleton_lifecycle_components : $c->container->get_all_components($c)". + # are you sure? isn't it the other way around? + # i.e. ref($c) ? get_all_components($c) : get_all_singleton_lifecycle_components() + return + ref($class) ? $container->get_all_singleton_lifecycle_components + : $container->get_all_components($class); } =head2 $c->context_class