« TaskPipe/UserAgentManager/UserAgentHandler/Settings.pm
↑ Summary
TaskPipe/WhoisManager/Settings.pm »
| 1 | package TaskPipe::UserAgentManager::UserAgentHandler_PhantomJS::Settings; | ||
| 2 | |||
| 3 | use Moose; | ||
| 4 | |||
| 5 | =head1 NAME | ||
| 6 | |||
| 7 | TaskPipe::UserAgentManager::UserAgentHandler_PhantomJS::Settings | ||
| 8 | |||
| 9 | =head1 DESCRIPTION | ||
| 10 | |||
| 11 | Settings for the PhantomJS useragent handler | ||
| 12 | |||
| 13 | =head1 METHODS | ||
| 14 | |||
| 15 | =over | ||
| 16 | |||
| 17 | =item process_name | ||
| 18 | |||
| 19 | The name to call the PhantomJS process on the database | ||
| 20 | |||
| 21 | =cut | ||
| 22 | |||
| 23 | has process_name => (is => 'ro', isa => 'Str', default => 'phantomjs'); | ||
| 24 | |||
| 25 | |||
| 26 | =item base_port | ||
| 27 | |||
| 28 | Allocate ports from this port number upwards | ||
| 29 | |||
| 30 | =cut | ||
| 31 | |||
| 32 | has base_port => (is => 'ro', isa => 'Int', default => 8910); | ||
| 33 | |||
| 34 | |||
| 35 | =item proxy_schemes | ||
| 36 | |||
| 37 | How to convert a proxy scheme (as used by LWP) to a proxy 'type' (as used by PhantomJS) | ||
| 38 | |||
| 39 | =cut | ||
| 40 | |||
| 41 | has proxy_schemes => (is => 'ro', isa => 'HashRef[Str]', default => sub{{ | ||
| 42 | socks => 'socks5', | ||
| 43 | http => 'http', | ||
| 44 | https => 'http' | ||
| 45 | }}); | ||
| 46 | |||
| 47 | =item page_load_wait_time | ||
| 48 | |||
| 49 | PhantomJS does wait for the general page to load, but doesn't seem to wait for ajax requests to return. This can be problematic. A crude solution is to wait a fixed length of time upon page load. Set this option to do that. However, using the poll_for method is a preferable solution where possible. (See the docs for TaskPipe::Task_Scrape | ||
| 50 | |||
| 51 | =cut | ||
| 52 | |||
| 53 | has page_load_wait_time => (is => 'ro', isa => 'Int', default => 0); | ||
| 54 | |||
| 55 | =item poll_for_interval | ||
| 56 | |||
| 57 | When using C<poll_for>, this is the period between checking if the element is present (in milliseconds) | ||
| 58 | |||
| 59 | =cut | ||
| 60 | |||
| 61 | has poll_for_interval => (is => 'ro', isa => 'Int', default => 300); | ||
| 62 | |||
| 63 | |||
| 64 | =item poll_for_timeout | ||
| 65 | |||
| 66 | When using C<poll_for> this is the maximum length of time to poll for before giving up | ||
| 67 | |||
| 68 | =cut | ||
| 69 | |||
| 70 | has poll_for_timeout => (is => 'ro', isa => 'Int', default => 30000); | ||
| 71 | |||
| 72 | |||
| 73 | =item debug | ||
| 74 | |||
| 75 | If set to 1, messages from PhantomJS will be echoed to the terminal | ||
| 76 | |||
| 77 | =back | ||
| 78 | |||
| 79 | =head1 AUTHOR | ||
| 80 | |||
| 81 | Tom Gracey <tomgracey@gmail.com> | ||
| 82 | |||
| 83 | =head1 COPYRIGHT AND LICENSE | ||
| 84 | |||
| 85 | Copyright (c) Tom Gracey 2018 | ||
| 86 | |||
| 87 | TaskPipe is free software, licensed under | ||
| 88 | |||
| 89 | The GNU Public License Version 3 | ||
| 90 | |||
| 91 | =cut | ||
| 92 | |||
| 93 | has debug => (is => 'ro', isa => 'Bool', default => 0); | ||
| 94 | |||
| 95 | __PACKAGE__->meta->make_immutable; | ||
| 96 | 1; | ||
| 97 |