cvsuser     02/04/18 09:41:51

  Modified:    P5EEx/Blue/P5EEx/Blue Context.pm
  Log:
  added support for an external debug file
  
  Revision  Changes    Path
  1.25      +19 -9     p5ee/P5EEx/Blue/P5EEx/Blue/Context.pm
  
  Index: Context.pm
  ===================================================================
  RCS file: /cvs/public/p5ee/P5EEx/Blue/P5EEx/Blue/Context.pm,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -w -r1.24 -r1.25
  --- Context.pm        5 Apr 2002 21:58:56 -0000       1.24
  +++ Context.pm        18 Apr 2002 16:41:50 -0000      1.25
  @@ -1,6 +1,6 @@
   
   #############################################################################
  -## $Id: Context.pm,v 1.24 2002/04/05 21:58:56 spadkins Exp $
  +## $Id: Context.pm,v 1.25 2002/04/18 16:41:50 spadkins Exp $
   #############################################################################
   
   package P5EEx::Blue::Context;
  @@ -193,6 +193,7 @@
   
       my ($config_class, $session_class);
       %args = %$args;
  +    $self->{initconfig} = \%args;
       $args{context} = $self;
   
       $config_class   = $args{configClass};
  @@ -209,7 +210,6 @@
           if ($P5EEx::Blue::DEBUG && $self->dbg(1));
   
       $self->{session} = P5EEx::Blue::P5EE->new($session_class, "new", \%args);
  -    $self->{initconfig} = \%args;
   
       $self->{user_agent} = P5EEx::Blue::UserAgent->new($self);
   
  @@ -485,9 +485,9 @@
       }
    
       if ($new_service) {
  -        ####################################################################
  +        #####################################################################
           # infer a container (if none supplied, by the dots in the "name")
  -        ####################################################################
  +        #####################################################################
           if (! defined $service->{container}) {
               if ($name =~ /^(.+)\./) {
                   $service_config->{container} = $1;
  @@ -516,9 +516,8 @@
           }
   
           bless $service, $class;            # bless the service into the class
  -        $service->init();                # perform additional initializations
  -
           $session->{cache}{$type}{$name} = $service;       # save in the cache
  +        $service->init();                # perform additional initializations
       }
   
       $self->dbgprint("Context->service() = $service")
  @@ -1279,7 +1278,18 @@
   
   sub dbgprint {
       my $self = shift;
  +    my ($file);
  +    $file = $self->{initconfig}{debugfile};
  +    if (! $file) {
       print STDOUT "Debug: ", @_, "\n";
  +    }
  +    else {
  +        local(*FILE);
  +        if (open(main::FILE, ">> $file")) {
  +            print main::FILE $$, ": ", @_, "\n";
  +            close(main::FILE);
  +        }
  +    }
   }
   
   #############################################################################
  
  
  


Reply via email to