Skip to content

Commit 3e17db5

Browse files
committed
Changed import rule
1 parent 9b05cab commit 3e17db5

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

lib/AnyEvent/Delay/Simple.pm

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,21 @@ our @EXPORT_OK = qw(easy_delay);
1818
sub import {
1919
my ($class, @args) = @_;
2020

21-
my $ae;
21+
my (@ae, @up);
2222

23-
@args = grep { !($_ && $_ eq '-AE' && ($ae = 1)) } @args;
24-
if ($ae) {
25-
$class->export('AE', @args);
23+
foreach (@args) {
24+
if ($_ && /^AE::(.+)?/) {
25+
push(@ae, $1);
26+
}
27+
else {
28+
push(@up, $_);
29+
}
2630
}
27-
else {
28-
$class->export_to_level(1, undef, @args);
31+
if (@ae) {
32+
$class->export('AE', @ae);
33+
}
34+
if (@up) {
35+
$class->export_to_level(1, undef, @up);
2936
}
3037
}
3138

@@ -249,9 +256,9 @@ handler will call, if it's defined. Unless error handler defined, error is
249256
fatal. If last callback finishes and no error occurs, finish handler will call.
250257
251258
You may import these functions into L<AE> namespace instead of current one.
252-
Just use module with symbol C<-AE>.
259+
Just prefix function name with C<AE::> when using module.
253260
254-
use AnyEvent::Delay::Simple qw(AE);
261+
use AnyEvent::Delay::Simple qw(AE::delay);
255262
AE::delay(...);
256263
257264
=head2 delay

t/02-call-ae.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use Test::More;
77
use Test::Deep;
88

99
use AnyEvent;
10-
use AnyEvent::Delay::Simple qw(-AE delay easy_delay);
10+
use AnyEvent::Delay::Simple qw(AE::delay AE::easy_delay);
1111

1212

1313
local $ENV{PERL_ANYEVENT_LOG} = 'log=nolog';

0 commit comments

Comments
 (0)