| 1 | package POE::Component::IRC::Plugin::Validator::HTML; | ||||||||||||||
| 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::WebService::Validator::HTML::W3C; | ||||||||||||
|
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_validator_html', | |||||||||||||
| 14 | trigger => qr/^validate\s+(?=\S)/i, | ||||||||||||||
| 15 | ); | ||||||||||||||
| 16 | } | ||||||||||||||
| 17 | |||||||||||||||
| 18 | 0 | ▶ | sub _make_poco { | ||||||||||||
|
Subroutine
_make_poco: not called CC=1 SCAR=6.9
| |||||||||||||||
| 19 | return POE::Component::WebService::Validator::HTML::W3C->spawn( | ||||||||||||||
| 20 | debug => shift->{debug}, | ||||||||||||||
| 21 | 0 | ); | |||||||||||||
| 22 | } | ||||||||||||||
| 23 | |||||||||||||||
| 24 | 0 | ▶ | sub _make_response_message { | ||||||||||||
|
Subroutine
_make_response_message: not called CC=1 SCAR=6.9
| |||||||||||||||
| 25 | 0 | my $self = shift; | |||||||||||||
| 26 | 0 | my $in_ref = shift; | |||||||||||||
| 27 | 0 | return [ $self->_construct_response($in_ref) ]; | |||||||||||||
| 28 | } | ||||||||||||||
| 29 | |||||||||||||||
| 30 | 0 | ▶ | sub _make_response_event { | ||||||||||||
|
Subroutine
_make_response_event: not called CC=3 SCAR=24.8
| |||||||||||||||
| 31 | 0 | my $self = shift; | |||||||||||||
| 32 | 0 | ▶ | my $in_ref = { %{ shift || {} } }; | ||||||||||||
|
Condition0%0/2
shift() || {}
MC/DC0%0/1
shift() || {}
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||
| 33 | |||||||||||||||
| 34 | $in_ref->{uri_to_results} | ||||||||||||||
| 35 | 0 | = $self->_construct_response( $in_ref, 'just_uri_kplz_and_thank_you' ); | |||||||||||||
| 36 | |||||||||||||||
| 37 | $in_ref->{ $_ } = delete $in_ref->{"_$_"} | ||||||||||||||
| 38 | 0 | for qw( who channel message type ); | |||||||||||||
| 39 | |||||||||||||||
| 40 | 0 | return $in_ref; | |||||||||||||
| 41 | } | ||||||||||||||
| 42 | |||||||||||||||
| 43 | 0 | ▶ | sub _make_poco_call { | ||||||||||||
|
Subroutine
_make_poco_call: not called CC=1 SCAR=6.9
| |||||||||||||||
| 44 | 0 | my $self = shift; | |||||||||||||
| 45 | 0 | my $data_ref = shift; | |||||||||||||
| 46 | |||||||||||||||
| 47 | $self->{poco}->validate( { | ||||||||||||||
| 48 | event => '_poco_done', | ||||||||||||||
| 49 | in => delete $data_ref->{what}, | ||||||||||||||
| 50 | 0 | map +( "_$_" => $data_ref->{$_} ), | |||||||||||||
| 51 | keys %$data_ref, | ||||||||||||||
| 52 | } | ||||||||||||||
| 53 | ); | ||||||||||||||
| 54 | } | ||||||||||||||
| 55 | |||||||||||||||
| 56 | 0 | ▶ | sub _construct_response { | ||||||||||||
|
Subroutine
_construct_response: not called CC=3 SCAR=24.8
| |||||||||||||||
| 57 | 0 | my ( $self, $in_ref, $is_only_uri ) = @_; | |||||||||||||
| 58 | |||||||||||||||
| 59 | 0 | my $uri = URI->new( $in_ref->{validator_uri} ); | |||||||||||||
| 60 | $uri->query_form( | ||||||||||||||
| 61 | uri => $in_ref->{in}, | ||||||||||||||
| 62 | 0 | doctype => 'Inline', | |||||||||||||
| 63 | group => '0', | ||||||||||||||
| 64 | No200 => 1, | ||||||||||||||
| 65 | verbose => 1, | ||||||||||||||
| 66 | ); | ||||||||||||||
| 67 | |||||||||||||||
| 68 | 0 | ▶ | if ( $is_only_uri ) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 69 | 0 | return $uri; | |||||||||||||
| 70 | } | ||||||||||||||
| 71 | elsif ( not $in_ref->{num_errors} ) { | ||||||||||||||
| 72 | 0 | return "Valid ( $uri )"; | |||||||||||||
| 73 | } | ||||||||||||||
| 74 | else { | ||||||||||||||
| 75 | 0 | return "Invalid ($in_ref->{num_errors} errors) See: $uri"; | |||||||||||||
| 76 | } | ||||||||||||||
| 77 | } | ||||||||||||||
| 78 | |||||||||||||||
| 79 | 1 | 1; | |||||||||||||
| 80 | |||||||||||||||
| 81 | __END__ | ||||||||||||||