Debug-Client

 view release on metacpan or  search on metacpan

lib/Debug/Client.pm  view on Meta::CPAN

	my $self = shift;

	$self->_send('L');
	$self->_get;
	$self->_prompt;

	return $self->{buffer};
}


#######
# Accessor get_value
#######
sub get_value {
	my ( $self, $var ) = @_;

	if ( not defined $var ) {
		$self->_send('p');
		$self->_get;
		$self->_prompt;
		return $self->{buffer};
	} elsif ( $var =~ /^\@/sxm or $var =~ /^\%/sxm ) {
		$self->_send("x \\$var");
		$self->_get;
		$self->_prompt;
		return $self->{buffer};
	} else {
		$self->_send("p $var");
		$self->_get;
		$self->_prompt;
		if ( $self->{buffer} =~ m/^(?:HASH|ARRAY)/sxm ) {
			$self->_send("x \\$var");
			$self->_get;
			$self->_prompt;
			return $self->{buffer};
		} else {
			return $self->{buffer};
		}
	}
}

#######
# sub get_p_exp
#######
sub get_p_exp {
	my ( $self, $exp ) = @_;

	$self->_send("p $exp");
	$self->_get;
	$self->_prompt;

	return $self->{buffer};
}

#######
# sub get_y_zero
#######
sub get_y_zero {
	my $self = shift;

	require PadWalker if 0; #forces PadWalker to be a requires not a test_requires

	# say 'running on perl '. $PERL_VERSION;
	if ( $PERL_VERSION >= 5.017006 && $PERL_VERSION <= 5.021003 ) {

		# say 'using y=1 instead as running on perl ' . $PERL_VERSION;
		$self->_send('y 1');
	} else {
		$self->_send('y 0');
	}

	# $self->_send('y 0');
	$self->_get;
	$self->_prompt;

	return $self->{buffer};
}

#######
# sub get_v_vars
#######
sub get_v_vars {
	my ( $self, $pattern ) = @_;

	if ( defined $pattern ) {
		$self->_send("V $pattern");
	} else {
		$self->_send('V');
	}
	$self->_get;
	$self->_prompt;

	return $self->{buffer};
}

#######
# sub get_x_vars
#######
sub get_x_vars {
	my ( $self, $pattern ) = @_;

	if ( defined $pattern ) {
		$self->_send("X $pattern");
	} else {
		$self->_send('X');
	}

	$self->_get;
	$self->_prompt;

	return $self->{buffer};
}

#######
# sub get_h_var
#######
sub get_h_var {
	my ( $self, $var ) = @_;

	#added a flush buffer to stop help appending in an initional case
	$self->{buffer} = undef;

lib/Debug/Client.pm  view on Meta::CPAN

Sends the stack trace command C<S> [[!]pattern]
 List subroutine names [not] matching pattern.

=item run

  $debugger->run;

Will run till the next breakpoint or watch or the end of
the script. (Like pressing c in the debugger).

  $debugger->run($param)

=item set_breakpoint

 $debugger->set_breakpoint($file, $line, $condition);

I<$condition is not currently used>

=item remove_breakpoint

 $debugger->remove_breakpoint( $self, $file, $line );

=item show_breakpoints

The data as (L) prints in the command line debugger.

 $debugger->show_breakpoints();

=item get_value

 my $value = $debugger->get_value($x);

If $x is a scalar value, $value will contain that value.
If it is a reference to a ARRAY or HASH then $value should be the
value of that reference?

=item get_p_exp

p expr

Same as print {$DB::OUT} expr in the current package.
In particular, because this is just Perl's own print function,
this means that nested data structures and objects are not dumped,
unlike with the x command.

The DB::OUT filehandle is opened to /dev/tty,
regardless of where STDOUT may be redirected to.
From perldebug, but defaulted to y 0

  $debugger->get_p_exp();

=item get_y_zero

From perldebug, but defaulted to y 0

 y [level [vars]]

Display all (or some) lexical variables (mnemonic: my variables) in the
current scope or level scopes higher. You can limit the variables that you see
with vars which works exactly as it does for the V and X commands. Requires
that the PadWalker module be installed
Output is pretty-printed in the same style as for V and the format is
controlled by the same options.

  $debugger->get_y_zero();

which is now y=1 since perl 5.17.6,

=item get_v_vars

V [pkg [vars]]

Display all (or some) variables in package (defaulting to main ) using a data
pretty-printer (hashes show their keys and values so you see what's what,
control characters are made printable, etc.). Make sure you don't put the type
specifier (like $ ) there, just the symbol names, like this:

 $debugger->get_v_vars(regex);

=item get_x_vars

X [vars] Same as V currentpackage [vars]

 $debugger->get_x_vars(regex);

=item get_h_var

Enter h or `h h' for help,
For more help, type h cmd_letter, optional var

 $debugger->get_h_var();

=item set_option

o booloption ...

Set each listed Boolean option to the value 1 .
o anyoption? ...

Print out the value of one or more options.
o option=value ...

Set the value of one or more options. If the value has internal white-space,
it should be quoted. For example, you could set o pager="less -MQeicsNfr" to
call less with those specific options. You may use either single or double
quotes, but if you do, you must escape any embedded instances of same sort of
quote you began with, as well as any escaping any escapes that immediately
precede that quote but which are not meant to escape the quote itself.
In other words, you follow single-quoting rules irrespective of the quote;
eg: o option='this isn\'t bad' or o option="She said, \"Isn't it?\"" .

For historical reasons, the =value is optional, but defaults to 1 only where
it is safe to do so--that is, mostly for Boolean options.
It is always better to assign a specific value using = . The option can be
abbreviated, but for clarity probably should not be. Several options can be
set together.
See Configurable Options for a list of these.

 $debugger->set_option();

=item get_options



( run in 0.589 second using v1.01-cache-2.11-cpan-e1769b4cff6 )