… | |
… | |
57 | |
57 | |
58 | # this way of handling attributes simply is NOT scalable ;() |
58 | # this way of handling attributes simply is NOT scalable ;() |
59 | sub import { |
59 | sub import { |
60 | no strict 'refs'; |
60 | no strict 'refs'; |
61 | |
61 | |
62 | Coro->export_to_level(1, @_); |
62 | Coro->export_to_level (1, @_); |
63 | |
63 | |
64 | my $old = *{(caller)[0]."::MODIFY_CODE_ATTRIBUTES"}{CODE}; |
64 | my $old = *{(caller)[0]."::MODIFY_CODE_ATTRIBUTES"}{CODE}; |
65 | *{(caller)[0]."::MODIFY_CODE_ATTRIBUTES"} = sub { |
65 | *{(caller)[0]."::MODIFY_CODE_ATTRIBUTES"} = sub { |
66 | my ($package, $ref) = (shift, shift); |
66 | my ($package, $ref) = (shift, shift); |
67 | my @attrs; |
67 | my @attrs; |
… | |
… | |
105 | C<Coro::current> function instead. |
105 | C<Coro::current> function instead. |
106 | |
106 | |
107 | =cut |
107 | =cut |
108 | |
108 | |
109 | # maybe some other module used Coro::Specific before... |
109 | # maybe some other module used Coro::Specific before... |
110 | if ($current) { |
|
|
111 | $main->{specific} = $current->{specific}; |
110 | $main->{specific} = $current->{specific} |
112 | } |
111 | if $current; |
113 | |
112 | |
114 | $current = $main; |
113 | _set_current $main; |
115 | |
114 | |
116 | sub current() { $current } |
115 | sub current() { $current } |
117 | |
116 | |
118 | =item $idle |
117 | =item $idle |
119 | |
118 | |