The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Neo4j::Driver::Net::HTTP::LWP - HTTP network adapter for libwww-perl

VERSION

version 0.39

SYNOPSIS

 use parent 'Neo4j::Driver::Plugin';
 
 sub register {
   my ($self, $manager) = @_;
   $manager->add_handler(
     http_adapter_factory => sub {
       my ($continue, $driver) = @_;
       my $adapter = Neo4j::Driver::Net::HTTP::LWP->new($driver);
       ...
       return $adapter;
     },
   );
 }

You can also extend this module through inheritance:

 use parent 'Neo4j::Driver::Net::HTTP::LWP';
 
 sub new {
   my $self = shift->SUPER::new(@_);
   $self->ua->proxy('http', 'http://proxy.example.net:8081/');
   return $self;
 }

DESCRIPTION

The Neo4j::Driver::Net::HTTP::LWP package is an HTTP network adapter for Neo4j::Driver, using LWP::UserAgent to connect to the Neo4j server via HTTP or HTTPS.

HTTPS connections require LWP::Protocol::https to be installed.

METHODS

Neo4j::Driver::Net::HTTP::LWP implements the following methods; see "Network adapter API for HTTP" in Neo4j::Driver::Plugin.

  • date_header

  • fetch_all

  • fetch_event

  • http_header

  • http_reason

  • json_coder

  • request

  • uri

In this module, request() always blocks until the HTTP response has been fully received. Therefore none of the other methods will ever block.

In addition to the methods listed above, Neo4j::Driver::Net::HTTP::LWP implements the following methods.

new

 $adapter = Neo4j::Driver::Net::HTTP::LWP->new( $driver );

Creates a new Neo4j::Driver::Net::HTTP::LWP adapter and configures it using the given Neo4j::Driver.

ua

 use parent 'Neo4j::Driver::Net::HTTP::LWP';
 sub foo {
   my $self = shift;
   $ua = $self->ua;
   ...
 }

Returns the LWP::UserAgent instance in use. Meant to facilitate reuse.

BUGS

The fetch_event() method has not yet been optimised.

SEE ALSO

Neo4j::Driver::Net

AUTHOR

Arne Johannessen <ajnn@cpan.org>

If you contact me by email, please make sure you include the word "Perl" in your subject header to help beat the spam filters.

COPYRIGHT AND LICENSE

This software is Copyright (c) 2016-2023 by Arne Johannessen.

This is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0 or (at your option) the same terms as the Perl 5 programming language system itself.