~ubuntu-branches/ubuntu/natty/perl-tk/natty

« back to all changes in this revision

Viewing changes to lib/Tie/Watch.pm

  • Committer: Bazaar Package Importer
  • Author(s): Stephen Zander
  • Date: 2004-03-14 13:54:44 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040314135444-prc09u2or4dbr3to
Tags: 1:800.025-2
Add xlibs-dev to Build-Depends:,
Closes: #237942

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
package Tie::Watch;
2
2
 
3
3
use vars qw($VERSION);
4
 
$VERSION = '3.002'; # $Id: //depot/Tk8/lib/Tie/Watch.pm#2 $
 
4
$VERSION = '3.004'; # $Id: //depot/Tk8/lib/Tie/Watch.pm#4 $
5
5
 
6
6
=head1 NAME
7
7
 
255
255
    croak "Tie::Watch::new(): -variable is required." if not defined $variable;
256
256
 
257
257
    my($type, $watch_obj) = (ref $variable, undef);
258
 
    if ($type =~ /SCALAR/) {
 
258
    if ($type =~ /(SCALAR|REF)/) {
259
259
        @arg_defaults{@scalar_callbacks} = (
260
260
            [\&Tie::Watch::Scalar::Destroy],  [\&Tie::Watch::Scalar::Fetch],
261
261
            [\&Tie::Watch::Scalar::Store]);
282
282
    @ahsh{@margs} = @arg_defaults{@margs}; # fill in missing values
283
283
    normalize_callbacks \%ahsh;
284
284
 
285
 
    if ($type =~ /SCALAR/) {
 
285
    if ($type =~ /(SCALAR|REF)/) {
286
286
        $watch_obj = tie $$variable, 'Tie::Watch::Scalar', %ahsh;
287
287
    } elsif ($type =~ /ARRAY/) {
288
288
        $watch_obj = tie @$variable, 'Tie::Watch::Array',  %ahsh;
345
345
 
346
346
    my $variable = $_[0]->{-variable};
347
347
    my $type = ref $variable;
348
 
    my $copy = $_[0]->{-ptr} if $type !~ /SCALAR/;
 
348
    my $copy = $_[0]->{-ptr} if $type !~ /(SCALAR|REF)/;
349
349
    my $shadow = $_[0]->{-shadow};
350
350
    undef $_[0];
351
 
    if ($type =~ /SCALAR/) {
 
351
    if ($type =~ /(SCALAR|REF)/) {
352
352
        untie $$variable;
353
353
    } elsif ($type =~ /ARRAY/) {
354
354
        untie @$variable;