Tk::Trace

Tk::Trace class can emulate Tcl/Tk trace functions.
Download

Tk::Trace Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Stephen O. Lidie
  • Publisher web site:
  • http://search.cpan.org/~lusol/Tk-Gauge-0.3/Tk/Gauge.pm

Tk::Trace Tags


Tk::Trace Description

Tk::Trace class can emulate Tcl/Tk trace functions. Tk::Trace class can emulate Tcl/Tk trace functions.SYNOPSIS use Tk::Trace $mw->traceVariable($v, 'wru' => ); %vinfo = $mw->traceVinfo($v); print "Trace info :n ", join("n ", @{$vinfo{-legible}}), "n"; $mw->traceVdelete($v);This class module emulates the Tcl/Tk trace family of commands by binding subroutines of your devising to Perl variables using simple Tie::Watch features.Callback format is patterned after the Perl/Tk scheme: supply either a code reference, or, supply an array reference and pass the callback code reference in the first element of the array, followed by callback arguments.User callbacks are passed these arguments: $_ = undef for a scalar, index/key for array/hash $_ = variable's current (read), new (write), final (undef) value $_ = operation (r, w, or u) $_ = optional user callback argumentsAs a Trace user, you have an important responsibility when writing your callback, since you control the final value assigned to the variable. A typical callback might look like: sub callback { my($index, $value, $op, @args) = @_; return if $op eq 'u'; # .... code which uses $value ... return $value; # variable's final value }Note that the callback's return value becomes the variable's final value, for either read or write traces.For write operations, the variable is updated with its new value before the callback is invoked.Multiple read, write and undef callbacks can be attached to a variable, which are invoked in reverse order of creation. Requirements: · Perl


Tk::Trace Related Software