Hi,
I am optimizing a mod_perl handler that scrapes dynamically generated web
pages using WWW:Mechanize :-
sub handler {
my ($self, @urls) = @_;
...
my $m = WWW:Mechanize->new();
foreach my $url(@urls) {
$m->get($url); # 3+ seconds
...
}
}
Due to the Apache's prefork environment, forking/threading are not options.
Does mod_perl under Apache's prefork allow this instead :-
sub handler {
my ($self, @urls) = @_;
...
foreach my $url(@urls) {
$ua->get($url => sub { my ($ua, $tx) =
@_;
say $tx->res->body; });
...
}
Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
}
If this is allowed, does this non blocking page fetch interfere with mod_perl's
request processing in any way?
Redirected from here: http://www.perlmonks.org/?node_id=1088581
Thanks,
Himanshu
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.