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.11 by root, Tue Apr 14 04:27:32 2009 UTC vs.
Revision 1.14 by root, Thu Jul 9 18:58:19 2009 UTC

21 21
22=cut 22=cut
23 23
24package AnyEvent::Strict; 24package AnyEvent::Strict;
25 25
26no warnings; # *sigh* 26use common::sense;
27 27
28use Carp qw(croak); 28use Carp qw(croak);
29use Fcntl ();
29 30
30use AnyEvent (); 31use AnyEvent ();
32
33our @ISA;
31 34
32AnyEvent::post_detect { 35AnyEvent::post_detect {
33 # assume the first ISA member is the implementation 36 # assume the first ISA member is the implementation
34 # # and link us in before it in the chain. 37 # # and link us in before it in the chain.
35 my $MODEL = shift @AnyEvent::ISA; 38 my $MODEL = shift @AnyEvent::ISA;
43 46
44 ref $arg{cb} 47 ref $arg{cb}
45 or croak "AnyEvent->io called with illegal cb argument '$arg{cb}'"; 48 or croak "AnyEvent->io called with illegal cb argument '$arg{cb}'";
46 delete $arg{cb}; 49 delete $arg{cb};
47 50
51 $arg{poll} =~ /^[rw]$/
52 or croak "AnyEvent->io called with illegal poll argument '$arg{poll}'";
53
54 if (defined fileno $arg{fh} or ref $arg{fh} or $arg{fh} !~ /^\s*\d+\s*$/) {
48 defined fileno $arg{fh} 55 defined fileno $arg{fh}
49 or croak "AnyEvent->io called with illegal fh argument '$arg{fh}'"; 56 or croak "AnyEvent->io called with illegal fh argument '$arg{fh}'";
57 } else {
58 $arg{fh} = AnyEvent::_dupfh $arg{poll}, $arg{fh};
59 }
60
50 -f $arg{fh} 61 -f $arg{fh}
51 and croak "AnyEvent->io called with fh argument pointing to a file"; 62 and croak "AnyEvent->io called with fh argument pointing to a file";
63
64 delete $arg{poll};
52 delete $arg{fh}; 65 delete $arg{fh};
53
54 $arg{poll} =~ /^[rw]$/
55 or croak "AnyEvent->io called with illegal poll argument '$arg{poll}'";
56 delete $arg{poll};
57 66
58 croak "AnyEvent->io called with unsupported parameter(s) " . join ", ", keys %arg 67 croak "AnyEvent->io called with unsupported parameter(s) " . join ", ", keys %arg
59 if keys %arg; 68 if keys %arg;
60 69
61 $class->SUPER::io (@_) 70 $class->SUPER::io (@_)
117 if keys %arg; 126 if keys %arg;
118 127
119 $class->SUPER::child (@_) 128 $class->SUPER::child (@_)
120} 129}
121 130
131sub idle {
132 my $class = shift;
133 my %arg = @_;
134
135 ref $arg{cb}
136 or croak "AnyEvent->idle called with illegal cb argument '$arg{cb}'";
137 delete $arg{cb};
138
139 croak "AnyEvent->idle called with unsupported parameter(s) " . join ", ", keys %arg
140 if keys %arg;
141
142 $class->SUPER::idle (@_)
143}
144
122sub condvar { 145sub condvar {
123 my $class = shift; 146 my $class = shift;
124 my %arg = @_; 147 my %arg = @_;
125 148
126 !exists $arg{cb} or ref $arg{cb} 149 !exists $arg{cb} or ref $arg{cb}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines