… | |
… | |
11 | my ($class, %arg) = @_; |
11 | my ($class, %arg) = @_; |
12 | |
12 | |
13 | my $self = bless \%arg, $class; |
13 | my $self = bless \%arg, $class; |
14 | my $rcb = \$self->{cb}; |
14 | my $rcb = \$self->{cb}; |
15 | |
15 | |
|
|
16 | my @cond; |
16 | # some glibs need hup, others error with it, YMMV |
17 | # some glibs need hup, others error with it, YMMV |
17 | push @cond, "in", "hup" if $self->{poll} eq "r"; |
18 | push @cond, "in", "hup" if $self->{poll} eq "r"; |
18 | push @cond, "out", "hup" if $self->{poll} eq "w"; |
19 | push @cond, "out", "hup" if $self->{poll} eq "w"; |
19 | |
20 | |
20 | $self->{source} = add_watch Glib::IO fileno $self->{fh}, \@cond, sub { |
21 | $self->{source} = add_watch Glib::IO fileno $self->{fh}, \@cond, sub { |