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.358 by root, Sat Aug 13 02:35:32 2011 UTC vs.
Revision 1.359 by root, Sat Aug 13 16:11:33 2011 UTC

933 933
934Returns C<$AnyEvent::MODEL>, forcing autodetection of the event model 934Returns C<$AnyEvent::MODEL>, forcing autodetection of the event model
935if necessary. You should only call this function right before you would 935if necessary. You should only call this function right before you would
936have created an AnyEvent watcher anyway, that is, as late as possible at 936have created an AnyEvent watcher anyway, that is, as late as possible at
937runtime, and not e.g. during initialisation of your module. 937runtime, and not e.g. during initialisation of your module.
938
939The effect of calling this function is as if a watcher had been created
940(specifically, actions that happen "when the first watcher is created"
941happen when calling detetc as well).
938 942
939If you need to do some initialisation before AnyEvent watchers are 943If you need to do some initialisation before AnyEvent watchers are
940created, use C<post_detect>. 944created, use C<post_detect>.
941 945
942=item $guard = AnyEvent::post_detect { BLOCK } 946=item $guard = AnyEvent::post_detect { BLOCK }
1378 1382
1379 if (exists $ENV{PERL_ANYEVENT_DEBUG_SHELL}) { 1383 if (exists $ENV{PERL_ANYEVENT_DEBUG_SHELL}) {
1380 require AnyEvent::Socket; 1384 require AnyEvent::Socket;
1381 require AnyEvent::Debug; 1385 require AnyEvent::Debug;
1382 1386
1387 my $shell = $ENV{PERL_ANYEVENT_DEBUG_SHELL};
1388 $shell =~ s/\$\$/$$/g;
1389
1383 my ($host, $service) = AnyEvent::Socket::parse_hostport ($ENV{PERL_ANYEVENT_DEBUG_SHELL}); 1390 my ($host, $service) = AnyEvent::Socket::parse_hostport ($shell);
1384 $AnyEvent::Debug::SHELL = AnyEvent::Debug::shell ($host, $service); 1391 $AnyEvent::Debug::SHELL = AnyEvent::Debug::shell ($host, $service);
1385 } 1392 }
1386 1393
1387 (shift @post_detect)->() while @post_detect; 1394 (shift @post_detect)->() while @post_detect;
1388 undef @post_detect; 1395 undef @post_detect;
1955C<PERL_ANYEVENT_STRICT=1> in your environment while developing programs 1962C<PERL_ANYEVENT_STRICT=1> in your environment while developing programs
1956can be very useful, however. 1963can be very useful, however.
1957 1964
1958=item C<PERL_ANYEVENT_DEBUG_SHELL> 1965=item C<PERL_ANYEVENT_DEBUG_SHELL>
1959 1966
1960If this env variable is set, then its contents will be 1967If this env variable is set, then its contents will be interpreted by
1961interpreted by C<AnyEvent::Socket::parse_hostport> and an 1968C<AnyEvent::Socket::parse_hostport> (after replacing every occurance of
1962C<AnyEvent::Debug::shell> is bound on that port. The shell object is saved 1969C<$$> by the process pid) and an C<AnyEvent::Debug::shell> is bound on
1963in C<$AnyEvent::Debug::SHELL>. 1970that port. The shell object is saved in C<$AnyEvent::Debug::SHELL>.
1971
1972This takes place when the first watcher is created.
1964 1973
1965For example, to bind a debug shell on a unix domain socket in 1974For example, to bind a debug shell on a unix domain socket in
1966F</tmp/debug.sock>, you could use this: 1975F<< /tmp/debug<pid>.sock >>, you could use this:
1967 1976
1968 PERL_ANYEVENT_DEBUG_SHELL=unix/:/tmp/debug.sock perlprog 1977 PERL_ANYEVENT_DEBUG_SHELL=unix/:/tmp/debug\$\$.sock perlprog
1978
1979Note that creating sockets in F</tmp> is very unsafe on multiuser
1980systems.
1969 1981
1970=item C<PERL_ANYEVENT_DEBUG_WRAP> 1982=item C<PERL_ANYEVENT_DEBUG_WRAP>
1971 1983
1972Can be set to C<0>, C<1> or C<2> and enables wrapping of all watchers for 1984Can be set to C<0>, C<1> or C<2> and enables wrapping of all watchers for
1973debugging purposes. See C<AnyEvent::Debug::wrap> for details. 1985debugging purposes. See C<AnyEvent::Debug::wrap> for details.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines