lib/Devel/Debug/Server/Client.pm

filter: Statementstmt 77.7% 7 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 83.3% 10 / 12 CC 1 SCAR 0.9
CC
1
Cov
78%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« lib/Devel/Debug/Server.pm ↑ Summary
1 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 package Devel::Debug::Server::Client;
4  
5 0 ▶use Devel::Debug::Server;
Subroutine BEGIN: called CC=1 SCAR=2.6
6  
7 # PODNAME: Client module
8  
9 # ABSTRACT: the client module for the GUI or CLI client
10  
11  
12  
13 sub refreshData {
14  
15 my $req = { type => $Devel::Debug::Server::DEBUG_GUI_TYPE
16 };
17 return sendCommand($req); #we just send a void command
18 }
19  
20  
21 #Send a command to the debug server to process whose pid is $pid.
22 #This method shouldn't be used directly.
23 #Returns the debug informations of the server.
24  
25 #The command is of the form:
26 #
27 # {
28 # command => $commandCode,
29 # arg1 => $firstArg, #if needed
30 # arg2 => $secondArg,#if needed
31 # arg3 => $thirdArg,#if needed
32 # };
33 sub sendCommand {
34 my($pid,$command)= @_;
35
36 Devel::Debug::Server::initZeroMQ();
37  
38 my $req = { type => $Devel::Debug::Server::DEBUG_GUI_TYPE,
39 command => $command,
40 pid=> $pid,
41 };
42 my $answer = Devel::Debug::Server::send($req);
43  
44 return $answer;
45
46 }
47  
48 sub step {
49 my ($pid) = @_;
50 return Devel::Debug::Server::Client::sendCommand($pid,
51 {
52 command => $Devel::Debug::Server::STEP_COMMAND,
53 });
54 }
55  
56  
57 sub breakPoint {
58 my ($filePath,$lineNumber) = @_;
59 return Devel::Debug::Server::Client::sendCommand(undef,
60 {
61 command => $Devel::Debug::Server::SET_BREAKPOINT_COMMAND,
62 arg1 => $filePath,
63 arg2 => $lineNumber,
64 });
65 }
66  
67 sub removeBreakPoint {
68 my ($file,$line) = @_;
69 return Devel::Debug::Server::Client::sendCommand(undef,
70 {
71 command => $Devel::Debug::Server::REMOVE_BREAKPOINT_COMMAND,
72 arg1 => $file,
73 arg2 => $line,
74 });
75 }
76  
77 sub run {
78 my ($pid) = @_;
79 return Devel::Debug::Server::Client::sendCommand($pid,
80 { command => $Devel::Debug::Server::RUN_COMMAND, });
81 }
82  
83 sub suspend {
84 my ($pid) = @_;
85 return Devel::Debug::Server::Client::sendCommand($pid,
86 { command => $Devel::Debug::Server::SUSPEND_COMMAND });
87 }
88 sub return {
89 my ($pid,$returnedValue) = @_;
90 my $command = { command => $Devel::Debug::Server::RETURN_COMMAND} ;
91 if (defined $returnedValue){
92 $command ={ command => $Devel::Debug::Server::RETURN_COMMAND,
93 arg1 => $returnedValue};
94 }
95 return Devel::Debug::Server::Client::sendCommand($pid,$command);
96 }
97  
98  
99 sub eval {
100 my ($pid,$expression) = @_;
101 return Devel::Debug::Server::Client::sendCommand($pid,
102 { command => $Devel::Debug::Server::EVAL_COMMAND,
103 arg1 => $expression });
104 }
105 1;
106  
107 __END__
« lib/Devel/Debug/Server.pm ↑ Summary