From: Marius Gavrilescu Date: Sat, 7 Jun 2014 19:51:19 +0000 (+0300) Subject: Reindent X-Git-Tag: 0.001002~4 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=9e1acbcb35f4ab7384e05ad9dd5fefab54739f76;p=poe-component-irc-plugin-hello.git Reindent --- diff --git a/Makefile.PL b/Makefile.PL index 19cc118..13f7584 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -2,19 +2,19 @@ use 5.014000; use ExtUtils::MakeMaker; WriteMakefile( - NAME => 'POE::Component::IRC::Plugin::Hello', - VERSION_FROM => 'lib/POE/Component/IRC/Plugin/Hello.pm', + NAME => 'POE::Component::IRC::Plugin::Hello', + VERSION_FROM => 'lib/POE/Component/IRC/Plugin/Hello.pm', ABSTRACT_FROM => 'lib/POE/Component/IRC/Plugin/Hello.pm', AUTHOR => 'Marius Gavrilescu ', MIN_PERL_VERSION => 5.014000, LICENSE => 'perl', SIGN => 1, - PREREQ_PM => { - 'List::Util' => 0, - 'IRC::Utils' => 0, - 'POE::Component::IRC::Plugin' => 0, + PREREQ_PM => { + 'List::Util' => 0, + 'IRC::Utils' => 0, + 'POE::Component::IRC::Plugin' => 0, }, BUILD_REQUIRES => { - 'Test::MockObject' => 1.09, + 'Test::MockObject' => 1.09, }, ); diff --git a/lib/POE/Component/IRC/Plugin/Hello.pm b/lib/POE/Component/IRC/Plugin/Hello.pm index 90c14f1..a5770aa 100644 --- a/lib/POE/Component/IRC/Plugin/Hello.pm +++ b/lib/POE/Component/IRC/Plugin/Hello.pm @@ -11,32 +11,32 @@ use IRC::Utils qw/parse_user/; use POE::Component::IRC::Plugin qw/PCI_EAT_NONE/; sub new { - my $class = shift; - my $self = { - greetings => [qw/privet hello salut salutari neata neaţa hola hey hi bonjour wassup sup hallo chikmaa tungjatjeta parev salam namaskaar mingalarba ahoy saluton allo moin aloha namaste shalom ciào ciao servus salve ave merhaba witaj hei hola selam sawubona/, "what's up", 'que tal', 'こんにちは', '你好', 'ni hao'], - @_ - }; + my $class = shift; + my $self = { + greetings => [qw/privet hello salut salutari neata neaţa hola hey hi bonjour wassup sup hallo chikmaa tungjatjeta parev salam namaskaar mingalarba ahoy saluton allo moin aloha namaste shalom ciào ciao servus salve ave merhaba witaj hei hola selam sawubona/, "what's up", 'que tal', 'こんにちは', '你好', 'ni hao'], + @_ + }; - bless $self, $class + bless $self, $class } sub PCI_register { - my ($self, $irc) = @_; - $irc->plugin_register($self, SERVER => qw/public/); - 1 + my ($self, $irc) = @_; + $irc->plugin_register($self, SERVER => qw/public/); + 1 } sub PCI_unregister { 1 } sub S_public{ - my ($self, $irc, $rfullname, $rchannels, $rmessage) = @_; - my $nick = parse_user $$rfullname; - my $mynick = $irc->nick_name; - my @hello = @{$self->{greetings}}; - - my $match = first { $$rmessage =~ /^\s*(?:$mynick(?:)[:,])?\s*$_\s*$/i } @hello; - $irc->yield(privmsg => $$rchannels->[0] => $hello[int rand $#hello].", $nick") if $match; - PCI_EAT_NONE + my ($self, $irc, $rfullname, $rchannels, $rmessage) = @_; + my $nick = parse_user $$rfullname; + my $mynick = $irc->nick_name; + my @hello = @{$self->{greetings}}; + + my $match = first { $$rmessage =~ /^\s*(?:$mynick(?:)[:,])?\s*$_\s*$/i } @hello; + $irc->yield(privmsg => $$rchannels->[0] => $hello[int rand $#hello].", $nick") if $match; + PCI_EAT_NONE } 1; diff --git a/t/POE-Component-IRC-Plugin-Hello.t b/t/POE-Component-IRC-Plugin-Hello.t index ebb2ef5..dab4d9c 100644 --- a/t/POE-Component-IRC-Plugin-Hello.t +++ b/t/POE-Component-IRC-Plugin-Hello.t @@ -18,10 +18,10 @@ my $channels = [ '#chan' ]; # Sub setup sub runtest{ - my ($message, $expect, $comment) = @_; - $hello_sent=0; - $self->S_public($mockirc, \'mgv!marius@ieval.ro', \$channels, \$message); - ok($hello_sent == $expect, $comment) + my ($message, $expect, $comment) = @_; + $hello_sent=0; + $self->S_public($mockirc, \'mgv!marius@ieval.ro', \$channels, \$message); + ok($hello_sent == $expect, $comment) } #Tests