Permalink
Browse files

Use Moo and Type::Tiny in test suite (derp deux)

  • Loading branch information...
1 parent f46c4f1 commit 4a19f5f707b901f9d46552636959fa845a88ccc8 @sanko committed Oct 5, 2013
Showing with 23 additions and 19 deletions.
  1. +6 −1 Changes
  2. +1 −1 lib/AnyEvent/BitTorrent.pm
  3. +13 −13 t/800_utils/Tracker.pm
  4. +3 −4 t/800_utils/Tracker/HTTP.pm
View
@@ -1,4 +1,9 @@
-Version 0.2.2 | Ten-ish at night on September 24th, 2013 |
+Version 0.2.3 | Just before midnight on October 4th, 2013 | ??????
+
+ Documentation/Sample Code/Test Suite:
+ * Use Moo and Type::Tiny in tests
+
+Version 0.2.2 | Half past midnight on September 25th, 2013 | f46c4f1
API Changes/Compatibility Information:
* Fix Moo vs Any::Moose derp
@@ -1,5 +1,5 @@
package AnyEvent::BitTorrent;
-{ $AnyEvent::BitTorrent::VERSION = 'v0.2.2' }
+{ $AnyEvent::BitTorrent::VERSION = 'v0.2.3' }
use AnyEvent;
use AnyEvent::Handle;
use AnyEvent::Socket;
View
@@ -1,20 +1,20 @@
package t::800_utils::Tracker;
-use Any::Moose;
+use Moo;
+use Types::Standard qw[Defined HashRef Int Str];
use AnyEvent::Handle;
use AnyEvent::Socket;
use Net::BitTorrent::Protocol::BEP03::Bencode qw[:all];
-
#
-has port => (isa => 'Int',
- is => 'ro',
+has port => (isa => Int,
+ is => 'lazy',
writer => '_set_port',
- default => 0
+ default => sub {0}
);
has host =>
- (isa => 'Str', is => 'ro', writer => '_set_host', default => '::');
+ (isa => Str, is => 'lazy', writer => '_set_host', default => sub {'::'});
has peers => (
- isa => 'HashRef[HashRef]', # By (key ^ info_hash)
- is => 'ro',
+ isa => HashRef [HashRef], # By (key ^ info_hash)
+ is => 'lazy',
default => sub { {} },
handles => {
@@ -26,13 +26,13 @@ has peers => (
#find_info_hash => ['map', sub { $_->{'info_hash'} eq $_[0] } ],
}
);
-has socket => (isa => 'Defined',
- is => 'ro',
+has socket => (isa => Defined,
+ is => 'lazy',
init_arg => undef,
builder => '_build_socket'
);
-has interval => (is => 'rw', isa => 'Int', default => 60 * 10, lazy => 1);
-has complete => (is => 'rw', isa => 'Int', default => 0, lazy => 1);
+has interval => (is => 'lazy', isa => Int, default => sub { 60 * 10 });
+has complete => (is => 'lazy', isa => Int, default => sub {0});
sub on_drain {
my $s = shift;
@@ -50,7 +50,7 @@ CPAN ID: SANKO
=head1 License and Legal
-Copyright (C) 2008-2012 by Sanko Robinson <sanko@cpan.org>
+Copyright (C) 2008-2013 by Sanko Robinson <sanko@cpan.org>
This program is free software; you can redistribute it and/or modify it under
the terms of
@@ -1,8 +1,7 @@
package t::800_utils::Tracker::HTTP;
use Net::BitTorrent::Protocol qw[:bencode :compact]; # IPv6
-use Any::Moose;
+use Moo;
use AnyEvent::Socket;
-
#
extends 't::800_utils::Tracker';
@@ -84,7 +83,7 @@ sub on_read {
ip => $_->{'address'}->[0],
port => $_->{'address'}->[1]
}
- } @peers
+ } @peers
)
)
};
@@ -116,7 +115,7 @@ CPAN ID: SANKO
=head1 License and Legal
-Copyright (C) 2008-2012 by Sanko Robinson <sanko@cpan.org>
+Copyright (C) 2008-2013 by Sanko Robinson <sanko@cpan.org>
This program is free software; you can redistribute it and/or modify it under
the terms of

0 comments on commit 4a19f5f

Please sign in to comment.