Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/env perl use 5.016; use warnings; use Carp::Always; BEGIN { *CORE::GLOBAL::exit = sub { die } } END { say "END block"; } my $crawler = Crawler->new; $crawler->run; die; package Crawler { use parent 'LWP::UserAgent'; # use a bunch of other modules for the processing. sub new { my $self = $class->SUPER::new(%args); $self->{ids} = (1..100); # These normally are pulled from a D +B. return $self; } sub run { my $self = shift; my @idx = shuffle 0 .. -1 + @{ $self->{ids} }; my $cur = 0; for my $i (@idx) { my $id = $self->{ids}[$i]; printf "%d/%d: %s (%d)\n", ++$cur, 0+@idx, $id, $i; # Fetch and process stuff related to this id. } } sub DESTROY { say "Crawler destroyed" } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Program unexpectedly terminates
by tobyink (Canon) on Nov 19, 2012 at 09:29 UTC | |
| |
|
Re: Program unexpectedly terminates
by ColonelPanic (Friar) on Nov 19, 2012 at 08:31 UTC | |
by Anonymous Monk on Nov 19, 2012 at 08:48 UTC | |
by ColonelPanic (Friar) on Nov 19, 2012 at 09:09 UTC | |
by Anonymous Monk on Nov 19, 2012 at 09:20 UTC | |
by ColonelPanic (Friar) on Nov 19, 2012 at 09:56 UTC | |
| |
|
Re: Program unexpectedly terminates
by aitap (Curate) on Nov 19, 2012 at 14:37 UTC | |
|
Re: Program unexpectedly terminates
by Anonymous Monk on Nov 19, 2012 at 12:40 UTC | |
|
Re: Program unexpectedly terminates
by Anonymous Monk on Nov 19, 2012 at 19:03 UTC |