… | |
… | |
71 | |
71 | |
72 | use strict; |
72 | use strict; |
73 | no warnings "uninitialized"; |
73 | no warnings "uninitialized"; |
74 | |
74 | |
75 | use Carp; |
75 | use Carp; |
|
|
76 | |
|
|
77 | our $DIEHOOK; |
|
|
78 | our $WARNHOOK; |
|
|
79 | |
|
|
80 | BEGIN { |
76 | our $DIEHOOK = sub { }; |
81 | $DIEHOOK = sub { }; |
77 | our $WARNHOOK = sub { warn $_[0] }; |
82 | $WARNHOOK = sub { warn $_[0] }; |
|
|
83 | } |
|
|
84 | |
|
|
85 | sub diehook { &$DIEHOOK } |
|
|
86 | sub warnhook { &$WARNHOOK } |
78 | |
87 | |
79 | use XSLoader; |
88 | use XSLoader; |
80 | |
89 | |
81 | BEGIN { |
90 | BEGIN { |
82 | our $VERSION = '4.1'; |
91 | our $VERSION = '4.1'; |
83 | |
92 | |
84 | # must be done here because the xs part expects it to exist |
93 | # must be done here because the xs part expects it to exist |
85 | # it might exist already because Coro::Specific created it. |
94 | # it might exist already because Coro::Specific created it. |
86 | $Coro::current ||= { }; |
95 | $Coro::current ||= { }; |
|
|
96 | |
|
|
97 | $SIG{__DIE__} = \&diehook; |
|
|
98 | $SIG{__WARN__} = \&warnhook; |
87 | |
99 | |
88 | XSLoader::load __PACKAGE__, $VERSION; |
100 | XSLoader::load __PACKAGE__, $VERSION; |
89 | } |
101 | } |
90 | |
102 | |
91 | use Exporter; |
103 | use Exporter; |
… | |
… | |
153 | Variable Initial Value |
165 | Variable Initial Value |
154 | @_ whatever arguments were passed to the Coro |
166 | @_ whatever arguments were passed to the Coro |
155 | $_ undef |
167 | $_ undef |
156 | $@ undef |
168 | $@ undef |
157 | $/ "\n" |
169 | $/ "\n" |
158 | $SIG{__DIE__} aliased to $Coro::State::DIEHOOK(*) |
170 | $SIG{__DIE__} aliased to $Coro::State::DIEHOOK |
159 | $SIG{__WARN__} aliased to $Coro::State::WARNHOOK(*) |
171 | $SIG{__WARN__} aliased to $Coro::State::WARNHOOK |
160 | (default fh) *STDOUT |
172 | (default fh) *STDOUT |
161 | $1, $2... all regex results are initially undefined |
173 | $1, $2... all regex results are initially undefined |
162 | |
|
|
163 | (*) may not read back properly, for speed reasons, but |
|
|
164 | local()ising should be safe. |
|
|
165 | |
174 | |
166 | If you feel that something important is missing then tell me. Also |
175 | If you feel that something important is missing then tell me. Also |
167 | remember that every function call that might call C<transfer> (such |
176 | remember that every function call that might call C<transfer> (such |
168 | as C<Coro::Channel::put>) might clobber any global and/or special |
177 | as C<Coro::Channel::put>) might clobber any global and/or special |
169 | variables. Yes, this is by design ;) You can always create your own |
178 | variables. Yes, this is by design ;) You can always create your own |