1Debug::Client(3)      User Contributed Perl Documentation     Debug::Client(3)
2
3
4

NAME

6       Debug::Client - client side code for perl debugger
7

SYNOPIS

9         use Debug::Client;
10         my $debugger = Debug::Client->new(host => $host, port => $port);
11         $debugger->listen;
12
13         # this is the point where the external script need to be launched
14         # first setting
15             # $ENV{PERLDB_OPTS} = "RemotePort=$host:$port"
16         # then running
17             # perl -d script
18
19         my $out = $debugger->get;
20
21         $out = $debugger->step_in;
22
23         $out = $debugger->step_over;
24
25
26         my ($prompt, $module, $file, $row, $content) = $debugger->step_in;
27         my ($module, $file, $row, $content, $return_value) = $debugger->step_out;
28         my $value = $debugger->get_value('$x');
29
30         $debugger->run();         # run till end of breakpoint or watch
31         $debugger->run( 42 );     # run till line 42  (c in the debugger)
32         $debugger->run( 'foo' );  # tun till beginning of sub
33
34         $debugger->execute_code( '$answer = 42' );
35
36         $debugger->execute_code( '@name = qw(foo bar)' );
37
38         my $value = $debugger->get_value('@name');  $value is the dumped data?
39
40         $debugger->execute_code( '%phone_book = (foo => 123, bar => 456)' );
41
42         my $value = $debugger->get_value('%phone_book');  $value is the dumped data?
43
44
45         $debugger->set_breakpoint( "file", 23 ); #    set breakpoint on file, line
46
47         $debugger->get_stack_trace
48
49       Other planned methods:
50
51         $debugger->set_breakpoint( "file", 23, COND ); #      set breakpoint on file, line, on condition
52         $debugger->set_breakpoint( "file", subname, [COND] )
53
54         $debugger->set_watch
55         $debugger->remove_watch
56         $debugger->remove_breakpoint
57
58
59         $debugger->watch_variable   (to make it easy to display values of variables)
60

DESCRIPTION

62   new
63       The constructor can get two parameters: host and port.
64
65         my $d = Debug::Client->new;
66
67         my $d = Debug::Client->new(host => 'remote.hots.com', port => 4242);
68
69       Immediately after the object creation one needs to call
70
71         $d->listen;
72
73       TODO: Is there any reason to separate the two?
74
75   listen
76       See "new"
77
78   buffer
79       Returns the content of the buffer since the last command
80
81         $debugger->buffer;
82
83   quit
84   show_line
85   step_in
86   step_over
87   step_out
88        my ($prompt, $module, $file, $row, $content, $return_value) = $debugger->step_out;
89
90       Where $prompt is just a number, probably useless
91
92       $return_value  will be undef if the function was called in VOID context
93
94       It will hold a scalar value if called in SCALAR context
95
96       It will hold a reference to an array if called in LIST context.
97
98       TODO: check what happens when the return value is a reference to a
99       complex data structure or when some of the elements of the returned
100       array are themselves references
101
102   get_stack_trace
103       Sends the stack trace command "T" to the remote debugger and returns it
104       as a string if called in scalar context.  Returns the prompt number and
105       the stack trace string when called in array context.
106
107   run
108         $d->run;
109
110       Will run till the next breakpoint or watch or the end of the script.
111       (Like pressing c in the debugger).
112
113         $d->run($param)
114
115   set_breakpoint
116        $d->set_breakpoint($file, $line, $condition);
117
118   execute_code
119         $d->execute_code($some_code_to_execute);
120
121   get_value
122        my $value = $d->get_value($x);
123
124       If $x is a scalar value, $value will contain that value.  If it is a
125       reference to a SCALAR, ARRAY or HASH then $value should be the value of
126       that reference?
127
128       Actually I think this is an internal method....
129
130       In SCALAR context will return all the buffer collected since the last
131       command.
132
133       In LIST context will return ($prompt, $module, $file, $row, $content)
134       Where $prompt is the what the standard debugger uses for prompt.
135       Probably not too interesting.  $file and $row describe the location of
136       the next instructions.  $content is the actual line - this is probably
137       not too interesting as it is in the editor. $module is just the name of
138       the module in which the current execution is.
139

See Also

141       GRID::Machine::remotedebugtut
142
144       Copyright 2008-2009 Gabor Szabo. <http://www.szabgab.com/>
145

LICENSE

147       This program is free software; you can redistribute it and/or modify it
148       under the same terms as Perl 5 itself.
149

WARRANTY

151       There is no warranty whatsoever.  If you lose data or your hair because
152       of this program, that's your problem.
153

CREDITS and THANKS

155       Originally started out from the remoteport.pl script from Pro Perl
156       Debugging written by Richard Foley.
157

POD ERRORS

159       Hey! The above document had some coding errors, which are explained
160       below:
161
162       Around line 436:
163           Unknown directive: =head
164
165
166
167perl v5.12.0                      2009-12-22                  Debug::Client(3)
Impressum