| 1 | package POE::Component::WebService::HtmlKitCom::FavIconFromImage; | ||
| 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 | our $VERSION = '2.001002'; # VERSION | ||
| 7 | |||
| 8 | 1 | ▶ | use Carp; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 1 | ▶ | use POE; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 0 | ▶ | use WebService::HtmlKitCom::FavIconFromImage; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 11 | use base 'POE::Component::NonBlockingWrapper::Base'; | ||
| 12 | |||
| 13 | sub _methods_define { | ||
| 14 | return ( favicon => '_wheel_entry' ); | ||
| 15 | } | ||
| 16 | |||
| 17 | sub favicon { | ||
| 18 | $poe_kernel->post( shift->{session_id} => favicon => @_ ); | ||
| 19 | } | ||
| 20 | |||
| 21 | sub _prepare_wheel { | ||
| 22 | my $self = shift; | ||
| 23 | $self->{_obj} = WebService::HtmlKitCom::FavIconFromImage->new( | ||
| 24 | %{ $self->{obj_args} || {} } | ||
| 25 | ); | ||
| 26 | } | ||
| 27 | |||
| 28 | sub _check_args { | ||
| 29 | my ( $self, $args_ref ) = @_; | ||
| 30 | |||
| 31 | unless ( defined $args_ref->{image} ) { | ||
| 32 | carp 'Missing `image` argument'; | ||
| 33 | return; | ||
| 34 | } | ||
| 35 | |||
| 36 | return 1; | ||
| 37 | } | ||
| 38 | |||
| 39 | sub _process_request { | ||
| 40 | my ( $self, $in_ref ) = @_; | ||
| 41 | my @fav_args; | ||
| 42 | |||
| 43 | for ( qw(image text animate file) ) { | ||
| 44 | push @fav_args, $_, $in_ref->{$_} | ||
| 45 | if exists $in_ref->{$_}; | ||
| 46 | } | ||
| 47 | |||
| 48 | my $response = $self->{_obj}->favicon('', @fav_args ); | ||
| 49 | |||
| 50 | if ( $response ) { | ||
| 51 | $in_ref->{response} = $response; | ||
| 52 | } else { | ||
| 53 | $in_ref->{error} = $self->{_obj}->error; | ||
| 54 | } | ||
| 55 | } | ||
| 56 | |||
| 57 | 1; | ||
| 58 | __END__ | ||