X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FWatchdog.pm;h=9c1a3b5fc1c760ea733c7481580c767d915c657e;hb=f15f5e4321df31d2279edb480e9c7fc15c3af31c;hp=69ec53ce0d33b21304e9d129deaab52ca46de139;hpb=e51c502876f0ae620a7f6b570da9b88298ca4e83;p=kivitendo-erp.git diff --git a/SL/Watchdog.pm b/SL/Watchdog.pm index 69ec53ce0..9c1a3b5fc 100644 --- a/SL/Watchdog.pm +++ b/SL/Watchdog.pm @@ -4,7 +4,9 @@ use Data::Dumper; require Tie::Hash; -@ISA = (Tie::StdHash); +our @ISA = qw(Tie::StdHash); + +use strict; my %watched_variables; @@ -13,14 +15,16 @@ sub STORE { if (substr($key, 0, 10) eq "Watchdog::") { substr $key, 0, 10, ""; - $watched_variables{$key} = $value; - if ($value) { - $main::lxdebug->_write("WATCH", "Starting to watch '$key' with current value '$this->{$key}'"); - } else { - $main::lxdebug->_write("WATCH", "Stopping to watch '$key'"); + foreach $key (split m/[ ,]/, $key) { + $watched_variables{$key} = $value; + if ($value) { + $main::lxdebug->_write("WATCH", "Starting to watch '$key' with current value '$this->{$key}'"); + } else { + $main::lxdebug->_write("WATCH", "Stopping to watch '$key'"); + } } - return; + return; } if ($watched_variables{$key} @@ -44,4 +48,27 @@ sub STORE { $this->{$key} = $value; } +sub DELETE { + my ($this, $key) = @_; + + if ($watched_variables{$key} && ($this->{$key} ne "")) { + my $subroutine = (caller 1)[3]; + my ($self_filename, $self_line) = (caller)[1, 2]; + $main::lxdebug->_write("WATCH", + "Value of '$key' changed from '$this->{$key}' to '' " + . "in ${subroutine} at ${self_filename}:${self_line}"); + if ($watched_variables{$key} > 1) { + my $level = 1; + my ($dummy, $filename, $line); + + while (($dummy, $filename, $line, $subroutine) = caller $level) { + $main::lxdebug->_write("WATCH", " ${subroutine} from ${filename}:${line}"); + $level++; + } + } + } + + delete $this->{$key}; +} + 1;