X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/69239581a2335955fb8f412fa1dd9b175cd1f038..e7191bc2818007bf58cec5e2167e977904f0ac44:/SL/Watchdog.pm diff --git a/SL/Watchdog.pm b/SL/Watchdog.pm new file mode 100644 index 000000000..3aac6532b --- /dev/null +++ b/SL/Watchdog.pm @@ -0,0 +1,38 @@ +package SL::Watchdog; + +use Data::Dumper; + +require Tie::Hash; + +@ISA = (Tie::StdHash); + +my %watched_variables; + +sub STORE { + my ($this, $key, $value) = @_; + + 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'"); + } + return; + + } + + if ($watched_variables{$key} + && ($this->{$key} ne $value)) { + 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 '$value' " + . "in ${subroutine} at ${self_filename}:${self_line}"); + } + + $this->{$key} = $value; +} + +1;