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

Comparing AnyEvent/lib/AnyEvent.pm (file contents):
Revision 1.168 by root, Tue Jul 8 23:53:37 2008 UTC vs.
Revision 1.172 by root, Thu Jul 17 15:21:02 2008 UTC

826no warnings; 826no warnings;
827use strict; 827use strict;
828 828
829use Carp; 829use Carp;
830 830
831our $VERSION = 4.2; 831our $VERSION = 4.22;
832our $MODEL; 832our $MODEL;
833 833
834our $AUTOLOAD; 834our $AUTOLOAD;
835our @ISA; 835our @ISA;
836 836
963 963
964 my $class = shift; 964 my $class = shift;
965 $class->$func (@_); 965 $class->$func (@_);
966} 966}
967 967
968# utility function to dup a filehandle. this is used by many backends
969# to support binding more than one watcher per filehandle (they usually
970# allow only one watcher per fd, so we dup it to get a different one).
971sub _dupfh($$$$) {
972 my ($poll, $fh, $r, $w) = @_;
973
974 require Fcntl;
975
976 # cygwin requires the fh mode to be matching, unix doesn't
977 my ($rw, $mode) = $poll eq "r" ? ($r, "<")
978 : $poll eq "w" ? ($w, ">")
979 : Carp::croak "AnyEvent->io requires poll set to either 'r' or 'w'";
980
981 open my $fh2, "$mode&" . fileno $fh
982 or die "cannot dup() filehandle: $!";
983
984 # we assume CLOEXEC is already set by perl in all important cases
985
986 ($fh2, $rw)
987}
988
968package AnyEvent::Base; 989package AnyEvent::Base;
969 990
970# default implementation for now and time 991# default implementation for now and time
971 992
972use Time::HiRes (); 993use Time::HiRes ();
1185 1206
1186=item C<PERL_ANYEVENT_STRICT> 1207=item C<PERL_ANYEVENT_STRICT>
1187 1208
1188AnyEvent does not do much argument checking by default, as thorough 1209AnyEvent does not do much argument checking by default, as thorough
1189argument checking is very costly. Setting this variable to a true value 1210argument checking is very costly. Setting this variable to a true value
1190will cause AnyEvent to thoroughly check the arguments passed to most 1211will cause AnyEvent to load C<AnyEvent::Strict> and then to thoroughly
1191method calls and croaks if it finds any problems. In other words, enables 1212check the arguments passed to most method calls. If it finds any problems
1213it will croak.
1214
1215In other words, enables "strict" mode.
1216
1192"strict" mode. Unlike C<use strict> it is definitely recommended ot keep 1217Unlike C<use strict> it is definitely recommended ot keep it off in
1193it off in production. 1218production.
1194 1219
1195=item C<PERL_ANYEVENT_MODEL> 1220=item C<PERL_ANYEVENT_MODEL>
1196 1221
1197This can be used to specify the event model to be used by AnyEvent, before 1222This can be used to specify the event model to be used by AnyEvent, before
1198auto detection and -probing kicks in. It must be a string consisting 1223auto detection and -probing kicks in. It must be a string consisting

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines