… | |
… | |
3 | AnyEvent::Strict - force strict mode on for the whole process |
3 | AnyEvent::Strict - force strict mode on for the whole process |
4 | |
4 | |
5 | =head1 SYNOPSIS |
5 | =head1 SYNOPSIS |
6 | |
6 | |
7 | use AnyEvent::Strict; |
7 | use AnyEvent::Strict; |
8 | # struct mode now switched on |
8 | # strict mode now switched on |
9 | |
9 | |
10 | =head1 DESCRIPTION |
10 | =head1 DESCRIPTION |
11 | |
11 | |
12 | This module implements AnyEvent's strict mode. |
12 | This module implements AnyEvent's strict mode. |
13 | |
13 | |
14 | Loading it makes AnyEvent check all arguments to AnyEvent-methods, at the |
14 | Loading it makes AnyEvent check all arguments to AnyEvent-methods, at the |
15 | expense of being slower (often the argument checking takes longer than the |
15 | expense of being slower (often the argument checking takes longer than the |
16 | actual fucntion). |
16 | actual function). |
17 | |
17 | |
18 | Normally, you don't load this module yourself but instead use it |
18 | Normally, you don't load this module yourself but instead use it |
19 | indirectly via the C<PERL_ANYEVENT_STRICT> environment variable (see |
19 | indirectly via the C<PERL_ANYEVENT_STRICT> environment variable (see |
20 | L<AnyEvent>). However, this module can be loaded at any time. |
20 | L<AnyEvent>). However, this module can be loaded at any time. |
21 | |
21 | |
… | |
… | |
43 | or croak "AnyEvent->io called with illegal cb argument '$arg{cb}'"; |
43 | or croak "AnyEvent->io called with illegal cb argument '$arg{cb}'"; |
44 | delete $arg{cb}; |
44 | delete $arg{cb}; |
45 | |
45 | |
46 | defined fileno $arg{fh} |
46 | defined fileno $arg{fh} |
47 | or croak "AnyEvent->io called with illegal fh argument '$arg{fh}'"; |
47 | or croak "AnyEvent->io called with illegal fh argument '$arg{fh}'"; |
|
|
48 | -f $arg{fh} |
|
|
49 | and croak "AnyEvent->io called with fh argument pointing to a file"; |
48 | delete $arg{fh}; |
50 | delete $arg{fh}; |
49 | |
51 | |
50 | $arg{poll} =~ /^[rw]$/ |
52 | $arg{poll} =~ /^[rw]$/ |
51 | or croak "AnyEvent->io called with illegal poll argument '$arg{poll}'"; |
53 | or croak "AnyEvent->io called with illegal poll argument '$arg{poll}'"; |
52 | delete $arg{poll}; |
54 | delete $arg{poll}; |