View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Lindolfo Rodrigues de Oliveira Neto > LWP-Curl-0.14 > LWP::Curl



Annotate this POD


Open  0
View/Report Bugs
Module Version: 0.14   Source  


LWP::Curl - LWP methods implementation with Curl engine


Version 0.14


  use LWP::Curl;
  my $lwpcurl = LWP::Curl->new();
  my $content = $lwpcurl->get('',''); 
  # get the page passing with referer


LWP::Curl provides an interface similar to the LWP library, but is built on top of the Curl library. The simple LWP-style interface means you don't have to know anything about the underlying library.

Constructor ^


Creates and returns a new LWP::Curl object, hereafter referred to as the "lwpcurl".

    my $lwpcurl = LWP::Curl->new()



Get content of $url, passing $referer if defined.

    use LWP::Curl;
        my $referer = '';
        my $get_url = '';
    my $lwpcurl = LWP::Curl->new();
        my $content = $lwpcurl->get($get_url, $referer); 

The get method croak()'s if the request fails, so wrap an eval around it if you want to handle failure more elegantly.


POST the $hash_form fields in $url, passing $referer if defined:

  use LWP::Curl;
  my $lwpcurl = LWP::Curl->new();
  my $referer = '';
  my $post_url = '';
  my $hash_form = { 
    'field1' => 'value1',
    'field2' => 'value2',
  my $content = $lwpcurl->post($post_url, $hash_form, $referer); 


Set the timeout to use for all subsequent requests, in seconds. Defaults to 180 seconds.


Turn on/off auto_encode.


Sets the user agent string to the expanded version from a table of actual user strings. $alias can be one of the following:

then it will be replaced with a more interesting one. For instance,

  $lwpcurl->agent_alias( 'Windows IE 6' );

sets your User-Agent to

  Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)


Set the proxy in the constructor, $proxyurl will be like:

libcurl respects the environment variables http_proxy, ftp_proxy, all_proxy etc, if any of those are set. The $lwpcurl->proxy option does however override any possibly set environment variables.

To disable proxy set $lwpcurl->proxy('');

$lwpcurl->proxy without argument, return the current proxy


This is a small list of features I'm plan to add. Feel free to contribute with your wishlist and comentaries!


Lindolfo Rodrigues de Oliveira Neto, <lorn at>


Please report any bugs or feature requests to bug-lwp-curl at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc LWP::Curl

You can also look for information at:


Thanks to Breno G. Oliveira for the great tips. Thanks for the LWP and WWW::Mechanize for the inspiration. Thanks for Neil Bowers for the patches Thanks for Mark Allen for the patches


Copyright 2009 Lindolfo Rodrigues de Oliveira Neto, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: