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.12 by root, Thu Apr 23 22:44:30 2009 UTC vs.
Revision 1.13 by root, Wed Jul 8 02:01:12 2009 UTC

22=cut 22=cut
23 23
24package AnyEvent::Strict; 24package AnyEvent::Strict;
25 25
26no warnings; # *sigh* 26no warnings; # *sigh*
27use strict qw(vars subs);
27 28
28use Carp qw(croak); 29use Carp qw(croak);
30use Fcntl ();
29 31
30use AnyEvent (); 32use AnyEvent ();
33
34our @ISA;
31 35
32AnyEvent::post_detect { 36AnyEvent::post_detect {
33 # assume the first ISA member is the implementation 37 # assume the first ISA member is the implementation
34 # # and link us in before it in the chain. 38 # # and link us in before it in the chain.
35 my $MODEL = shift @AnyEvent::ISA; 39 my $MODEL = shift @AnyEvent::ISA;
43 47
44 ref $arg{cb} 48 ref $arg{cb}
45 or croak "AnyEvent->io called with illegal cb argument '$arg{cb}'"; 49 or croak "AnyEvent->io called with illegal cb argument '$arg{cb}'";
46 delete $arg{cb}; 50 delete $arg{cb};
47 51
52 $arg{poll} =~ /^[rw]$/
53 or croak "AnyEvent->io called with illegal poll argument '$arg{poll}'";
54
55 if (defined fileno $arg{fh} or ref $arg{fh} or $arg{fh} !~ /^\s*\d+\s*$/) {
48 defined fileno $arg{fh} 56 defined fileno $arg{fh}
49 or croak "AnyEvent->io called with illegal fh argument '$arg{fh}'"; 57 or croak "AnyEvent->io called with illegal fh argument '$arg{fh}'";
58 } else {
59 $arg{fh} = AnyEvent::_dupfh $arg{poll}, $arg{fh};
60 }
61
50 -f $arg{fh} 62 -f $arg{fh}
51 and croak "AnyEvent->io called with fh argument pointing to a file"; 63 and croak "AnyEvent->io called with fh argument pointing to a file";
64
65 delete $arg{poll};
52 delete $arg{fh}; 66 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 67
58 croak "AnyEvent->io called with unsupported parameter(s) " . join ", ", keys %arg 68 croak "AnyEvent->io called with unsupported parameter(s) " . join ", ", keys %arg
59 if keys %arg; 69 if keys %arg;
60 70
61 $class->SUPER::io (@_) 71 $class->SUPER::io (@_)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines