File Coverage

blib/lib/POE/Component/Syntax/Highlight/CSS.pm
Criterion Covered Total %
statement 18 30 60.0
branch 0 10 0.0
condition 0 3 0.0
subroutine 6 9 66.6
pod 1 1 100.0
total 25 53 47.1


line stmt bran cond sub pod time code
1             package POE::Component::Syntax::Highlight::CSS;
2              
3 1     1   288414 use warnings;
  1         2  
  1         30  
4 1     1   5 use strict;
  1         2  
  1         53  
5              
6             our $VERSION = '1.001004'; # VERSION
7              
8 1     1   4 use POE;
  1         3  
  1         6  
9 1     1   354 use base 'POE::Component::NonBlockingWrapper::Base';
  1         2  
  1         117  
10 1     1   15 use Syntax::Highlight::CSS;
  1         3  
  1         21  
11 1     1   6 use LWP::UserAgent;
  1         2  
  1         323  
12              
13             sub _methods_define {
14 0     0     return ( parse => '_wheel_entry' );
15             }
16              
17             sub parse {
18 0     0 1   $poe_kernel->post( shift->{session_id} => parse => @_ );
19             }
20              
21             sub _process_request {
22 0     0     my ( $self, $in_ref ) = @_;
23 0 0         my $obj = Syntax::Highlight::CSS->new(
    0          
24             ( defined $in_ref->{nnn} ? ( nnn => $in_ref->{nnn} ) : () ),
25             ( defined $in_ref->{pre} ? ( pre => $in_ref->{pre} ) : () ),
26             );
27              
28 0 0         if ( $in_ref->{uri} ) {
29 0 0         $in_ref->{uri} =~ m{^(?:ht|f)tps?://}
30             or $in_ref->{uri} = "http://$in_ref->{uri}";
31              
32 0   0       my $ua = $self->{ua} || LWP::UserAgent->new( timeout => 30, agent => 'Opera 9.5' );
33 0           my $response = $ua->get( $in_ref->{uri} );
34              
35 0 0         if ( $response->is_success ) {
36 0           $in_ref->{out} = $obj->parse( $response->content );
37             }
38             else {
39 0           $in_ref->{error} = $response->status_line;
40             }
41             }
42             else {
43 0           $in_ref->{out} = $obj->parse( $in_ref->{in} );
44             }
45             }
46              
47             1;
48             __END__