LJ-Simple

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

		in the README file is correctly updated.
	- Added the Setprop_taglist() method to set tags in posts
	- Updated examples/ljpost to include setting of tags
	- Fixed how the SendRequest() handles the response from the server; it
		no longer blindly removes \r from the response. Whilst at the
		moment this is not an issue as the flat protocol is unlikely to
		contain \r, it could be an issue in the future.
	- Fixed the test script test.pl to deal with a failure to create the
		object; correctly handles returning the right number of tests.
		Problem noted by STEPANOV
	- Added support for http_proxy and HTTP_PROXY environment variables
		within the LJ::Simple object creation. The environment
		variables on only looked at iff the http variable is *not*
		given during the object creation.
		Problem noted by STEPANOV

0.12.1  Wed Jan 12 21:13:35 GMT 2005
	- Minor release for a fix to QuickPost() which caused a runtime error
		if a subject was set. The documentation was also corrected to
		show that the entry option is always required.

Simple.pm  view on Meta::CPAN


If C<site> is given C<undef> then the code assumes that you wish to
connect to C<www.livejournal.com:80>. If no port is given then port
C<80> is the default.

If C<proxy> is given C<undef> then the code will go directly to the
C<$site> unless a suitable environment variable is set.
If no port is given then port C<3128> is the default.

C<LJ::Simple> also supports the use the environment variables C<http_proxy>
and C<HTTP_PROXY> to store the HTTP proxy server details. The format of these
environment variables is assumed to be:

  http://server[:port]/

Where C<server> is the name of the proxy server and the optional C<port> the
proxy server is on - port C<3128> is used if no port is explicitly given.

It should be noted that the proxy environment variables are B<only> checked
if the C<proxy> value is B<NOT> given to the C<LJ::Simple> object creation.
Thus to disable looking at the proxy environment variables use

Simple.pm  view on Meta::CPAN

      $proxy_port = $2;
    }
    $self->{proxy}={
  	host	=>	$hr->{proxy},
  	port	=>	$proxy_port,
    };
  } elsif (!exists $hr->{proxy}) {
    # Getting proxy details from the environment; assumes that the proxy is
    # given as http://site[:port]/
    # The first matching env is used.
    foreach my $env (qw( http_proxy HTTP_PROXY )) {
      (exists $ENV{$env}) || next;
      ($ENV{$env}=~/^(?:http:\/\/)([^:\/]+)(?::([0-9]+)){0,1}/o) || next;
      $self->{proxy}={
  	host	=>	$1,
  	port	=>	$2,
      };
      (defined $self->{proxy}->{port}) || ($self->{proxy}->{port}=$StdPort{http_proxy});
    }
  } else {
    $self->{proxy}=undef;

test.pl  view on Meta::CPAN

  ok($LJ::Simple::error,'/LJ request failed: Invalid password/');
} else {
  ok(0);
}

##
## Some quick checks of the HTTP proxy support via environment variables
##
my %CopyEnv=();
my $ProxyTest="example.com";
my @ProxyVars=(qw( http_proxy HTTP_PROXY ));
map { (exists $ENV{$_}) && ($CopyEnv{$_}=$ENV{$_}) } (@ProxyVars);
map { delete $ENV{$_} } (@ProxyVars);

# proxy overrides EnvVar
$ENV{http_proxy}="http://$ProxyTest/";
$lj = new LJ::Simple({
	  user	=>	$user,
	  pass	=>	$pass,
	  fast	=>	1,	# Don't want to actually login
	  proxy	=>	undef,



( run in 1.987 second using v1.01-cache-2.11-cpan-71847e10f99 )