| 1 | package DBGp::Client; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | =head1 NAME | ||
| 7 | |||
| 8 | DBGp::Client - simple client for the DBGp debugger protocol | ||
| 9 | |||
| 10 | =head1 SYNOPSIS | ||
| 11 | |||
| 12 | $listener = DBGp::Client::Listener->new(port => 9000); | ||
| 13 | $listener->listen; | ||
| 14 | |||
| 15 | while (my $client = $listener->accept) { | ||
| 16 | # set a conditional breakpoint that never triggers, | ||
| 17 | # but has side-effects in the condition | ||
| 18 | $command = 'require Data::Dumper; print Data::Dumper::Dumper($var);'; | ||
| 19 | $res = $client->send_command( | ||
| 20 | 'breakpoint_set', '-t', 'conditional', | ||
| 21 | '-f', 'file:///path/to/file.pl', | ||
| 22 | '-n', $line, | ||
| 23 | '--', | ||
| 24 | encode_base64("$command; 0"), | ||
| 25 | ); | ||
| 26 | die $res->message if $res->is_error; | ||
| 27 | |||
| 28 | # continue execution | ||
| 29 | $res = $client->send_command('run'); | ||
| 30 | die $res->message if $res->is_error; | ||
| 31 | } | ||
| 32 | |||
| 33 | =head1 DESCRIPTION | ||
| 34 | |||
| 35 | A simple client for the DBGp debugger protocol; it can be used for | ||
| 36 | testing a debugger implementation or scripting a program through the | ||
| 37 | debugger interface. | ||
| 38 | |||
| 39 | See L<DBGp::Client::Listener> and L<DBGp::Client::Connection> for API | ||
| 40 | documentation. | ||
| 41 | |||
| 42 | =cut | ||
| 43 | |||
| 44 | our $VERSION = '0.12'; | ||
| 45 | |||
| 46 | 1; | ||
| 47 | |||
| 48 | __END__ |