WWW::Crawler::Mojo::Job - Single crawler job
my $job1 = WWW::Crawler::Mojo::Job->new; $job1->url('http://example.com/'); my $job2 = $job1->child;
This class represents a single crawler job.
A flag that the job has been closed or not.
$job->closed(1); say $job->closed;
The depth of job in referrer series.
my $job1 = WWW::Crawler::Mojo::Job->new; my $job2 = $job1->child; my $job3 = $job2->child; say $job1->depth; # 0 say $job2->depth; # 1 say $job3->depth; # 2
A Mojo::URL instance of the literal URL that has appeared in the referrer document.
$job1->literal_uri('./index.html'); say $job1->literal_uri; # './index.html'
A Mojo::URL instance of the resolved URL. Use url instead.
$job1->resolved_uri('http://example.com/'); say $job1->resolved_uri; # 'http://example.com/'
A job instance that has referred the URL.
$job1->referrer($job); my $job2 = $job1->referrer;
An array reference that contains URLs of redirect history.
$job1->redirect_history([$url1, $url2, $url3]); my $history = $job1->redirect_history;
A Mojo::URL instance of the resolved URL.
$job1->url('http://example.com/'); say $job1->url; # 'http://example.com/'
HTTP request method such as get or post.
$job1->method('GET'); say $job1->method; # GET
A hash reference that contains params for Mojo::Transaction.
$job1->tx_params({foo => 'bar'}); $params = $job1->tx_params;
A Mojo::URL instance for referrer URL.
$job->referrer_url($url); say $job->referrer_url;
Clones the job.
my $job2 = $job1->clone;
Close the job and cut the referrer series.
$job->close;
Instantiate a child job by parent job. The parent uri is set to child referrer.
my $job1 = WWW::Crawler::Mojo::Job->new(url => 'http://a/1'); my $job2 = $job1->child(url => 'http://a/2'); say $job2->referrer->url # 'http://a/1'
Generate digest string with url, method, tx_params attributes.
say $job->digest;
Replaces the resolved URL and history at once.
my $job = WWW::Crawler::Mojo::Job->new; $job->url($url1); $job->redirect($url2, $url3); say $job->url # $url2 say $job->redirect_history # [$url1, $url3]
An alias for original_url.
Returns the original URL of redirected job. If redirected, returns last element of redirect_histroy attribute, otherwise returns url attribute.
$job1->redirect_history([$url1, $url2, $url3]); my $url4 = $job1->original_url; # $url4 is $url3
Instanciate a job with string or a Mojo::URL instance.
Sugama Keita, <sugama@jamadam.com>
Copyright (C) Sugama Keita.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install WWW::Crawler::Mojo, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Crawler::Mojo
CPAN shell
perl -MCPAN -e shell install WWW::Crawler::Mojo
For more information on module installation, please visit the detailed CPAN module installation guide.