summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build.PL4
-rw-r--r--Changes6
-rw-r--r--LICENSE6
-rw-r--r--MANIFEST1
-rw-r--r--META.json16
-rw-r--r--META.yml12
-rw-r--r--Makefile.PL13
-rw-r--r--README4
-rw-r--r--lib/Protocol/IRC.pm10
-rw-r--r--lib/Protocol/IRC/Client.pm15
-rw-r--r--lib/Protocol/IRC/Message.pm22
-rw-r--r--t/00use.t2
-rw-r--r--t/01message.t2
-rw-r--r--t/02message-splitprefix.t2
-rw-r--r--t/03message-argnames.t2
-rw-r--r--t/04message-from-named.t2
-rw-r--r--t/10protocol-sendrecv.t47
-rw-r--r--t/11protocol-isupport.t21
-rw-r--r--t/12protocol-hints.t71
-rw-r--r--t/13protocol-text.t65
-rw-r--r--t/14protocol-encoding.t59
-rw-r--r--t/20client.t35
-rw-r--r--t/21client-isupport.t13
-rw-r--r--t/22client-chanmodes.t31
-rw-r--r--t/23client-cap.t27
-rw-r--r--t/24client-gates.t57
-rw-r--r--t/25client-commands.t18
-rw-r--r--t/99pod.t2
28 files changed, 287 insertions, 278 deletions
diff --git a/Build.PL b/Build.PL
index 04031ef..eb0ad00 100644
--- a/Build.PL
+++ b/Build.PL
@@ -1,3 +1,4 @@
+use v5;
use strict;
use warnings;
@@ -6,7 +7,7 @@ use Module::Build;
my $build = Module::Build->new(
module_name => 'Protocol::IRC',
requires => {
- 'perl' => '5.010', # //, mro c3
+ 'perl' => '5.014',
},
test_requires => {
'Future' => 0,
@@ -15,7 +16,6 @@ my $build = Module::Build->new(
},
auto_configure_requires => 0, # Don't add M::B to configure_requires
license => 'perl',
- create_makefile_pl => 'traditional',
create_license => 1,
create_readme => 1,
);
diff --git a/Changes b/Changes
index 793dc33..00f4076 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,11 @@
Revision history for Protocol-IRC
+0.13 2021-06-14
+ [CHANGES]
+ * Perl 5.14 style fixes
+ * Recognise numerics relating to IRCv3.1's SASL AUTHENTICATE
+ * Various small docs fixes
+
0.12 [CHANGES]
* Add WATCH-related server numerics
* Add RPL_WHOISSECURE as most networks use it now
diff --git a/LICENSE b/LICENSE
index 8a8e8e5..f15476d 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-This software is copyright (c) 2017 by Paul Evans <leonerd@leonerd.org.uk>.
+This software is copyright (c) 2021 by Paul Evans <leonerd@leonerd.org.uk>.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
@@ -12,7 +12,7 @@ b) the "Artistic License"
--- The GNU General Public License, Version 1, February 1989 ---
-This software is Copyright (c) 2017 by Paul Evans <leonerd@leonerd.org.uk>.
+This software is Copyright (c) 2021 by Paul Evans <leonerd@leonerd.org.uk>.
This is free software, licensed under:
@@ -272,7 +272,7 @@ That's all there is to it!
--- The Artistic License 1.0 ---
-This software is Copyright (c) 2017 by Paul Evans <leonerd@leonerd.org.uk>.
+This software is Copyright (c) 2021 by Paul Evans <leonerd@leonerd.org.uk>.
This is free software, licensed under:
diff --git a/MANIFEST b/MANIFEST
index eebb3f5..b0fac18 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -4,7 +4,6 @@ lib/Protocol/IRC.pm
lib/Protocol/IRC/Client.pm
lib/Protocol/IRC/Message.pm
LICENSE
-Makefile.PL
MANIFEST This list of files
META.json
META.yml
diff --git a/META.json b/META.json
index e27debc..4900e63 100644
--- a/META.json
+++ b/META.json
@@ -4,19 +4,19 @@
"Paul Evans <leonerd@leonerd.org.uk>"
],
"dynamic_config" : 1,
- "generated_by" : "Module::Build version 0.422",
+ "generated_by" : "Module::Build version 0.4231",
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
- "version" : "2"
+ "version" : 2
},
"name" : "Protocol-IRC",
"prereqs" : {
"runtime" : {
"requires" : {
- "perl" : "5.010"
+ "perl" : "5.014"
}
},
"test" : {
@@ -30,15 +30,15 @@
"provides" : {
"Protocol::IRC" : {
"file" : "lib/Protocol/IRC.pm",
- "version" : "0.12"
+ "version" : "0.13"
},
"Protocol::IRC::Client" : {
"file" : "lib/Protocol/IRC/Client.pm",
- "version" : "0.12"
+ "version" : "0.13"
},
"Protocol::IRC::Message" : {
"file" : "lib/Protocol/IRC/Message.pm",
- "version" : "0.12"
+ "version" : "0.13"
}
},
"release_status" : "stable",
@@ -47,6 +47,6 @@
"http://dev.perl.org/licenses/"
]
},
- "version" : "0.12",
- "x_serialization_backend" : "JSON::PP version 2.27400"
+ "version" : "0.13",
+ "x_serialization_backend" : "JSON::PP version 4.05"
}
diff --git a/META.yml b/META.yml
index 5eeae0a..a1c93a2 100644
--- a/META.yml
+++ b/META.yml
@@ -7,7 +7,7 @@ build_requires:
Test::Fatal: '0'
Test::More: '0.88'
dynamic_config: 1
-generated_by: 'Module::Build version 0.422, CPAN::Meta::Converter version 2.150005'
+generated_by: 'Module::Build version 0.4231, CPAN::Meta::Converter version 2.150010'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -16,16 +16,16 @@ name: Protocol-IRC
provides:
Protocol::IRC:
file: lib/Protocol/IRC.pm
- version: '0.12'
+ version: '0.13'
Protocol::IRC::Client:
file: lib/Protocol/IRC/Client.pm
- version: '0.12'
+ version: '0.13'
Protocol::IRC::Message:
file: lib/Protocol/IRC/Message.pm
- version: '0.12'
+ version: '0.13'
requires:
- perl: '5.010'
+ perl: '5.014'
resources:
license: http://dev.perl.org/licenses/
-version: '0.12'
+version: '0.13'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff --git a/Makefile.PL b/Makefile.PL
deleted file mode 100644
index 939aa46..0000000
--- a/Makefile.PL
+++ /dev/null
@@ -1,13 +0,0 @@
-# Note: this file was auto-generated by Module::Build::Compat version 0.4220
-require 5.010;
-use ExtUtils::MakeMaker;
-WriteMakefile
-(
- 'NAME' => 'Protocol::IRC',
- 'VERSION_FROM' => 'lib/Protocol/IRC.pm',
- 'PREREQ_PM' => {},
- 'INSTALLDIRS' => 'site',
- 'EXE_FILES' => [],
- 'PL_FILES' => {}
-)
-;
diff --git a/README b/README
index c6e3840..be4817e 100644
--- a/README
+++ b/README
@@ -197,9 +197,9 @@ METHODS
Shortcut to sending a CTCP message. Sends a PRIVMSG to the given
target, containing the given verb and argument string.
- send_ctcprely
+ send_ctcpreply
- $irc->send_ctcprely( $prefix, $target, $verb, $argstr )
+ $irc->send_ctcpreply( $prefix, $target, $verb, $argstr )
Shortcut to sending a CTCP reply. As send_ctcp but using a NOTICE
instead.
diff --git a/lib/Protocol/IRC.pm b/lib/Protocol/IRC.pm
index 0c9a82b..54c182d 100644
--- a/lib/Protocol/IRC.pm
+++ b/lib/Protocol/IRC.pm
@@ -3,13 +3,11 @@
#
# (C) Paul Evans, 2010-2017 -- leonerd@leonerd.org.uk
-package Protocol::IRC;
+package Protocol::IRC 0.13;
-use strict;
+use v5.14;
use warnings;
-our $VERSION = '0.12';
-
use Carp;
use Scalar::Util qw( blessed );
@@ -394,9 +392,9 @@ sub send_ctcp
$self->send_message( "PRIVMSG", undef, $target, "\001$verb $argstr\001" );
}
-=head2 send_ctcprely
+=head2 send_ctcpreply
- $irc->send_ctcprely( $prefix, $target, $verb, $argstr )
+ $irc->send_ctcpreply( $prefix, $target, $verb, $argstr )
Shortcut to sending a CTCP reply. As C<send_ctcp> but using a NOTICE instead.
diff --git a/lib/Protocol/IRC/Client.pm b/lib/Protocol/IRC/Client.pm
index 7c0da16..febef4f 100644
--- a/lib/Protocol/IRC/Client.pm
+++ b/lib/Protocol/IRC/Client.pm
@@ -3,15 +3,12 @@
#
# (C) Paul Evans, 2010-2017 -- leonerd@leonerd.org.uk
-package Protocol::IRC::Client;
+package Protocol::IRC::Client 0.13;
-use strict;
+use v5.14;
use warnings;
-use 5.010; # //
use base qw( Protocol::IRC );
-our $VERSION = '0.12';
-
use Carp;
=head1 NAME
@@ -647,7 +644,9 @@ sub prepare_hints_RPL_CHANNELMODEIS
The following methods actually send IRC commands. Each is named after the
underlying IRC command it sends, using capital letters for methods that simply
-send that command.
+send that command. They all take a kvlist of named parameters which is used to
+construct the message to send, by calling the
+L<Protocol::IRC::Message/new_from_named_args> constructor.
=cut
@@ -655,6 +654,10 @@ send that command.
=head2 do_NOTICE
+ $client->do_PRIVMSG( target => $user_or_channel, text => $message )
+
+ $client->do_NOTICE( target => $user_or_channel, text => $message )
+
Sends a C<PRIVMSG> or C<NOTICE> command.
For convenience, a single C<target> argument may be provided which will be
diff --git a/lib/Protocol/IRC/Message.pm b/lib/Protocol/IRC/Message.pm
index 5bcffa5..564bd53 100644
--- a/lib/Protocol/IRC/Message.pm
+++ b/lib/Protocol/IRC/Message.pm
@@ -3,13 +3,11 @@
#
# (C) Paul Evans, 2008-2016 -- leonerd@leonerd.org.uk
-package Protocol::IRC::Message;
+package Protocol::IRC::Message 0.13;
-use strict;
+use v5.14;
use warnings;
-our $VERSION = '0.12';
-
use Carp;
our @CARP_NOT = qw( Net::Async::IRC );
@@ -108,7 +106,7 @@ sub new
$message = Protocol::IRC::Message->new_from_named_args( $command, %args )
Returns a new C<Protocol::IRC::Message> object, initialised from the given
-named argmuents. The argument names must match those required by the given
+named arguments. The argument names must match those required by the given
command.
=cut
@@ -130,7 +128,7 @@ sub new_from_named_args
next if $idx eq "pn";
defined( my $value = $args{$name} ) or
- croak "$command requires a named argmuent of '$name'";
+ croak "$command requires a named argument of '$name'";
if( $idx =~ m/^\d+$/ ) {
$args[$idx] = $args{$name};
@@ -730,3 +728,15 @@ JOIN | 0=target_name | *join
609=RPL_NOWISAWAY | target_name,ident,host,timestamp,text
671=RPL_WHOISSECURE | target_name,text | -whois
+
+# IRCv3.1's SASL
+# https://ircv3.net/specs/extensions/sasl-3.1
+900=RPL_LOGGEDIN | useridenthost,account,text
+901=RPL_LOGGEDOUT | useridenthost,text
+902=ERR_NICKLOCKED | text
+903=RPL_SASLSUCCESS | text
+904=ERR_SASLFAIL | text
+905=ERR_SASLTOOLONG | text
+906=ERR_SASLABORTED | text
+907=ERR_SASLALREADY | text
+908=ERR_SASLMECHS | text
diff --git a/t/00use.t b/t/00use.t
index d2b7741..ace903b 100644
--- a/t/00use.t
+++ b/t/00use.t
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-use strict;
+use v5.14;
use warnings;
use Test::More;
diff --git a/t/01message.t b/t/01message.t
index 5fb5bca..565b3ba 100644
--- a/t/01message.t
+++ b/t/01message.t
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-use strict;
+use v5.14;
use warnings;
use Test::More;
diff --git a/t/02message-splitprefix.t b/t/02message-splitprefix.t
index 16283a6..376ce45 100644
--- a/t/02message-splitprefix.t
+++ b/t/02message-splitprefix.t
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-use strict;
+use v5.14;
use warnings;
use Test::More;
diff --git a/t/03message-argnames.t b/t/03message-argnames.t
index e78afba..3ab4589 100644
--- a/t/03message-argnames.t
+++ b/t/03message-argnames.t
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-use strict;
+use v5.14;
use warnings;
use Test::More;
diff --git a/t/04message-from-named.t b/t/04message-from-named.t
index 34529f2..76433c5 100644
--- a/t/04message-from-named.t
+++ b/t/04message-from-named.t
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-use strict;
+use v5.14;
use warnings;
use Test::More;
diff --git a/t/10protocol-sendrecv.t b/t/10protocol-sendrecv.t
index c05f2b6..579effc 100644
--- a/t/10protocol-sendrecv.t
+++ b/t/10protocol-sendrecv.t
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-use strict;
+use v5.14;
use warnings;
use Test::More;
@@ -12,6 +12,29 @@ my $written = "";
my @messages;
my $foo_received;
+package TestIRC {
+ use base qw( Protocol::IRC );
+
+ sub new { return bless [], shift }
+
+ sub write { $written .= $_[1] }
+
+ sub on_message
+ {
+ return if $_[3]->{handled};
+ Test::More::is( $_[1], $_[2]->command_name, '$command is $message->command_name' );
+ push @messages, $_[2];
+ return 1;
+ }
+
+ sub on_message_FOO { $foo_received++ }
+
+ sub isupport
+ {
+ return "ascii" if $_[1] eq "CASEMAPPING";
+ }
+}
+
my $irc = TestIRC->new;
$irc->send_message( "USER", undef, "me", "0", "*", "My real name" );
@@ -39,25 +62,3 @@ lives_ok { $irc->on_read( $buffer ) } 'Blank lines does not die';
is( length $buffer, 0, 'Blank lines still eat all buffer' );
done_testing;
-
-package TestIRC;
-use base qw( Protocol::IRC );
-
-sub new { return bless [], shift }
-
-sub write { $written .= $_[1] }
-
-sub on_message
-{
- return if $_[3]->{handled};
- Test::More::is( $_[1], $_[2]->command_name, '$command is $message->command_name' );
- push @messages, $_[2];
- return 1;
-}
-
-sub on_message_FOO { $foo_received++ }
-
-sub isupport
-{
- return "ascii" if $_[1] eq "CASEMAPPING";
-}
diff --git a/t/11protocol-isupport.t b/t/11protocol-isupport.t
index 5a5e5cf..677a28e 100644
--- a/t/11protocol-isupport.t
+++ b/t/11protocol-isupport.t
@@ -1,12 +1,10 @@
#!/usr/bin/perl
-use strict;
+use v5.14;
use warnings;
use Test::More;
-my $irc = TestIRC->new;
-
my %isupport = (
MAXCHANNELS => "10",
NICKLEN => "30",
@@ -22,6 +20,16 @@ my %isupport = (
channame_re => qr/^[#&]/,
);
+package TestIRC {
+ use base qw( Protocol::IRC );
+
+ sub new { return bless [], shift }
+
+ sub isupport { return $isupport{$_[1]} }
+}
+
+my $irc = TestIRC->new;
+
is( $irc->isupport( "MAXCHANNELS" ), "10", 'ISUPPORT MAXCHANNELS is 10' );
is( $irc->isupport( "PREFIX" ), "(ohv)\@\%+", 'ISUPPORT PREFIX is (ohv)@%+' );
@@ -69,10 +77,3 @@ is( $irc->classify_name( "#somewhere" ), "channel", 'classify_name #somewhere' )
is_deeply( $irc->isupport( "chanmodes_list" ), [qw( beI k l imnpsta )], 'ISUPPORT chanmodes_list is [qw( beI k l imnpsta )]' );
done_testing;
-
-package TestIRC;
-use base qw( Protocol::IRC );
-
-sub new { return bless [], shift }
-
-sub isupport { return $isupport{$_[1]} }
diff --git a/t/12protocol-hints.t b/t/12protocol-hints.t
index bdeaddd..8ac7192 100644
--- a/t/12protocol-hints.t
+++ b/t/12protocol-hints.t
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-use strict;
+use v5.14;
use warnings;
use Test::More;
@@ -9,6 +9,40 @@ my $CRLF = "\x0d\x0a"; # because \r\n isn't portable
my @messages;
+package TestIRC {
+ use base qw( Protocol::IRC );
+
+ sub new { return bless [], shift }
+
+ my %isupport = (
+ CHANTYPES => "#&",
+ channame_re => qr/^[#&]/,
+ PREFIX => "(ohv)@%+",
+ prefix_modes => 'ohv',
+ prefix_flags => '@%+',
+ prefixflag_re => qr/^[@%+]/,
+ prefix_map_m2f => { 'o' => '@', 'h' => '%', 'v' => '+' },
+ prefix_map_f2m => { '@' => 'o', '%' => 'h', '+' => 'v' },
+ );
+
+ sub isupport { return $isupport{$_[1]} }
+
+ sub nick { return "MyNick" }
+
+ sub on_message
+ {
+ my $self = shift;
+ my ( $command, $message, $hints ) = @_;
+ # Only care about real events, not synthesized ones
+ return 0 if $hints->{synthesized};
+ # Ignore numerics
+ return 0 if $command =~ m/^\d\d\d$/;
+
+ push @messages, [ $command, $message, $hints ];
+ return $command ne "NOTICE";
+ }
+}
+
my $irc = TestIRC->new;
sub write_irc
{
@@ -196,38 +230,3 @@ sub write_irc
}
done_testing;
-
-package TestIRC;
-use base qw( Protocol::IRC );
-
-sub new { return bless [], shift }
-
-my %isupport;
-BEGIN {
- %isupport = (
- CHANTYPES => "#&",
- channame_re => qr/^[#&]/,
- PREFIX => "(ohv)@%+",
- prefix_modes => 'ohv',
- prefix_flags => '@%+',
- prefixflag_re => qr/^[@%+]/,
- prefix_map_m2f => { 'o' => '@', 'h' => '%', 'v' => '+' },
- prefix_map_f2m => { '@' => 'o', '%' => 'h', '+' => 'v' },
- );
-}
-sub isupport { return $isupport{$_[1]} }
-
-sub nick { return "MyNick" }
-
-sub on_message
-{
- my $self = shift;
- my ( $command, $message, $hints ) = @_;
- # Only care about real events, not synthesized ones
- return 0 if $hints->{synthesized};
- # Ignore numerics
- return 0 if $command =~ m/^\d\d\d$/;
-
- push @messages, [ $command, $message, $hints ];
- return $command ne "NOTICE";
-}
diff --git a/t/13protocol-text.t b/t/13protocol-text.t
index 66e48ad..850befd 100644
--- a/t/13protocol-text.t
+++ b/t/13protocol-text.t
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-use strict;
+use v5.14;
use warnings;
use Test::More;
@@ -12,6 +12,37 @@ my $CRLF = "\x0d\x0a"; # because \r\n isn't portable
my %messages;
my $serverstream;
+package TestIRC {
+ use base qw( Protocol::IRC );
+
+ sub new { return bless [], shift }
+
+ sub write { $serverstream .= $_[1] }
+
+ my %isupport = (
+ CHANTYPES => "#&",
+ channame_re => qr/^[#&]/,
+ PREFIX => "(ohv)@%+",
+ prefix_modes => 'ohv',
+ prefix_flags => '@%+',
+ prefixflag_re => qr/^[@%+]/,
+ prefix_map_m2f => { 'o' => '@', 'h' => '%', 'v' => '+' },
+ prefix_map_f2m => { '@' => 'o', '%' => 'h', '+' => 'v' },
+ );
+
+ sub isupport { return $isupport{$_[1]} }
+
+ sub nick { return "MyNick" }
+
+ sub on_message
+ {
+ my $self = shift;
+ my ( $command, $message, $hints ) = @_;
+ $messages{$command} = [ $message, $hints ];
+ return 1;
+ }
+}
+
my $irc = TestIRC->new;
sub write_irc
{
@@ -322,35 +353,3 @@ $irc->send_ctcpreply( undef, "target", "ACTION", "replies" );
is( $serverstream, "NOTICE target :\001ACTION replies\001$CRLF", 'server stream after send_ctcp' );
done_testing;
-
-package TestIRC;
-use base qw( Protocol::IRC );
-
-sub new { return bless [], shift }
-
-sub write { $serverstream .= $_[1] }
-
-my %isupport;
-BEGIN {
- %isupport = (
- CHANTYPES => "#&",
- channame_re => qr/^[#&]/,
- PREFIX => "(ohv)@%+",
- prefix_modes => 'ohv',
- prefix_flags => '@%+',
- prefixflag_re => qr/^[@%+]/,
- prefix_map_m2f => { 'o' => '@', 'h' => '%', 'v' => '+' },
- prefix_map_f2m => { '@' => 'o', '%' => 'h', '+' => 'v' },
- );
-}
-sub isupport { return $isupport{$_[1]} }
-
-sub nick { return "MyNick" }
-
-sub on_message
-{
- my $self = shift;
- my ( $command, $message, $hints ) = @_;
- $messages{$command} = [ $message, $hints ];
- return 1;
-}
diff --git a/t/14protocol-encoding.t b/t/14protocol-encoding.t
index fed684b..96b4938 100644
--- a/t/14protocol-encoding.t
+++ b/t/14protocol-encoding.t
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-use strict;
+use v5.14;
use warnings;
use utf8;
@@ -14,6 +14,34 @@ my @textmessages;
my @quitmessages;
my $serverstream;
+package TestIRC {
+ use base qw( Protocol::IRC );
+
+ sub new { return bless [], shift }
+
+ sub write { $serverstream .= $_[1] }
+
+ use constant encoder => Encode::find_encoding("UTF-8");
+
+ my %isupport = (
+ CHANTYPES => "#&",
+ channame_re => qr/^[#&]/,
+ PREFIX => "(ohv)@%+",
+ prefix_modes => 'ohv',
+ prefix_flags => '@%+',
+ prefixflag_re => qr/^[@%+]/,
+ prefix_map_m2f => { 'o' => '@', 'h' => '%', 'v' => '+' },
+ prefix_map_f2m => { '@' => 'o', '%' => 'h', '+' => 'v' },
+ );
+
+ sub isupport { return $isupport{$_[1]} }
+
+ sub nick { return "MyNick" }
+
+ sub on_message_text { push @textmessages, [ $_[1], $_[2] ] }
+ sub on_message_QUIT { push @quitmessages, [ $_[1], $_[2] ] }
+}
+
my $irc = TestIRC->new;
sub write_irc
{
@@ -65,32 +93,3 @@ is( $msg->command, "QUIT", '$msg->command for QUIT with encoding' );
is( $hints->{text}, "مرحبا العالم", '$hints->{text} for QUIT with encoding' );
done_testing;
-
-package TestIRC;
-use base qw( Protocol::IRC );
-
-sub new { return bless [], shift }
-
-sub write { $serverstream .= $_[1] }
-
-use constant encoder => Encode::find_encoding("UTF-8");
-
-my %isupport;
-BEGIN {
- %isupport = (
- CHANTYPES => "#&",
- channame_re => qr/^[#&]/,
- PREFIX => "(ohv)@%+",
- prefix_modes => 'ohv',
- prefix_flags => '@%+',
- prefixflag_re => qr/^[@%+]/,
- prefix_map_m2f => { 'o' => '@', 'h' => '%', 'v' => '+' },
- prefix_map_f2m => { '@' => 'o', '%' => 'h', '+' => 'v' },
- );
-}
-sub isupport { return $isupport{$_[1]} }
-
-sub nick { return "MyNick" }
-
-sub on_message_text { push @textmessages, [ $_[1], $_[2] ] }
-sub on_message_QUIT { push @quitmessages, [ $_[1], $_[2] ] }
diff --git a/t/20client.t b/t/20client.t
index ae9ccec..c00a46e 100644
--- a/t/20client.t
+++ b/t/20client.t
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-use strict;
+use v5.14;
use warnings;
use Test::More;
@@ -10,6 +10,23 @@ my $CRLF = "\x0d\x0a"; # because \r\n isn't portable
my @messages;
my @written;
+package TestIRC {
+ use base qw( Protocol::IRC::Client );
+
+ sub new { return bless {}, shift }
+
+ sub nick { return "MyNick" }
+
+ sub on_message
+ {
+ my $self = shift;
+ my ( $command, $message, $hints ) = @_;
+ push @messages, [ $command, $message, $hints ];
+ }
+
+ sub write { $_[1] =~ s/\x0d\x0a$//; push @written, $_[1] }
+}
+
my $irc = TestIRC->new;
sub write_irc
{
@@ -50,19 +67,3 @@ ok( defined $irc, 'defined $irc' );
}
done_testing;
-
-package TestIRC;
-use base qw( Protocol::IRC::Client );
-
-sub new { return bless {}, shift }
-
-sub nick { return "MyNick" }
-
-sub on_message
-{
- my $self = shift;
- my ( $command, $message, $hints ) = @_;
- push @messages, [ $command, $message, $hints ];
-}
-
-sub write { $_[1] =~ s/\x0d\x0a$//; push @written, $_[1] }
diff --git a/t/21client-isupport.t b/t/21client-isupport.t
index 0363d15..0b7311a 100644
--- a/t/21client-isupport.t
+++ b/t/21client-isupport.t
@@ -1,12 +1,18 @@
#!/usr/bin/perl
-use strict;
+use v5.14;
use warnings;
use Test::More;
my $CRLF = "\x0d\x0a"; # because \r\n isn't portable
+package TestIRC {
+ use base qw( Protocol::IRC::Client );
+
+ sub new { return bless {}, shift }
+}
+
my $irc = TestIRC->new;
sub write_irc
{
@@ -39,8 +45,3 @@ is( $irc->prefix_flag2mode( "\@" ), "o", 'prefix_flag2mode @ -> o' );
is_deeply( $irc->isupport( "chanmodes_list" ), [qw( beI k l imnpsta )], 'ISUPPORT chanmodes_list is [qw( beI k l imnpsta )]' );
done_testing;
-
-package TestIRC;
-use base qw( Protocol::IRC::Client );
-
-sub new { return bless {}, shift }
diff --git a/t/22client-chanmodes.t b/t/22client-chanmodes.t
index 4b13496..0399c69 100644
--- a/t/22client-chanmodes.t
+++ b/t/22client-chanmodes.t
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-use strict;
+use v5.14;
use warnings;
use Test::More;
@@ -9,6 +9,21 @@ my $CRLF = "\x0d\x0a"; # because \r\n isn't portable
my @messages;
+package TestIRC {
+ use base qw( Protocol::IRC::Client );
+
+ sub new { return bless {}, shift }
+
+ sub nick { return "MyNick" }
+
+ sub on_message
+ {
+ my $self = shift;
+ my ( $command, $message, $hints ) = @_;
+ push @messages, [ $command, $message, $hints ];
+ }
+}
+
my $irc = TestIRC->new;
sub write_irc
{
@@ -158,17 +173,3 @@ is_deeply( $modes,
'$modes[chanmode] for -lh+o HalfOp FullOp' );
done_testing;
-
-package TestIRC;
-use base qw( Protocol::IRC::Client );
-
-sub new { return bless {}, shift }
-
-sub nick { return "MyNick" }
-
-sub on_message
-{
- my $self = shift;
- my ( $command, $message, $hints ) = @_;
- push @messages, [ $command, $message, $hints ];
-}
diff --git a/t/23client-cap.t b/t/23client-cap.t
index 941103c..0dcca6d 100644
--- a/t/23client-cap.t
+++ b/t/23client-cap.t
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-use strict;
+use v5.14;
use warnings;
use Test::More;
@@ -9,6 +9,19 @@ my $CRLF = "\x0d\x0a"; # because \r\n isn't portable
my @messages;
+package TestIRC {
+ use base qw( Protocol::IRC::Client );
+
+ sub new { return bless {}, shift }
+
+ sub on_message_cap
+ {
+ my $self = shift;
+ my ( $verb, $message, $hints ) = @_;
+ push @messages, [ $verb, $message, $hints ];
+ }
+}
+
my $irc = TestIRC->new;
sub write_irc
{
@@ -32,15 +45,3 @@ is_deeply( $hints->{caps},
'$hints->{caps}' );
done_testing;
-
-package TestIRC;
-use base qw( Protocol::IRC::Client );
-
-sub new { return bless {}, shift }
-
-sub on_message_cap
-{
- my $self = shift;
- my ( $verb, $message, $hints ) = @_;
- push @messages, [ $verb, $message, $hints ];
-}
diff --git a/t/24client-gates.t b/t/24client-gates.t
index b8c303c..7733fde 100644
--- a/t/24client-gates.t
+++ b/t/24client-gates.t
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-use strict;
+use v5.14;
use warnings;
use Test::More;
@@ -10,6 +10,34 @@ my $CRLF = "\x0d\x0a"; # because \r\n isn't portable
my @gates;
my @messages;
+package TestIRC {
+ use base qw( Protocol::IRC::Client );
+
+ use Future;
+
+ sub new { return bless {}, shift }
+
+ sub new_future { return Future->new }
+
+ sub nick { "MyNick" }
+
+ sub on_message
+ {
+ my $self = shift;
+ my ( $command, $message, $hints ) = @_;
+ die "$command MESSAGE UNSYNTHESIZED BUT UNHANLDED" if !$hints->{synthesized} and !$hints->{handled};
+ return 0 unless $hints->{synthesized};
+ push @messages, [ $command, $message, $hints ];
+ return 1;
+ }
+
+ sub on_gate
+ {
+ my $self = shift;
+ push @gates, [ @_ ];
+ }
+}
+
my $irc = TestIRC->new;
sub write_irc
{
@@ -176,30 +204,3 @@ sub write_irc
}
done_testing;
-
-package TestIRC;
-use base qw( Protocol::IRC::Client );
-
-use Future;
-
-sub new { return bless {}, shift }
-
-sub new_future { return Future->new }
-
-sub nick { "MyNick" }
-
-sub on_message
-{
- my $self = shift;
- my ( $command, $message, $hints ) = @_;
- die "$command MESSAGE UNSYNTHESIZED BUT UNHANLDED" if !$hints->{synthesized} and !$hints->{handled};
- return 0 unless $hints->{synthesized};
- push @messages, [ $command, $message, $hints ];
- return 1;
-}
-
-sub on_gate
-{
- my $self = shift;
- push @gates, [ @_ ];
-}
diff --git a/t/25client-commands.t b/t/25client-commands.t
index efa2ef5..db5d246 100644
--- a/t/25client-commands.t
+++ b/t/25client-commands.t
@@ -1,11 +1,20 @@
#!/usr/bin/perl
-use strict;
+use v5.14;
use warnings;
use Test::More;
my @written;
+
+package TestIRC {
+ use base qw( Protocol::IRC::Client );
+
+ sub new { return bless {}, shift }
+
+ sub write { $_[1] =~ s/\x0d\x0a$//; push @written, $_[1] }
+}
+
my $irc = TestIRC->new;
# PRIVMSG
@@ -33,10 +42,3 @@ my $irc = TestIRC->new;
}
done_testing;
-
-package TestIRC;
-use base qw( Protocol::IRC::Client );
-
-sub new { return bless {}, shift }
-
-sub write { $_[1] =~ s/\x0d\x0a$//; push @written, $_[1] }
diff --git a/t/99pod.t b/t/99pod.t
index eb319fb..d1972ce 100644
--- a/t/99pod.t
+++ b/t/99pod.t
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-use strict;
+use v5.14;
use warnings;
use Test::More;