Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Program unexpectedly terminates

by tobyink (Abbot)
on Nov 19, 2012 at 09:29 UTC ( #1004499=note: print w/replies, xml ) Need Help??

in reply to Program unexpectedly terminates

It would be helpful if the sample code you provided actually compiled (undefined $class, %args and &shuffle prevents compilation with strict subs/vars). Fixing those issues...

#!/usr/bin/env perl use 5.016; use warnings; use Carp::Always; BEGIN { *CORE::GLOBAL::exit = sub { die("exit called") } } END { say "END block"; } my $crawler = Crawler->new; $crawler->run; die("finished"); package Crawler { use parent 'LWP::UserAgent'; use List::Util qw(shuffle); sub new { my ($class, %args) = @_; my $self = $class->SUPER::new(%args); $self->{ids} = [1..100]; 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" } }

... the code seems to execute correctly here.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Replies are listed 'Best First'.
Re^2: Program unexpectedly terminates
by Anonymous Monk on Nov 19, 2012 at 09:35 UTC
    Thanks for the helpful contribution Mr. Pedantic :-P

      Thank you for providing code that neither compiles nor illustrates your problem Mr Anonymous.

      perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1004499]
[Corion]: marto: Heh - currently they seem promising, but I think I'll stay with nVidia+Intel for the time being, as I've been bitten too often by bad AMD drivers
Discipulus is (still?) not a big fan of notepad++
[marto]: Corion, I think in the past this was a big problem for them. GPU driver wise the improve all the time. I use the open source drivers on my machine (old R9 270, 2GB) and had no problems
[Discipulus]: is not the problem with new hardware?
[marto]: notepad++ ticks all the boxes for me, it's a fine line between just enough, and bloat, in editors for me :P
[marto]: Discipulus]: less so than the modern intel CPUs
[marto]: also, AMD are faster at fixing the CPU microcode it would seem

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (8)
As of 2017-07-27 08:58 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (407 votes). Check out past polls.