cvsuser 02/03/01 19:20:06
Modified: P5EEx/Blue/P5EEx/Blue Context.pm
Log:
more dbg() cleanup
Revision Changes Path
1.19 +18 -19 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.18
retrieving revision 1.19
diff -u -w -r1.18 -r1.19
--- Context.pm 2 Mar 2002 03:07:46 -0000 1.18
+++ Context.pm 2 Mar 2002 03:20:06 -0000 1.19
@@ -1,6 +1,6 @@
#############################################################################
-## $Id: Context.pm,v 1.18 2002/03/02 03:07:46 spadkins Exp $
+## $Id: Context.pm,v 1.19 2002/03/02 03:20:06 spadkins Exp $
#############################################################################
package P5EEx::Blue::Context;
@@ -355,7 +355,7 @@
sub service {
my ($self, $type, $name, %named) = @_;
$self->dbgprint("Context->service(" . join(", ",@_) . ")")
- if ($P5EEx::Blue::DEBUG && $self->dbg(ref($self),"service",3));
+ if ($P5EEx::Blue::DEBUG && $self->dbg(3));
my ($args, $lcf_type, $new_service, $override, $lightweight, $attrib);
my ($service, $config, $class, $session);
@@ -395,7 +395,7 @@
$service_state = $session->{state}{$type}{$name};
$self->dbgprint("Context->service(): new service. config=$config
sconf=$service_config sstate=$service_state")
- if ($P5EEx::Blue::DEBUG && $self->dbg(ref($self),"service",6));
+ if ($P5EEx::Blue::DEBUG && $self->dbg(6));
$new_service = 1;
@@ -477,7 +477,7 @@
" service=", $service->{$attrib},
" service_state=", $service_state->{$attrib},
" args=", $args->{$attrib})
- if ($P5EEx::Blue::DEBUG && $self->dbg(ref($self),"service",6));
+ if ($P5EEx::Blue::DEBUG && $self->dbg(6));
}
}
@@ -524,7 +524,7 @@
}
$self->dbgprint("Context->service() = $service")
- if ($P5EEx::Blue::DEBUG && $self->dbg(ref($self),"service",3));
+ if ($P5EEx::Blue::DEBUG && $self->dbg(3));
return $service;
}
@@ -656,7 +656,7 @@
}
}
$self->dbgprint("Context->wget($name,$var) (value) = [$value]")
- if ($P5EEx::Blue::DEBUG && $self->dbg(ref($self),"wget",3));
+ if ($P5EEx::Blue::DEBUG && $self->dbg(3));
return $value;
} # match {
elsif ($var =~ /^\{([^\}]+)\}$/) { # a simple "{foo.bar}"
@@ -671,7 +671,7 @@
}
}
$self->dbgprint("Context->wget($name,$var) (attrib) = [$value]")
- if ($P5EEx::Blue::DEBUG && $self->dbg(ref($self),"wget",3));
+ if ($P5EEx::Blue::DEBUG && $self->dbg(3));
return $value;
} # match {
elsif ($var =~ /^([a-zA-Z0-9_\.-]+)([\{\}\[\]].*)$/) {
@@ -687,7 +687,7 @@
print STDERR "ERROR: Context->get($var): eval ($perl): $@\n" if ($@);
$self->dbgprint("Context->wget($name,$var) (indexed) = [$value]")
- if ($P5EEx::Blue::DEBUG && $self->dbg(ref($self),"wget",3));
+ if ($P5EEx::Blue::DEBUG && $self->dbg(3));
}
return $value;
@@ -723,7 +723,7 @@
my ($perl);
$self->dbgprint("Context->wset($name,$var,$value)")
- if ($P5EEx::Blue::DEBUG && $self->dbg(ref($self),"wset",3));
+ if ($P5EEx::Blue::DEBUG && $self->dbg(3));
if ($var !~ /[\[\]\{\}]/) { # no special chars, "foo.bar"
$self->{session}{state}{Widget}{$name}{$var} = $value;
@@ -991,11 +991,10 @@
Sample Usage:
$context->dbgprint("this is debug output")
- if ($P5EEx::Blue::DEBUG &&
- $context->dbg(ref($self), "this_method", 3);
+ if ($P5EEx::Blue::DEBUG && $context->dbg(3));
$context->dbgprint("this is debug output")
- if ($context->dbg(ref($self), "this_method", 3);
+ if ($context->dbg(3));
The first usage is functionally identical to the second, but the check
of the global debug level explicitly reduces the runtime overhead to
@@ -1007,6 +1006,7 @@
sub dbg {
my ($self, $level) = @_;
+ $level = 1 if (!defined $level);
my ($class, $file, $line, $method, $hasargs, $wantarray) = caller(1);
return 0 if (! $P5EEx::Blue::DEBUG);
return 0 if (defined $level && $P5EEx::Blue::DEBUG < $level);
@@ -1037,8 +1037,7 @@
Sample Usage:
$context->dbgprint("this is debug output")
- if ($P5EEx::Blue::DEBUG &&
- $context->dbg(ref($self), "this_method", 3);
+ if ($P5EEx::Blue::DEBUG && $context->dbg(3));
=cut
@@ -1191,7 +1190,7 @@
my ($class, $method, $args, $argidx, $repcache);
$self->dbgprint("Context->shutdown()")
- if ($P5EEx::Blue::DEBUG && $self->dbg(ref($self),"shutdown"));
+ if ($P5EEx::Blue::DEBUG && $self->dbg(1));
$repcache = $self->{session}{cache}{Repository};
if (defined $repcache && ref($repcache) eq "HASH") {
@@ -1199,7 +1198,7 @@
$instance = $repcache->{$repname};
$self->dbgprint("Context->shutdown(): $instance->disconnect()")
- if ($P5EEx::Blue::DEBUG && $self->dbg(ref($self),"shutdown"));
+ if ($P5EEx::Blue::DEBUG && $self->dbg(1));
$instance->disconnect();
delete $repcache->{$repname};
@@ -1214,7 +1213,7 @@
my ($class, $method, $args, $rows, $row);
$self->dbgprint("Context->domain($domain)")
- if ($P5EEx::Blue::DEBUG && $self->dbg(ref($self),"domain"));
+ if ($P5EEx::Blue::DEBUG && $self->dbg(1));
$config = $self->{config}{Domain}{$domain};
$domainref = $self->{session}{Domain}{$domain};
@@ -1246,7 +1245,7 @@
}
$self->dbgprint("Context->domain($domain): needs_loading=$needs_loading")
- if ($P5EEx::Blue::DEBUG && $self->dbg(ref($self),"domain"));
+ if ($P5EEx::Blue::DEBUG && $self->dbg(1));
if ($needs_loading) {
$rep = $self->repository($repository);
@@ -1257,7 +1256,7 @@
#$args = [ $domain ] if (!defined $args);
#$self->dbgprint("Context->domain($domain): $rep->$method(@$args)")
- # if ($P5EEx::Blue::DEBUG && $self->dbg(ref($self),"domain"));
+ # if ($P5EEx::Blue::DEBUG && $self->dbg(1));
#$rows = ${rep}->${method}(@$args);
#$values = [];