summaryrefslogtreecommitdiff
path: root/Tanja.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2012-02-16 18:55:07 +0100
committerYorhel <git@yorhel.nl>2012-02-16 18:55:07 +0100
commitdfa74a754817dcf2da1f9788a9ad4924bb21efb5 (patch)
treef9078770b5a753f9dde293830d49736945151bd8 /Tanja.pm
parentc28ba46badb247c02088d7456bcc182b4501abc1 (diff)
Only 'use AnyEvent;' once
The others are rather pointless.
Diffstat (limited to 'Tanja.pm')
-rw-r--r--Tanja.pm12
1 files changed, 9 insertions, 3 deletions
diff --git a/Tanja.pm b/Tanja.pm
index d62a30d..0f59159 100644
--- a/Tanja.pm
+++ b/Tanja.pm
@@ -3,6 +3,10 @@ package Tanja;
use strict;
use warnings;
+# Just make sure it's loaded. It doesn't export anything.
+use AnyEvent;
+
+
# Args: [ pattern ], [ tuple ]
# Returns: a true value on match, a false value otherwise
# TODO: this match() implementation is for experimental purposes only, it
@@ -23,7 +27,6 @@ package Tanja::Server;
use strict;
use warnings;
-use AnyEvent;
# Create a new server (representing a "network")
@@ -81,7 +84,6 @@ package Tanja::Session;
use strict;
use warnings;
-use AnyEvent;
# Create a new session (usually called by $serv->session)
@@ -143,23 +145,26 @@ package Tanja::ReturnPath;
use strict;
use warnings;
-use AnyEvent;
+
sub _new {
my($own, $cb) = @_;
return bless \$cb, $own;
}
+
sub null {
my $cb = shift;
return !$$cb;
}
+
sub reply {
my($cb, $t) = @_;
$$cb && AnyEvent::postpone { $$cb->($t); };
}
+
sub DESTROY {
my $cb = shift;
my $c = $$cb;
@@ -167,6 +172,7 @@ sub DESTROY {
undef $$cb;
}
+
1;
# vim:noet:sw=4:ts=4