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

Comparing Coro/Coro/State.pm (file contents):
Revision 1.86 by root, Mon Oct 8 01:45:20 2007 UTC vs.
Revision 1.87 by root, Sat Oct 13 23:19:10 2007 UTC

71 71
72use strict; 72use strict;
73no warnings "uninitialized"; 73no warnings "uninitialized";
74 74
75use Carp; 75use Carp;
76
77our $DIEHOOK;
78our $WARNHOOK;
79
80BEGIN {
76our $DIEHOOK = sub { }; 81 $DIEHOOK = sub { };
77our $WARNHOOK = sub { warn $_[0] }; 82 $WARNHOOK = sub { warn $_[0] };
83}
84
85sub diehook { &$DIEHOOK }
86sub warnhook { &$WARNHOOK }
78 87
79use XSLoader; 88use XSLoader;
80 89
81BEGIN { 90BEGIN {
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
91use Exporter; 103use 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
166If you feel that something important is missing then tell me. Also 175If you feel that something important is missing then tell me. Also
167remember that every function call that might call C<transfer> (such 176remember that every function call that might call C<transfer> (such
168as C<Coro::Channel::put>) might clobber any global and/or special 177as C<Coro::Channel::put>) might clobber any global and/or special
169variables. Yes, this is by design ;) You can always create your own 178variables. Yes, this is by design ;) You can always create your own

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines