… | |
… | |
136 | |
136 | |
137 | These watchers are normal Perl objects with normal Perl lifetime. After |
137 | These watchers are normal Perl objects with normal Perl lifetime. After |
138 | creating a watcher it will immediately "watch" for events and invoke the |
138 | creating a watcher it will immediately "watch" for events and invoke the |
139 | callback when the event occurs (of course, only when the event model |
139 | callback when the event occurs (of course, only when the event model |
140 | is in control). |
140 | is in control). |
|
|
141 | |
|
|
142 | Note that B<callbacks must not permanently change global variables> |
|
|
143 | potentially in use by the event loop (such as C<$_> or C<$[>) and that B<< |
|
|
144 | callbacks must not C<die> >>. The former is good programming practise in |
|
|
145 | Perl and the latter stems from the fact that exception handling differs |
|
|
146 | widely between event loops. |
141 | |
147 | |
142 | To disable the watcher you have to destroy it (e.g. by setting the |
148 | To disable the watcher you have to destroy it (e.g. by setting the |
143 | variable you store it in to C<undef> or otherwise deleting all references |
149 | variable you store it in to C<undef> or otherwise deleting all references |
144 | to it). |
150 | to it). |
145 | |
151 | |
… | |
… | |
1854 | =head1 BUGS |
1860 | =head1 BUGS |
1855 | |
1861 | |
1856 | Perl 5.8 has numerous memleaks that sometimes hit this module and are hard |
1862 | Perl 5.8 has numerous memleaks that sometimes hit this module and are hard |
1857 | to work around. If you suffer from memleaks, first upgrade to Perl 5.10 |
1863 | to work around. If you suffer from memleaks, first upgrade to Perl 5.10 |
1858 | and check wether the leaks still show up. (Perl 5.10.0 has other annoying |
1864 | and check wether the leaks still show up. (Perl 5.10.0 has other annoying |
1859 | mamleaks, such as leaking on C<map> and C<grep> but it is usually not as |
1865 | memleaks, such as leaking on C<map> and C<grep> but it is usually not as |
1860 | pronounced). |
1866 | pronounced). |
1861 | |
1867 | |
1862 | |
1868 | |
1863 | =head1 SEE ALSO |
1869 | =head1 SEE ALSO |
1864 | |
1870 | |