summaryrefslogtreecommitdiff
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
commit60cd8830d1486264206de93e87271bf45aa37a31 (patch)
tree56c01b781b12a690302b8d52456aa9f543ae100c
parent9967f7b5169a9bf9e61ee3e6672c3379c0a4b2ae (diff)
perl: Only 'use AnyEvent;' once
The others are rather pointless.
-rw-r--r--perl/Tanja.pm12
1 files changed, 9 insertions, 3 deletions
diff --git a/perl/Tanja.pm b/perl/Tanja.pm
index d62a30d..0f59159 100644
--- a/perl/Tanja.pm
+++ b/perl/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