| 1 | package POE::Component::IRC::Plugin::BrowserSupport; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | our $VERSION = '2.001004'; # VERSION | |||||||||
| 7 | |||||||||||
| 8 | 1 | ▶ | use POE::Component::WWW::WebDevout::BrowserSupportInfo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use base 'POE::Component::IRC::Plugin::BasePoCoWrap'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 0 | ▶ | sub _make_default_args { | ||||||||
|
Subroutine
_make_default_args: not called CC=1 SCAR=6.9
| |||||||||||
| 12 | return ( | ||||||||||
| 13 | 0 | response_event => 'irc_webdevout_support', | |||||||||
| 14 | trigger => qr/^support\s+(?=\S)/i, | ||||||||||
| 15 | ); | ||||||||||
| 16 | } | ||||||||||
| 17 | |||||||||||
| 18 | 0 | ▶ | sub _make_poco { | ||||||||
|
Subroutine
_make_poco: not called CC=2 SCAR=17.9
| |||||||||||
| 19 | 0 | my $self = shift; | |||||||||
| 20 | return POE::Component::WWW::WebDevout::BrowserSupportInfo->spawn( | ||||||||||
| 21 | debug => $self->{debug}, | ||||||||||
| 22 | 0 | ▶ | exists $self->{obj_args} ? ( obj_args => $self->{obj_args} ) : (), | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | ); | ||||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | 0 | ▶ | sub _make_response_message { | ||||||||
|
Subroutine
_make_response_message: not called CC=3 SCAR=24.8
| |||||||||||
| 27 | 0 | my $self = shift; | |||||||||
| 28 | 0 | my $in_ref = shift; | |||||||||
| 29 | 0 | my $what = substr $in_ref->{what}, 0, 10; | |||||||||
| 30 | 0 | ▶ | if ( exists $in_ref->{error} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | 0 | return [ "($what) Error: $in_ref->{error}" ]; | |||||||||
| 32 | } | ||||||||||
| 33 | else { | ||||||||||
| 34 | my $results = join ' | ', | ||||||||||
| 35 | 0 | map { "$_: ${\(defined $in_ref->{results}{$_} | |||||||||
| 36 | 0 | ▶ | ? $in_ref->{results}{$_} : '')}" | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | 0 | } sort keys %{ $in_ref->{results} }; | |||||||||
| 38 | |||||||||||
| 39 | 0 | return [ "($what) $in_ref->{uri_info} $results" ]; | |||||||||
| 40 | }; | ||||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | 0 | ▶ | sub _make_response_event { | ||||||||
|
Subroutine
_make_response_event: not called CC=2 SCAR=17.9
| |||||||||||
| 44 | 0 | my $self = shift; | |||||||||
| 45 | 0 | my $in_ref = shift; | |||||||||
| 46 | |||||||||||
| 47 | return { | ||||||||||
| 48 | uri_info => $in_ref->{uri_info}, | ||||||||||
| 49 | what => $in_ref->{what}, | ||||||||||
| 50 | ( exists $in_ref->{error} | ||||||||||
| 51 | ? ( error => $in_ref->{error} ) | ||||||||||
| 52 | : ( results => $in_ref->{results} ) | ||||||||||
| 53 | ), | ||||||||||
| 54 | 0 | ▶ | map { $_ => $in_ref->{"_$_"} } | ||||||||
|
Branch: 1 branch
| |||||||||||
| 55 | qw( who channel message type ), | ||||||||||
| 56 | } | ||||||||||
| 57 | } | ||||||||||
| 58 | |||||||||||
| 59 | 0 | ▶ | sub _make_poco_call { | ||||||||
|
Subroutine
_make_poco_call: not called CC=1 SCAR=6.9
| |||||||||||
| 60 | 0 | my $self = shift; | |||||||||
| 61 | 0 | my $data_ref = shift; | |||||||||
| 62 | |||||||||||
| 63 | $self->{poco}->fetch( { | ||||||||||
| 64 | event => '_poco_done', | ||||||||||
| 65 | what => delete $data_ref->{what}, | ||||||||||
| 66 | 0 | map +( "_$_" => $data_ref->{$_} ), | |||||||||
| 67 | keys %$data_ref, | ||||||||||
| 68 | } | ||||||||||
| 69 | ); | ||||||||||
| 70 | } | ||||||||||
| 71 | |||||||||||
| 72 | 1 | 1; | |||||||||
| 73 | __END__ | ||||||||||