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

  • SEARCH
  • Home
  • 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 620099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:43:37+00:00 2026-05-13T18:43:37+00:00

In a Perl script (with Ubuntu) I’d like to do something like use Blah;

  • 0

In a Perl script (with Ubuntu) I’d like to do something like

    use Blah;
    ...
    ...
    my $response = 
       &Blah::Fetch($URL, {'method'=>'POST', 'parameters' => \%params});

which I’ve written for convenience to look a lot like a Prototype.js ajax call, but obviously we’re using Perl not Javascript, we’re on a server not a browser, and the caller wants to block until we get an answer or timeout back from the remote server. In case of a server or timeout error, defined($response) should be false. If there’s a way to fetch HTTP status that’s nice, but it is enough to know the request failed. It should be able to do either GET or POST.

I know I can do this by using system and wget, but that’s a kludge.

What is the best way to do this task in Perl?

Is there a Perl interface that is nice and tidy?

  • 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-05-13T18:43:37+00:00Added an answer on May 13, 2026 at 6:43 pm

    You can use HTTP::Request

    use HTTP::Request::Common qw(POST); 
    use LWP::UserAgent; 
    
    $ua = LWP::UserAgent->new; 
    $ua->timeout(3); 
    
    my $req = (POST 'http://stackoverflow.com',  
    ["param1" => $var1, 
    "param2" => $var2]); 
    
    $response = $ua->request($req); 
    $content = $response->content; 
    
    exit;
    

    For response elements, see more here: http://kobesearch.cpan.org/htdocs/libwww-perl/HTTP/Request.html

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

Sidebar

Related Questions

I am writing a post-install script for Ubuntu in Perl (same script as seen
I'm writing a perl script and I would really like to get the amount
I have a perl script URL which gives me a ZIP file, it processes
I have a perl script that accepts a long option like --pager='less -R' and
I have a Perl script on a Linux (Ubuntu 8.10) machine and I need
My Perl script needs to run multiple threads simultaneously... use threads ('yield', 'exit' =>
I have a perl script on a linux system that I would like to
I would like to install the Perl modules required by a specific Perl script,
I am using a perl script to POST to Google Appengine application. I post
When I run this Perl script: #!/bin/perl use XML::Bare; $ob = new XML::Bare(text=>'<xml><name>Bob</name></xml>'); for

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.