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

Comparing Coro/Coro.pm (file contents):
Revision 1.70 by root, Mon Sep 5 22:13:05 2005 UTC vs.
Revision 1.71 by root, Tue Nov 29 12:36:18 2005 UTC

30 30
31=cut 31=cut
32 32
33package Coro; 33package Coro;
34 34
35BEGIN { eval { require warnings } && warnings->unimport ("uninitialized") } 35use strict;
36no warnings "uninitialized";
36 37
37use Coro::State; 38use Coro::State;
38 39
39use vars qw($idle $main $current);
40
41use base Exporter; 40use base Exporter::;
42 41
42our $idle; # idle coroutine
43our $main; # main coroutine
44our $current; # current coroutine
45
43$VERSION = '1.4'; 46our $VERSION = 1.5;
44 47
45@EXPORT = qw(async cede schedule terminate current); 48our @EXPORT = qw(async cede schedule terminate current);
46%EXPORT_TAGS = ( 49our %EXPORT_TAGS = (
47 prio => [qw(PRIO_MAX PRIO_HIGH PRIO_NORMAL PRIO_LOW PRIO_IDLE PRIO_MIN)], 50 prio => [qw(PRIO_MAX PRIO_HIGH PRIO_NORMAL PRIO_LOW PRIO_IDLE PRIO_MIN)],
48); 51);
49@EXPORT_OK = @{$EXPORT_TAGS{prio}}; 52our @EXPORT_OK = @{$EXPORT_TAGS{prio}};
50 53
51{ 54{
52 my @async; 55 my @async;
53 my $init; 56 my $init;
54 57
55 # this way of handling attributes simply is NOT scalable ;() 58 # this way of handling attributes simply is NOT scalable ;()
56 sub import { 59 sub import {
60 no strict 'refs';
61
57 Coro->export_to_level(1, @_); 62 Coro->export_to_level(1, @_);
63
58 my $old = *{(caller)[0]."::MODIFY_CODE_ATTRIBUTES"}{CODE}; 64 my $old = *{(caller)[0]."::MODIFY_CODE_ATTRIBUTES"}{CODE};
59 *{(caller)[0]."::MODIFY_CODE_ATTRIBUTES"} = sub { 65 *{(caller)[0]."::MODIFY_CODE_ATTRIBUTES"} = sub {
60 my ($package, $ref) = (shift, shift); 66 my ($package, $ref) = (shift, shift);
61 my @attrs; 67 my @attrs;
62 for (@_) { 68 for (@_) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines