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