… | |
… | |
28 | |
28 | |
29 | @EXPORT = qw( |
29 | @EXPORT = qw( |
30 | gethostbyname gethostbyaddr |
30 | gethostbyname gethostbyaddr |
31 | ); |
31 | ); |
32 | |
32 | |
33 | $VERSION = 0.45; |
33 | $VERSION = 0.6; |
34 | |
34 | |
35 | $MAXPARALLEL = 16; # max. number of parallel jobs |
35 | $MAXPARALLEL = 16; # max. number of parallel jobs |
36 | |
36 | |
37 | my $jobs = new Coro::Semaphore $MAXPARALLEL; |
37 | my $jobs = new Coro::Semaphore $MAXPARALLEL; |
38 | |
38 | |
… | |
… | |
60 | Work exactly like their perl counterparts, but do not block. Currently |
60 | Work exactly like their perl counterparts, but do not block. Currently |
61 | this is being implemented by forking, so it's not exactly low-cost. |
61 | this is being implemented by forking, so it's not exactly low-cost. |
62 | |
62 | |
63 | =cut |
63 | =cut |
64 | |
64 | |
|
|
65 | my $netdns = 0 && eval { use Net::DNS 0.24 }; |
|
|
66 | |
65 | sub gethostbyname($) { |
67 | sub gethostbyname($) { |
|
|
68 | if ($netdns) { |
|
|
69 | die; |
|
|
70 | } else { |
66 | _do_asy { gethostbyname $_[0] } @_; |
71 | _do_asy { gethostbyname $_[0] } @_; |
|
|
72 | } |
67 | } |
73 | } |
68 | |
74 | |
69 | sub gethostbyaddr($$) { |
75 | sub gethostbyaddr($$) { |
|
|
76 | if ($netdns) { |
|
|
77 | die; |
|
|
78 | } else { |
70 | _do_asy { gethostbyaddr $_[0], $_[1] } @_; |
79 | _do_asy { gethostbyaddr $_[0], $_[1] } @_; |
|
|
80 | } |
71 | } |
81 | } |
72 | |
82 | |
73 | 1; |
83 | 1; |
74 | |
84 | |
75 | =head1 AUTHOR |
85 | =head1 AUTHOR |