removing noise (comments and warnings)
André Walker [Sat, 20 Aug 2011 04:20:26 +0000 (01:20 -0300)]
lib/Catalyst/IOC.pm
lib/Catalyst/IOC/ConstructorInjection.pm
lib/Catalyst/IOC/Container.pm
t/lib/TestAppCustomContainer/NoSugarContainer.pm

index d635645..a71bddb 100644 (file)
@@ -5,10 +5,6 @@ use Bread::Board qw/depends_on/;
 use Catalyst::IOC::ConstructorInjection;
 no strict 'refs';
 
-# FIXME - All of these imports need to get the importing package
-#         as the customise_container and current_container variables
-#         NEED to be in the containers package so there can be multiple
-#         containers..
 use Sub::Exporter -setup => {
     exports => [qw/
         depends_on
@@ -23,30 +19,11 @@ use Sub::Exporter -setup => {
         container
     /]},
 };
-#use Sub::Exporter -setup => [
-#    qw(
-#        Bread::Board::as
-#        Bread::Board::container
-#        Bread::Board::depends_on
-#        Bread::Board::service
-#        Bread::Board::alias
-#        Bread::Board::wire_names
-#        Bread::Board::include
-#        Bread::Board::typemap
-#        Bread::Board::infer
-#    )
-#];
-# I'm probably doing it wrong.
-# Anyway, I'll just use Moose::Exporter. Do I really have to use Sub::Exporter?
-#use Moose::Exporter;
-#Moose::Exporter->setup_import_methods(
-#    also => ['Bread::Board'],
-#);
+
 sub container (&) {
     my $code = shift;
     my $caller = caller;
     ${"${caller}::customise_container"} = sub {
-        warn("In customise container");
         local ${"${caller}::current_container"} = shift;
         $code->();
     };
@@ -90,8 +67,6 @@ sub component {
 
 1;
 
-# FIXME - should the code example below be on this file or Catalyst::IOC::Container?
-
 __END__
 
 =pod
index 72c551b..bed9355 100644 (file)
@@ -8,8 +8,11 @@ extends 'Bread::Board::ConstructorInjection';
 
 sub BUILD {
     my $self = shift;
-    $self->add_dependency(__catalyst_config => Bread::Board::Dependency->new(service_path => '/config'));
-    warn("Added dependency for config in " . $self->class);
+    $self->add_dependency(
+        __catalyst_config => Bread::Board::Dependency->new(
+            service_path => '/config'
+        )
+    );
 }
 
 has catalyst_component_name => (
@@ -27,8 +30,6 @@ has config => (
 around resolve_dependencies => sub {
     my ($orig, $self, @args) = @_;
     my %deps = $self->$orig(@args);
-#    use Data::Dumper;
-#        warn("$self Resolve deps" . Data::Dumper::Dumper(\%deps));
     my $app_config = delete $deps{__catalyst_config};
     my $conf_key = Catalyst::Utils::class2classsuffix($self->catalyst_component_name);
     $self->_set_config($app_config->{$conf_key} || {});
@@ -38,11 +39,9 @@ around resolve_dependencies => sub {
 sub get {
     my $self = shift;
     my $component   = $self->class;
-    warn("In get $component");
 
     my $params = $self->params;
     my %config = (%{ $self->config || {} }, %{ $params });
-#    warn(Data::Dumper::Dumper(\%config));
     $self->_clear_config;
 
     # FIXME - Is depending on the application name to pass into constructors here a good idea?
index 93e953a..1e9ec84 100644 (file)
@@ -114,7 +114,6 @@ sub BUILD {
         no strict 'refs';
         no warnings 'once';
         my $class = ref $self;
-        warn("In build $class");
         ${ $class . '::customise_container' }->($self)
             if ${ $class . '::customise_container' };
     }
@@ -453,7 +452,6 @@ sub build_locate_components_service {
 
 sub setup_components {
     my $self = shift;
-    warn("Setting up default components");
     my $class = $self->resolve( service => 'application_name' );
     my @comps = @{ $self->resolve( service => 'locate_components' ) };
     my %comps = map { $_ => 1 } @comps;
@@ -648,8 +646,6 @@ sub get_all_components {
         for my $component ($container->get_service_list) {
             my $comp_service = $container->get_service($component);
 
-            warn "getting  $component in $class, type $type";
-
             $components{$comp_service->catalyst_component_name} = $comp_service->get(ctx => $class);
         }
     }
index 9027592..e1439d6 100644 (file)
@@ -8,7 +8,6 @@ extends 'Catalyst::IOC::Container';
 sub BUILD {
     my $self = shift;
 
-    warn("Add SingletonLifeCycle to model");
     $self->get_sub_container('model')->add_service(
         Catalyst::IOC::ConstructorInjection->new(
             name             => 'SingletonLifeCycle',
@@ -21,7 +20,6 @@ sub BUILD {
         )
     );
 
-    warn("Add RequestLifeCycle to model");
     $self->get_sub_container('model')->add_service(
         Catalyst::IOC::ConstructorInjection->new(
             name         => 'RequestLifeCycle',
@@ -34,7 +32,6 @@ sub BUILD {
         )
     );
 
-#    warn("Add DependsOnDefaultSetup to model");
 #    $self->get_sub_container('model')->add_service(
 #        Catalyst::IOC::ConstructorInjection->new(
 #            name             => 'DependsOnDefaultSetup',