ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/lib/AnyEvent/Strict.pm
(Generate patch)

Comparing AnyEvent/lib/AnyEvent/Strict.pm (file contents):
Revision 1.6 by root, Fri Nov 21 01:35:59 2008 UTC vs.
Revision 1.10 by root, Wed Apr 1 14:02:27 2009 UTC

3AnyEvent::Strict - force strict mode on for the whole process 3AnyEvent::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
12This module implements AnyEvent's strict mode. 12This module implements AnyEvent's strict mode.
13 13
14Loading it makes AnyEvent check all arguments to AnyEvent-methods, at the 14Loading it makes AnyEvent check all arguments to AnyEvent-methods, at the
15expense of being slower (often the argument checking takes longer than the 15expense of being slower (often the argument checking takes longer than the
16actual fucntion). 16actual function).
17 17
18Normally, you don't load this module yourself but instead use it 18Normally, you don't load this module yourself but instead use it
19indirectly via the C<PERL_ANYEVENT_STRICT> environment variable (see 19indirectly via the C<PERL_ANYEVENT_STRICT> environment variable (see
20L<AnyEvent>). However, this module can be loaded at any time. 20L<AnyEvent>). However, this module can be loaded at any time.
21 21
22=cut 22=cut
23 23
24package AnyEvent::Strict; 24package AnyEvent::Strict;
25
26no warnings; # *sigh*
25 27
26use Carp qw(croak); 28use Carp qw(croak);
27 29
28use AnyEvent (); 30use AnyEvent ();
29 31
43 or croak "AnyEvent->io called with illegal cb argument '$arg{cb}'"; 45 or croak "AnyEvent->io called with illegal cb argument '$arg{cb}'";
44 delete $arg{cb}; 46 delete $arg{cb};
45 47
46 defined fileno $arg{fh} 48 defined fileno $arg{fh}
47 or croak "AnyEvent->io called with illegal fh argument '$arg{fh}'"; 49 or croak "AnyEvent->io called with illegal fh argument '$arg{fh}'";
50 -f $arg{fh}
51 and croak "AnyEvent->io called with fh argument pointing to a file";
48 delete $arg{fh}; 52 delete $arg{fh};
49 53
50 $arg{poll} =~ /^[rw]$/ 54 $arg{poll} =~ /^[rw]$/
51 or croak "AnyEvent->io called with illegal poll argument '$arg{poll}'"; 55 or croak "AnyEvent->io called with illegal poll argument '$arg{poll}'";
52 delete $arg{poll}; 56 delete $arg{poll};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines