Skip to content
This repository has been archived by the owner on May 18, 2020. It is now read-only.

Commit

Permalink
default month was off by one (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
plicease committed Jan 8, 2014
1 parent 9f6a26f commit 21b67c4
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Revision history for {{$dist->name}}

{{$NEXT}}
- month was off by one (gh#1)

0.06 2013-06-25 16:08:36 EST5EDT
- Add get_user_tags method
Expand Down
22 changes: 18 additions & 4 deletions lib/WebService/LiveJournal/Client.pm
Original file line number Diff line number Diff line change
Expand Up @@ -857,8 +857,21 @@ sub send_request
),
);

#use Test::More;
#use XML::LibXML;
#use XML::LibXML::PrettyPrint;
#my $xml = XML::LibXML->new->parse_string($request->as_string);
#my $pp = XML::LibXML::PrettyPrint->new(indent_string => ' ')->pretty_print($xml);
#note 'send request:';
#note $xml->toString;

my $response = $self->{client}->send_request($request);

#my $xml = XML::LibXML->new->parse_string($response->as_string);
#my $pp = XML::LibXML::PrettyPrint->new(indent_string => ' ')->pretty_print($xml);
#note 'recv response:';
#note $xml->toString;

if(ref $response)
{
if($response->is_fault)
Expand Down Expand Up @@ -891,23 +904,24 @@ sub _post
my $self = shift;
my $ua = $self->{client}->useragent;
my %arg = @_;
#print "====\nOUT:\n";
#use Test::More;
#note "====\nOUT:\n";
#foreach my $key (keys %arg)
#{
# print "$key=$arg{$key}\n";
# note "$key=$arg{$key}\n";
#}
my $http_response = $ua->post($self->{flat_url}, \@_);
return $self->_set_error("HTTP Error: " . $http_response->status_line) unless $http_response->is_success;

my $response_text = $http_response->content;
my @list = split /\n/, $response_text;
my %h;
#print "====\nIN:\n";
#note "====\nIN:\n";
while(@list > 0)
{
my $key = shift @list;
my $value = shift @list;
#print "$key=$value\n";
#note "$key=$value\n";
$h{$key} = $value;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/WebService/LiveJournal/Event.pm
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ sub _fill_in_default_time
&& defined $self->{min};
my ($sec,$min,$hour,$mday,$month,$year,$wday,$yday,$isdst) = localtime(time);
$self->{year} //= $year+1900;
$self->{month} //= $month;
$self->{month} //= $month+1;
$self->{day} //= $mday;
$self->{hour} //= $hour;
$self->{min} //= $min;
Expand Down
6 changes: 2 additions & 4 deletions t/live-getevents.t
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
use strict;
use warnings;
use Test::More;
use WebService::LiveJournal::Client;
use WebService::LiveJournal;

plan skip_all => 'for live tests set TEST_WEBSERVICE_LIVEJOURNAL' unless defined $ENV{TEST_WEBSERVICE_LIVEJOURNAL};
plan tests => 11;

my($user,$pass,$server) = split /:/, $ENV{TEST_WEBSERVICE_LIVEJOURNAL};

my $client = WebService::LiveJournal::Client->new(
my $client = WebService::LiveJournal->new(
server => $server,
username => $user,
password => $pass,
);

diag $WebService::LiveJournal::Client::error unless defined $client;

while(1)
{
my $list = $client->getevents('lastn', howmany => 50);
Expand Down

0 comments on commit 21b67c4

Please sign in to comment.