Skip to content

Commit

Permalink
Merge pull request #2 from neilbowers/master
Browse files Browse the repository at this point in the history
Removed cookie_jar method
  • Loading branch information
lorn committed Feb 22, 2012
2 parents f32b8df + d9fd5db commit 3917fad
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 97 deletions.
72 changes: 51 additions & 21 deletions Changes
@@ -1,21 +1,51 @@
Revision history for LWP-Curl Revision history for Perl module LWP::Curl


0.01 Wed 03 Dec 2008 0.10 unreleased
First version, released on an unsuspecting world.
0.02 Wed 03 Dec 2008 - removed cookie_jar method and doc for it, as they were cut&paste from proxy method
Some language problems - reformatted this file according to CPAN::Changes::Spec
Fix two perlcritic warnings
0.03 Thu 04 Dec 2008 0.09 2011-07-10
$lwpcurl->post working! :)
Auto url encode - Bugfix: "When $lwpcurl->proxy('') is called, it is simply ignored" by David Oliveira
0.04 Fri 05 Dec 2008
wrong get test 0.08 2011-04-11
0.05 Fri 12 Dec 2008
Removed get test - Just change the version, because 0.07-1 isn't a valid version :/
Dependency WWW::Curl::Easy added, thanks to Daniel Mantovani
0.06 Resolved a litle bug when get method does not return anything 0.07-1 2011-03-09
0.07 Forgot change the Change :/
0.07-1 $lwp->proxy working :) and some bug fixed resolved - $lwp->proxy working :) and some bug fixed resolved
Tests improvements - Tests improvements
0.08 Just change the version, because 0.07-1 is'nt a valid version :/
0.09 Bugfix: "When $lwpcurl->proxy('') is called, it is simply ignored" by David Oliveira 0.07 2011-03-09

- Forgot change the Change :/

0.06 2009-01-12

- Resolved a litle bug when get method does not return anything

0.05 2008-12-12

- Removed get test
- Dependency WWW::Curl::Easy added, thanks to Daniel Mantovani

0.04 2008-12-05

- wrong get test

0.03 2008-12-04

- $lwpcurl->post working! :)
- Auto url encode

0.02 2008-12-03

- Some language problems
- Fix two perlcritic warnings

0.01 2008-12-03

- First version, released on an unsuspecting world.

29 changes: 0 additions & 29 deletions META.yml

This file was deleted.

62 changes: 15 additions & 47 deletions lib/LWP/Curl.pm
Expand Up @@ -13,21 +13,21 @@ LWP::Curl - LWP methods implementation with Curl engine
=head1 VERSION =head1 VERSION
Version 0.07 Version 0.10
=cut =cut


our $VERSION = '0.09'; our $VERSION = '0.10';


=head1 SYNOPSIS =head1 SYNOPSIS
Use libcurl like LWP, $lwpcurl->get($url), $lwpcurl->timeout(15) don't care about Curl API and don't care about html encode Use libcurl like LWP, $lwpcurl->get($url), $lwpcurl->timeout(15) don't care about Curl API and don't care about html encode
use LWP::Curl; use LWP::Curl;
my $lwpcurl = LWP::Curl->new(); my $lwpcurl = LWP::Curl->new();
my $content = $lwpcurl->get('http://search.cpan.org','http://www.cpan.org'); my $content = $lwpcurl->get('http://search.cpan.org','http://www.cpan.org');
#get the page http://search.cpan.org passing with referer http://www.cpan.org # get the page http://search.cpan.org passing with referer http://www.cpan.org
=cut =cut


Expand Down Expand Up @@ -77,10 +77,6 @@ Set the proxy in the constructor, $proxyurl will be like:
all_proxy etc, if any of those are set. The $lwpcurl->proxy option does all_proxy etc, if any of those are set. The $lwpcurl->proxy option does
however override any possibly set environment variables. however override any possibly set environment variables.
=item * C<< cookie_jar => number >>
Set how deep the spider will follow when receive HTTP 301 ( Redirect ). The default is 3.
=back =back
=cut =cut
Expand Down Expand Up @@ -284,10 +280,9 @@ sub auto_encode {


=head2 $lwpcurl->agent_alias($alias) =head2 $lwpcurl->agent_alias($alias)
Copy from L<WWW::Mechanize> begin here Sets the user agent string to the expanded version from a table
____________________________________ of actual user strings.
Sets the user agent string to the expanded version from a table of actual user strings. I<$alias> can be one of the following:
I<$alias> can be one of the following:
=over 4 =over 4
Expand All @@ -305,16 +300,13 @@ sub auto_encode {
=back =back
then it will be replaced with a more interesting one. For instance, then it will be replaced with a more interesting one. For instance,
____________________________________
Copy from L<WWW::Mechanize> ends here, but the idea and the data structure is a copy too :) $lwpcurl->agent_alias( 'Windows IE 6' );
$lwpcurl->agent_alias( 'Windows IE 6' ); sets your User-Agent to
sets your User-Agent to Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
=cut =cut


Expand Down Expand Up @@ -369,30 +361,6 @@ sub proxy {
$self->{agent}->setopt( CURLOPT_PROXY, $self->proxy ); $self->{agent}->setopt( CURLOPT_PROXY, $self->proxy );
} }


=head2 $lwpcurl->cookie_jar($proxyurl)
Set the proxy in the constructor, $proxyurl will be like:
http://myproxy.com:3128/
http://username:password@proxy.com:3128/
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
=cut

sub cookie_jar {
my ( $self, $proxy ) = @_;
if ( !$proxy ) {
return $self->{proxy};
}
$self->{proxy} = $proxy;
$self->{agent}->setopt( CURLOPT_PROXY, $self->proxy );
}
=head1 TODO =head1 TODO
This is a small list of features I'm plan to add. Feel free to contribute with your wishlist and comentaries! This is a small list of features I'm plan to add. Feel free to contribute with your wishlist and comentaries!
Expand Down

0 comments on commit 3917fad

Please sign in to comment.