Net::MarkLogic::XDBC - XDBC connectivity for MarkLogic CIS servers.


Net-MarkLogic-XDBC documentation  | view source Contained in the Net-MarkLogic-XDBC distribution.

Index


NAME

Top

Net::MarkLogic::XDBC - XDBC connectivity for MarkLogic CIS servers.

SYNOPSIS

Top

  use Net::MarkLogic::XDBC

  $xdbc = Net::MarkLogic::XDBC->new( "user:pass@localhost:9000" );

  $xdbc = Net::MarkLogic::XDBC->new(host     => $host,
                                    port     => $port,
                                    username => $user,
                                    password => $pass, );

  $result = $agent->query($xquery);

  print $result->content;

  @items = $result->items;
  print $item->content;

DESCRIPTION

Top

Alpha. API will change.

Connect to a CIS XDBC server and execute xquery code.

METHODS

Top

new()

  $xdbc = Net::MarkLogic::XDBC->new( "user:pass@localhost:9000" );

  $xdbc = Net::MarkLogic::XDBC->new( host     => $hostname,
                                     port     => $port,
                                     username => $user,
                                     password => $pass, );




Connect using a connection string or named host, port, username, and password parameters. =cut

sub new { my $class = shift;

    my %args;

    if (scalar @_ == 1)
    {
        $_[0] =~ m/
            ^  ([^:]+)    # username 
            :  ([^\s\@]+) # password
            \@ ([\w\-\.]+)  # hostname
            :  (\d+) $    # port
        /x or die "Bad connection string: $_[0]";

        $args{username} = $1;
        $args{password} = $2;
        $args{host}     = $3;
        $args{port}     = $4;
    }
    else { %args = @_; }

    foreach my $key (@REQUIRED_FIELDS) {
        die "Invalid connection info. Missing $key." unless $args{$key};
    }

    my $self = bless ({}, ref ($class) || $class);

    $self->host($args{host});
    $self->port($args{port});
    $self->username($args{username});
    $self->password($args{password});

    return ($self);
}




query()

    $result = $xdbc->query($xquery);

Execute XQUERY code on XDBC server.

query_from_template()

    $result = $xdbc->query_from_template($template, $args);

Generate XQUERY code from a template toolkit template and arguments, then execute on XDBC server.

This might be overkill, but it's definitely a feature you're not going to find in the Java API.

ATTRIBUTE METHODS

Top

These methods function as setter/getters for the objects attributes.

$get = $xdbc->foo(); $xdbc->foo($set);

These shouldn't be important unless you need to finetune the behavior or tweak the settings.

ua()

LWP::UserAgent, just in case anyone needs to tweak settings.

HTTP::Headers, sent on every request to the XDBC server.

host()

Name or IP address of the XDBC server host.

port()

Port number of XDBC server.

username()

User used for authentication.

password()

Password used for authentication.

uri()

Set a custom URI to connect to the XDBC server. Default connection go to "http://$host:$port/eval".

BUGS

Top

Big time. Watch out for changing APIs.

AUTHOR

Top

    Tony Stubblebine
    tonys@oreilly.com

ACKNOWLEDGEMENTS

Top

    Code contributions from: Michael Blakeley

    Advice and comments from Raffaele Sena, Ryan Grimm, Andy Bruno.

COPYRIGHT

Top

SEE ALSO

Top

MarkLogic Documentation: http://xqzone.marklogic.com/


Net-MarkLogic-XDBC documentation  | view source Contained in the Net-MarkLogic-XDBC distribution.