added the app to the container when the app is built
[catagits/Catalyst-Runtime.git] / lib / Catalyst.pm
index fd7589e..1b4c69f 100644 (file)
@@ -99,7 +99,7 @@ __PACKAGE__->stats_class('Catalyst::Stats');
 
 # Remember to update this in Catalyst::Runtime as well!
 
-our $VERSION = '5.90010';
+our $VERSION = '5.90011';
 
 sub import {
     my ( $class, @arguments ) = @_;
@@ -142,6 +142,15 @@ sub MODIFY_CODE_ATTRIBUTES {
     );
 }
 
+sub BUILD {
+    my $self = shift;
+    my $class = ref $self;
+
+    Catalyst::Exception->throw("You can't run the application before $class" . "->setup")
+        unless $class->setup_finished;
+
+    $self->container->_set_application($self);
+}
 
 sub _application { $_[0] }