Data-Trace

 view release on metacpan or  search on metacpan

lib/Data/Tie/Watch.pm  view on Meta::CPAN

=head1 NAME

 Data::Tie::Watch - place watchpoints on Perl variables.

=cut

use 5.006;
use strict;
use warnings;
use Carp;
use Scalar::Util qw( reftype weaken );

our $VERSION = '1.302.2';
our %METHODS;

=head1 SYNOPSIS

 use Data::Tie::Watch;

 $watch = Data::Tie::Watch->new(
     -variable => \$frog,

lib/Data/Tie/Watch.pm  view on Meta::CPAN

    elsif ( $type =~ /ARRAY/ ) {
        $watch_obj = tie @$var, 'Data::Tie::Watch::Array', %args;
    }
    elsif ( $type =~ /HASH/ ) {
        $watch_obj = tie %$var, 'Data::Tie::Watch::Hash', %args;
    }

    $watch_obj->{id}   = "$watch_obj";
    $watch_obj->{type} = $type;

    # weaken $watch_obj->{-variable};

    $watch_obj;
}

=head2 DESTROY

Clean up global cache.

Note: Originally the 'Unwatch()' method call was placed at just before the
return of 'callback()' which appeared to be the logical place for it.



( run in 0.292 second using v1.01-cache-2.11-cpan-65fba6d93b7 )