| 1 | package Net::Curl::Promiser::LoopBase; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | =encoding utf-8 | ||
| 7 | |||
| 8 | =head1 NAME | ||
| 9 | |||
| 10 | Net::Curl::Promiser::LoopBase - base class for event-loop-based implementations | ||
| 11 | |||
| 12 | =head1 INVALID METHODS | ||
| 13 | |||
| 14 | The following methods from L<Net::Curl::Promiser> are unneeded in instances | ||
| 15 | of this class and thus produce an exception if called: | ||
| 16 | |||
| 17 | =over | ||
| 18 | |||
| 19 | =item C<process()> | ||
| 20 | |||
| 21 | =item C<time_out()> | ||
| 22 | |||
| 23 | =item C<get_timeout()> | ||
| 24 | |||
| 25 | =back | ||
| 26 | |||
| 27 | =head1 TODO | ||
| 28 | |||
| 29 | This is a rather hacky way accomplish this. Refactor it to be more-better. | ||
| 30 | |||
| 31 | Also incorporate the copy-pasted timeout logic from subclasses. | ||
| 32 | |||
| 33 | =cut | ||
| 34 | |||
| 35 | #---------------------------------------------------------------------- | ||
| 36 | |||
| 37 | use parent qw( Net::Curl::Promiser ); | ||
| 38 | |||
| 39 | *_process_in_loop = __PACKAGE__->can('SUPER::process'); | ||
| 40 | *_time_out_in_loop = __PACKAGE__->can('SUPER::time_out'); | ||
| 41 | |||
| 42 | sub process { die 'Unneeded method: ' . (caller 0)[3] }; | ||
| 43 | sub get_timeout { die 'Unneeded method: ' . (caller 0)[3] }; | ||
| 44 | sub time_out { die 'Unneeded method: ' . (caller 0)[3] }; | ||
| 45 | |||
| 46 | sub _GET_FD_ACTION { | ||
| 47 | return +{ @{ $_[1] } }; | ||
| 48 | } | ||
| 49 | |||
| 50 | 1; |