Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7945585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:54:37+00:00 2026-06-04T00:54:37+00:00

I am using Perl library HTTP::Async as follows: use strict; use warnings; use HTTP::Async;

  • 0

I am using Perl library HTTP::Async as follows:

use strict;
use warnings;
use HTTP::Async;
use Time::HiRes;
...
my $async = HTTP::Async->new( ... );
my $request = HTTP::Request->new( GET => $url );
my $start = [Time::HiRes::gettimeofday()];
my $id = $async->add($request);
my $response = undef;
while (!$response) {
  $response = $async->wait_for_next_response(1);
  last if Time::HiRes::tv_interval($start) > TIME_OUT; 
}
...

When while loop timeout and script ends, I experience the the following error message:

HTTP::Async object destroyed but still in use at script.pl line 0
HTTP::Async INTERNAL ERROR: 'id_opts' not empty at script.pl line 0

What are my options? How can I “clean-up” HTTP::Async object if still in use, but not needed anymore?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T00:54:39+00:00Added an answer on June 4, 2026 at 12:54 am

    I would suggest that you remove incomplete requests, but the module does not provide any interface to do so.


    Option 1: Add removal functionality.

    Add the following to your script:

    BEGIN {
        require HTTP::Async;
        package HTTP::Async;
    
        if (!defined(&remove)) {
            *remove = sub {
                my ($self, $id) = @_;
    
                my $hashref = $self->{in_progress}{$id}
                    or return undef;
    
                my $s = $hashref->{handle};
                $self->_io_select->remove($s);
                delete $self->{fileno_to_id}{ $s->fileno };
                delete $self->{in_progress}{$id};
                delete $self->{id_opts}{$id};
    
                return $hashref->{request};
            };
        }
    
        if (!defined(&remove_all)) {
            *remove_all = sub {
                my ($self) = @_;
                return map $self->remove($_), keys %{ $self->{in_progress} };
            };
        }
    }
    

    You should contact the author and see if he can add this feature. $id is the value returned by add.


    Option 2: Silence all warnings from the destructor.

    If you’re ok with not servicing all the requests, there’s no harm in silencing the warnings. You can do so as follows:

    use Sub::ScopeFinalizer qw( scope_finalizer );
    
    my $async = ...;
    my $anchor = scope_finalizer {
        local $SIG{__WARN__} = sub { };
        $async = undef;
    };
    ...
    

    Note that this will silence all warnings that occur during the object’s destruction, so I don’t like this as much.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to avoid using Net::SSH::Perl library since there is some problems in
I have been using Perl for some time, but today I came across this
I am writing some Selenium RC tests using the perl library WWW::Selenium. At the
I'm using the Statistics::Descriptive library in Perl to calculate frequency distributions and coming up
I am struggling to get some SOAP request working using SOAP Ligth and PHP
I am trying to use threads in Perl, but I get the following errors
Using Perl, how do I check if a particular Windows process is running or
I am using Perl to do text processing with regex. I have no control
I am using Perl to convert some XML to JSON. If the XML attribute
Replacing the Special Character using Perl while i am doing this . I got

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.