--- Coro/Coro.pm 2006/12/01 03:47:55 1.92 +++ Coro/Coro.pm 2006/12/02 18:01:30 1.94 @@ -59,7 +59,7 @@ sub import { no strict 'refs'; - Coro->export_to_level(1, @_); + Coro->export_to_level (1, @_); my $old = *{(caller)[0]."::MODIFY_CODE_ATTRIBUTES"}{CODE}; *{(caller)[0]."::MODIFY_CODE_ATTRIBUTES"} = sub { @@ -107,11 +107,10 @@ =cut # maybe some other module used Coro::Specific before... -if ($current) { - $main->{specific} = $current->{specific}; -} +$main->{specific} = $current->{specific} + if $current; -$current = $main; +_set_current $main; sub current() { $current } @@ -257,14 +256,14 @@ =cut -sub _new_coro { +sub _run_coro { terminate &{+shift}; } sub new { my $class = shift; - $class->SUPER::new (\&_new_coro, @_) + $class->SUPER::new (\&_run_coro, @_) } =item $success = $coroutine->ready