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

DBGp::Client::Connection - DBGp connection class

SYNOPSIS

$connection = $listener->accept;

$res = $connection->send_command('step_over');
die $res->message if $res->is_error;

$res = $connection->send_command('eval', '--', encode_base64('$var'));
die $res->message if $res->is_error;

# assumes result is a scalar value, it should check ->children
print $res->result->value, "\n";

DESCRIPTION

Simple blocking interface for a DBGp connection.

METHODS

new

$connection = DBGp::Client::Connection->new(
    socket  => $connected_socket,
);

Usually called by DBGp::Client::Listener, not used directly.

Creates a new connection object wrapping the passed-in socket; after construction, call "parse_init" to process the initialization message sent by the debugger.

parse_init

$init = $connection->parse_init;

Usually called by DBGp::Client::Listener, not used directly.

Parses the init message sent by the debugger, and returns a "init" in DBGp::Client::Response object.

send_command

$res = $connection->send_command('step_over');
$res = $connection->send_command('eval', '--', 'base64-encoded-data');

Sends a command to the debugger, parses the answer and returns it as a response object (see DBGp::Client::Response).

It automatically adds the DBGp transaction id (-i parameter) to the command.

Note that this method could block indefinitely.

on_stream

$connection->on_stream(sub { ... });

Set a callback for receiving redirected program output.

The callback receives a "stream" in DBGp::Client::Response object.

on_notification

$connection->on_notification(sub { ... });

Set a callback for receiving notifications.

The callback receives a "notify" in DBGp::Client::Response object.

AUTHOR

Mattia Barbon <mbarbon@cpan.org>

LICENSE

Copyright (c) 2015 Mattia Barbon. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.