~ubuntu-branches/ubuntu/dapper/perl-tk/dapper

« back to all changes in this revision

Viewing changes to Event/Event/IO.pm

  • Committer: Bazaar Package Importer
  • Author(s): Michael C. Schultheiss
  • Date: 2006-01-16 16:54:02 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060116165402-1ppygm8hh8ahel2x
Tags: 1:804.027-2
* Incorporate changes from NMU (Thanks to Steve Kowalik.
  Closes: #348086)
* debian/control: Update Standards-Version (no changes needed)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
package Tk::Event::IO;
 
2
use strict;
 
3
use Carp;
2
4
 
3
5
use vars qw($VERSION @EXPORT_OK);
4
 
$VERSION = '3.036'; # $Id: //depot/Tk8/Event/Event/IO.pm#12 $ +24
 
6
$VERSION = sprintf '4.%03d', q$Revision: #8 $ =~ /\D(\d+)\s*$/;
5
7
 
6
8
use base qw(Exporter);
7
9
use Symbol ();
105
107
   $file = \*{$file};
106
108
  }
107
109
 my $obj = tied(*$file);
108
 
 $obj = tie *$file,'Tk::Event::IO', $file unless $obj && $obj->isa('Tk::Event::IO');
 
110
 unless ($obj && $obj->isa('Tk::Event::IO'))
 
111
  {
 
112
   $obj = tie *$file,'Tk::Event::IO', $file;
 
113
  }
109
114
 if (@_ == 3)
110
115
  {
 
116
   # query return the handler
111
117
   return $obj->handler($imode);
112
118
  }
113
119
 else
114
120
  {
 
121
   # set the handler
115
122
   my $h = $obj->handler($imode,$cb);
116
 
   undef $obj;
117
 
   untie *$file unless $h;
 
123
   undef $obj;  # Prevent warnings about untie with ref to object
 
124
   unless ($h)
 
125
    {
 
126
     untie *$file;
 
127
    }
118
128
  }
119
129
}
120
130