… | |
… | |
1124 | is that you cannot use blocking APIs, but the non-blocking variant should |
1124 | is that you cannot use blocking APIs, but the non-blocking variant should |
1125 | work. |
1125 | work. |
1126 | |
1126 | |
1127 | =cut |
1127 | =cut |
1128 | |
1128 | |
1129 | our $VERSION = '3.4'; |
1129 | our $VERSION = '5.23'; |
1130 | |
1130 | |
1131 | $INC{"urxvt/anyevent.pm"} = 1; # mark us as there |
1131 | $INC{"urxvt/anyevent.pm"} = 1; # mark us as there |
1132 | push @AnyEvent::REGISTRY, [urxvt => urxvt::anyevent::]; |
1132 | push @AnyEvent::REGISTRY, [urxvt => urxvt::anyevent::]; |
1133 | |
1133 | |
1134 | sub timer { |
1134 | sub timer { |
… | |
… | |
1139 | urxvt::timer |
1139 | urxvt::timer |
1140 | ->new |
1140 | ->new |
1141 | ->after ($arg{after}) |
1141 | ->after ($arg{after}) |
1142 | ->interval ($arg{interval}) |
1142 | ->interval ($arg{interval}) |
1143 | ->start |
1143 | ->start |
1144 | ->cb (sub { |
1144 | ->cb ($argv{interval} ? $cb : sub { |
1145 | #TODO interval? |
|
|
1146 | $_[0]->stop; # need to cancel manually |
1145 | $_[0]->stop; # need to cancel manually |
1147 | $cb->(); |
1146 | $cb->(); |
1148 | }) |
1147 | }) |
1149 | } |
1148 | } |
1150 | |
1149 | |
… | |
… | |
1171 | my $cb = $arg{cb}; |
1170 | my $cb = $arg{cb}; |
1172 | |
1171 | |
1173 | urxvt::iw |
1172 | urxvt::iw |
1174 | ->new |
1173 | ->new |
1175 | ->start |
1174 | ->start |
1176 | ->cb (sub { |
1175 | ->cb ($cb) |
1177 | #TODO really cancel? |
|
|
1178 | $_[0]->stop; # need to cancel manually |
|
|
1179 | $cb->(); |
|
|
1180 | }) |
|
|
1181 | } |
1176 | } |
1182 | |
1177 | |
1183 | sub child { |
1178 | sub child { |
1184 | my ($class, %arg) = @_; |
1179 | my ($class, %arg) = @_; |
1185 | |
1180 | |
… | |
… | |
1187 | |
1182 | |
1188 | urxvt::pw |
1183 | urxvt::pw |
1189 | ->new |
1184 | ->new |
1190 | ->start ($arg{pid}) |
1185 | ->start ($arg{pid}) |
1191 | ->cb (sub { |
1186 | ->cb (sub { |
1192 | #TODO really cancel? |
|
|
1193 | $_[0]->stop; # need to cancel manually |
1187 | $_[0]->stop; # need to cancel manually |
1194 | $cb->($_[0]->rpid, $_[0]->rstatus); |
1188 | $cb->($_[0]->rpid, $_[0]->rstatus); |
1195 | }) |
1189 | }) |
1196 | } |
1190 | } |
1197 | |
1191 | |