@@ -1,7 +1,68 @@
Changes for Debug::Client
+0.29 2013-07-29
+ - ouch typo, tab v spaces (BOWTIE)
+
+0.28 2013-07-28
+ - bump version and release (BOWTIE)
+
+0.27_02 2013-07-10
+ - remove BEGIN block and force Win32 Term::ReadLine settings (BOWTIE)
+
+0.27_01 2013-07-10
+ - switch to Term::ReadLine::Gnu or nought (BOWTIE)
+
+0.26 2013-06-03
+ - bump version and release (BOWTIE)
+
+0.25_10 2013-05-20
+ - Change the running order of test (BOWTIE)
+ - check testing $ENV{PERL_RL} = ornaments=0
+ - as we only want to do this when necessary (BOWTIE)
+
+0.25_09 2013-05-15
+ - fix buffer call to $debugger->get_buffer
+
+0.25_08 2013-05-12
+ - fix dependency inconsistencies
+ - add new test 00-check-deps.t
+ - add test to see if we invoke $ENV{PERL_RL} (BOWTIE)
+
+0.25_07 2013-05-12
+ - use M::I to load Term::ReadLine::Gnu (BOWTIE)
+
+0.25_06 2013-05-10
+ - contradicting module definitions oops (BOWTIE)
+
+0.25_05 2013-05-09
+ - Tweak 06-term.t to show more info from cpan testers (BOWTIE)
+ - fix missing MANIFEST (BOWTIE)
+ - lower some dependency version dod++ (BOWTIE)
+
+0.25_04 2013-05-05
+ - Tweak for perl-5.17.11 compatibility (BOWTIE)
+ - test tweaks to hack #1494 (BOWTIE)
+ - Use a more appropriate Term::ReadLine::... (BOWTIE)
+
+0.25 2013-04-17
+ - bump version and release (BOWTIE)
+
+0.24_04 2013-04-16
+ - swap out some more localhost for 127.0.0.1 azawawi++ (BOWTIE)
+
+0.24_03 2013-04-16
+ - my $host = '127.0.0.1'; # instead of localhost (AZAWAWI)
+ - add some 'fudge' to t-lib-debugger for win32 azawawi++ (BOWTIE)
+
+0.24_02 2013-04-16
+ - lets remove Time-HiRes completely (BOWTIE)
+
+0.24_01 2013-04-16
+ - tweak t-lib-debugger, adjust sleep to 1 sec (BOWTIE)
+ - update Makefile requirements (BOWTIE)
+
0.24 2013-02-19
- - Take two tweak for production release to co-inside with Padre 0.98 (BOWTIE)
+ - Tweak for production release to co-inside with Padre 0.98 (BOWTIE)
0.23 2013-02-19
- Add perltidy.LOG to MANIFEST.SKIP (BOWTIE)
@@ -4,25 +4,26 @@ eg/test17.pl
inc/Module/Install.pm
inc/Module/Install/Base.pm
inc/Module/Install/Can.pm
-inc/Module/Install/DSL.pm
inc/Module/Install/Fetch.pm
inc/Module/Install/Makefile.pm
inc/Module/Install/Metadata.pm
inc/Module/Install/Win32.pm
-inc/Module/Install/With.pm
inc/Module/Install/WriteAll.pm
lib/Debug/Client.pm
Makefile.PL
MANIFEST This list of files
META.yml
README
+t/00-check-deps.t
t/01-compile.t
t/02-exports.t
t/03-pod.t
t/04-pod-coverage.t
-t/05-io.t
-t/06-initialize.t
+t/06-term.t
+t/07-initialize.t
+t/08-io.t
t/10-top_tail.t
+t/10-top_tail_old.t
t/11-add.t
t/13-return.t
t/14-run.t
@@ -52,3 +53,5 @@ t/eg/14-y_zero.pl
t/eg/test_1415.pl
t/lib/Debugger.pm
t/lib/Test_1415.pm
+t/lib/Top_Tail.pm
+t/report-prereqs.t
@@ -3,14 +3,18 @@ abstract: 'debugger client side code for Padre, The Perl IDE.'
author:
- 'Kevin Dawson <bowtie@cpan.org>'
build_requires:
+ Exporter: 5.64
ExtUtils::MakeMaker: 6.59
- File::HomeDir: 1.00
- File::Spec: 3.33
- File::Temp: 0.22
- Test::Class: 0.38
- Test::Deep: 0.110
+ File::HomeDir: 1
+ File::Spec: 3.4
+ File::Temp: 0.2301
+ Test::CheckDeps: 0.006
+ Test::Class: 0.39
+ Test::Deep: 0.11
Test::More: 0.98
- Time::HiRes: 1.9725
+ Test::Requires: 0.07
+ parent: 0.225
+ version: 0.9902
configure_requires:
ExtUtils::MakeMaker: 6.59
distribution_type: module
@@ -20,7 +24,6 @@ license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
-module_name: Debug::Client
name: Debug-Client
no_index:
directory:
@@ -28,16 +31,23 @@ no_index:
- inc
- t
- xt
+recommends:
+ ExtUtils::MakeMaker: 6.66
+ File::Spec::Functions: 3.4
+ List::Util : 1.27
+ Test::Pod: 1.48
+ Test::Pod::Coverage: 1.08
requires:
Carp: 1.20
- IO::Socket::IP: 0.18
+ IO::Socket::IP: 0.21
PadWalker: 1.96
- Term::ReadLine: 1.07
- Term::ReadLine::Perl: 1.0303
- perl: 5.10.0
+ Term::ReadLine: 1.1
+ Term::ReadLine::Gnu: 1.2
+ constant: 1.21
+ perl: 5.10.1
resources:
bugtracker: http://padre.perlide.org/trac/wiki/Tickets
homepage: http://padre.perlide.org/trac/wiki/Features/Perl5Debugger
license: http://dev.perl.org/licenses/
repository: http://svn.perlide.org/padre/trunk/Debug-Client/
-version: 0.24
+version: 0.29
@@ -1,25 +1,56 @@
-use inc::Module::Install::DSL 1.06;
-
-all_from lib/Debug/Client.pm
-requires_from lib/Debug/Client.pm
-
-requires Carp 1.20
-requires IO::Socket::IP 0.18
-requires PadWalker 1.96
-requires Term::ReadLine 1.07
-requires Term::ReadLine::Perl 1.0303
-
-test_requires File::HomeDir 1.00
-test_requires File::Spec 3.33
-test_requires File::Temp 0.22
-test_requires Test::Class 0.38
-test_requires Test::Deep 0.110
-test_requires Test::More 0.98
-test_requires Time::HiRes 1.9725
-test_requires Win32::Process 0.14 if win32
-
-homepage http://padre.perlide.org/trac/wiki/Features/Perl5Debugger
-bugtracker http://padre.perlide.org/trac/wiki/Tickets
-repository http://svn.perlide.org/padre/trunk/Debug-Client/
-
-no_index directory qw{ t xt eg share inc privinc scripts }
+use inc::Module::Install 1.06;
+
+name 'Debug-Client';
+all_from 'lib/Debug/Client.pm';
+requires_from 'lib/Debug/Client.pm';
+
+perl_version '5.010001';
+
+requires 'Carp' => '1.20';
+requires 'IO::Socket::IP' => '0.21';
+requires 'PadWalker' => '1.96';
+
+if ($^O =~ /Win32/i) {
+ requires 'Term::ReadLine' => '1.1';
+}
+
+else {
+ requires 'Term::ReadLine' => '1.1';
+ requires 'Term::ReadLine::Gnu' => '1.2';
+}
+
+requires 'constant' => '1.21';
+
+test_requires 'Exporter' => '5.64';
+test_requires 'File::HomeDir' => '1';
+test_requires 'File::Spec' => '3.4';
+test_requires 'File::Temp' => '0.2301';
+test_requires 'Test::CheckDeps' => '0.006';
+test_requires 'Test::Class' => '0.39';
+test_requires 'Test::Deep' => '0.11';
+test_requires 'Test::More' => '0.98';
+test_requires 'Test::Requires' => '0.07';
+
+if ($^O =~ /Win32/i) {
+ test_requires 'Win32' => '0.47';
+ test_requires 'Win32::Process' => '0.14';
+}
+
+test_requires 'parent' => '0.225';
+test_requires 'version' => '0.9902';
+
+recommends 'ExtUtils::MakeMaker' => '6.66';
+recommends 'File::Spec::Functions' => '3.4';
+recommends 'List::Util ' => '1.27';
+recommends 'Test::Pod' => '1.48';
+recommends 'Test::Pod::Coverage' => '1.08';
+
+
+homepage 'http://padre.perlide.org/trac/wiki/Features/Perl5Debugger';
+bugtracker 'http://padre.perlide.org/trac/wiki/Tickets';
+repository 'http://svn.perlide.org/padre/trunk/Debug-Client/';
+
+no_index 'directory' => qw{ eg inc t xt };
+
+WriteAll
+
@@ -8,25 +8,26 @@ use Pod::Usage qw(pod2usage);
my %opt = (
port => 12345,
- perl => $^X, # allow the user to supply the path to another perl
- host => 'localhost',
+ perl => $^X, # allow the user to supply the path to another perl
+ host => '127.0.0.1',
);
usage() if not @ARGV;
-GetOptions(\%opt,
+GetOptions(
+ \%opt,
'help',
'port=i',
'perl=s',
) or usage();
usage() if $opt{help};
-my ($script, @args) = @ARGV;
+my ( $script, @args ) = @ARGV;
my $pid = fork();
die if not defined $pid;
-
-if (not $pid) {
+
+if ( not $pid ) {
local $ENV{PERLDB_OPTS} = "RemotePort=$opt{host}:$opt{port}";
exec("$opt{perl} -d $script @args");
}
@@ -44,24 +45,24 @@ say 'listening';
# my @cmd = ($opt{perl}, '-d', @ARGV);
# {
- # local $ENV{PERLDB_OPTS} = "RemotePort=$opt{host}:$opt{port}";
- # IPC::Run::run(\@cmd, sub {}, \&out, \&err);
+# local $ENV{PERLDB_OPTS} = "RemotePort=$opt{host}:$opt{port}";
+# IPC::Run::run(\@cmd, sub {}, \&out, \&err);
# }
# say 'launched';
# sub out {
- # print "OUT @_";
+# print "OUT @_";
# }
# sub err {
- # print "ERR @_";
+# print "ERR @_";
# }
# my $process;
# if ($^O =~ /win32/i) {
- # require Win32::Process;
- # require Win32;
- # local $ENV{PERLDB_OPTS} = "RemotePort=$opt{host}:$opt{port}";
- # Win32::Process::Create($process, $opt{perl}, "-d $script @args", 0, 0, cwd);
+# require Win32::Process;
+# require Win32;
+# local $ENV{PERLDB_OPTS} = "RemotePort=$opt{host}:$opt{port}";
+# Win32::Process::Create($process, $opt{perl}, "-d $script @args", 0, 0, cwd);
# }
# print "launched " . $process->GetProcessID . "\n";
@@ -70,14 +71,14 @@ my $out = $debugger->get;
print $out;
my $last_step;
while (1) {
- chomp(my $input = <STDIN>);
- if ($input eq '') {
+ chomp( my $input = <STDIN> );
+ if ( $input eq '' ) {
next if not $last_step;
$input = $last_step;
}
given ($input) {
- when (['h', '?']) {
+ when ( [ 'h', '?' ] ) {
help();
}
when ('s') {
@@ -114,7 +115,7 @@ while (1) {
#print $out;
print "Invalid command\n";
}
- }
+ }
}
sub help {
@@ -130,15 +131,16 @@ h or ? - help
END_HELP
}
-
- # ...
+
+# ...
# On Windows kill() does not seem to have effect
# print "Killing the script...\n";
END {
kill 9, $pid if $pid;
}
+
# Win32::Process
#$process->Kill(0);
@@ -1,102 +0,0 @@
-#line 1
-package Module::Install::DSL;
-
-use strict;
-use vars qw{$VERSION $ISCORE};
-BEGIN {
- $VERSION = '1.06';
- $ISCORE = 1;
- *inc::Module::Install::DSL::VERSION = *VERSION;
- @inc::Module::Install::DSL::ISA = __PACKAGE__;
-}
-
-sub import {
- # Read in the rest of the Makefile.PL
- open 0 or die "Couldn't open $0: $!";
- my $dsl;
- SCOPE: {
- local $/ = undef;
- $dsl = join "", <0>;
- }
-
- # Change inc::Module::Install::DSL to the regular one.
- # Remove anything before the use inc::... line.
- $dsl =~ s/.*?^\s*use\s+(?:inc::)?Module::Install::DSL(\b[^;]*);\s*\n//sm;
-
- # Load inc::Module::Install as we would in a regular Makefile.Pl
- SCOPE: {
- package main;
- require inc::Module::Install;
- inc::Module::Install->import;
- }
-
- # Add the ::DSL plugin to the list of packages in /inc
- my $admin = $Module::Install::MAIN->{admin};
- if ( $admin ) {
- my $from = $INC{"$admin->{path}/DSL.pm"};
- my $to = "$admin->{base}/$admin->{prefix}/$admin->{path}/DSL.pm";
- $admin->copy( $from => $to );
- }
-
- # Convert the basic syntax to code
- my $code = "INIT {\n"
- . "package main;\n\n"
- . dsl2code($dsl)
- . "\n\nWriteAll();\n"
- . "}\n";
-
- # Execute the script
- eval $code;
- print STDERR "Failed to execute the generated code...\n$@" if $@;
-
- exit(0);
-}
-
-sub dsl2code {
- my $dsl = shift;
-
- # Split into lines and strip blanks
- my @lines = grep { /\S/ } split /[\012\015]+/, $dsl;
-
- # Each line represents one command
- my @code = ();
- my $static = 1;
- foreach my $line ( @lines ) {
- # Split the lines into tokens
- my @tokens = split /\s+/, $line;
-
- # The first word is the command
- my $command = shift @tokens;
- my @params = ();
- my @suffix = ();
- while ( @tokens ) {
- my $token = shift @tokens;
- if ( $token eq 'if' or $token eq 'unless' ) {
- # This is the beginning of a suffix
- push @suffix, $token;
- push @suffix, @tokens;
-
- # The conditional means this distribution
- # can no longer be considered fully static.
- $static = 0;
- last;
- } else {
- # Convert to a string
- $token =~ s/([\\\'])/\\$1/g;
- push @params, "'$token'";
- }
- };
-
- # Merge to create the final line of code
- @tokens = ( $command, @params ? join( ', ', @params ) : (), @suffix );
- push @code, join( ' ', @tokens ) . ";\n";
- }
-
- # Is our configuration static?
- push @code, "static_config;\n" if $static;
-
- # Join into the complete code block
- return join( '', @code );
-}
-
-1;
@@ -1,84 +0,0 @@
-#line 1
-package Module::Install::With;
-
-# See POD at end for docs
-
-use strict;
-use Module::Install::Base ();
-
-use vars qw{$VERSION @ISA $ISCORE};
-BEGIN {
- $VERSION = '1.06';
- @ISA = 'Module::Install::Base';
- $ISCORE = 1;
-}
-
-
-
-
-
-#####################################################################
-# Installer Target
-
-# Are we targeting ExtUtils::MakeMaker (running as Makefile.PL)
-sub eumm {
- !! ($0 =~ /Makefile.PL$/i);
-}
-
-# You should not be using this, but we'll keep the hook anyways
-sub mb {
- !! ($0 =~ /Build.PL$/i);
-}
-
-
-
-
-
-#####################################################################
-# Testing and Configuration Contexts
-
-#line 49
-
-sub interactive {
- # Treat things interactively ONLY based on input
- !! (-t STDIN and ! automated_testing());
-}
-
-#line 67
-
-sub automated_testing {
- !! $ENV{AUTOMATED_TESTING};
-}
-
-#line 86
-
-sub release_testing {
- !! $ENV{RELEASE_TESTING};
-}
-
-sub author_context {
- !! $Module::Install::AUTHOR;
-}
-
-
-
-
-
-#####################################################################
-# Operating System Convenience
-
-#line 114
-
-sub win32 {
- !! ($^O eq 'MSWin32');
-}
-
-#line 131
-
-sub winlike {
- !! ($^O eq 'MSWin32' or $^O eq 'cygwin');
-}
-
-1;
-
-#line 159
@@ -4,14 +4,23 @@ use 5.010;
use strict;
use warnings FATAL => 'all';
+# turn of experimental warnings
+no if $] > 5.017010, warnings => 'experimental::smartmatch';
+
use English qw( -no_match_vars );
local $OUTPUT_AUTOFLUSH = 1;
-our $VERSION = '0.24';
+our $VERSION = '0.29';
+
+use Term::ReadLine;
+if ( $OSNAME eq 'MSWin32' ) {
+ $ENV{TERM} = 'dumb';
+ local $ENV{PERL_RL} = ' ornaments=0';
+}
use utf8;
-use IO::Socket::IP 0.18;
-use Carp 1.20 qw(carp croak);
+use IO::Socket::IP 0.21;
+use Carp qw(carp croak);
use constant {
BLANK => qq{ },
@@ -36,7 +45,7 @@ sub new {
sub _initialize {
my ( $self, %args ) = @_;
- $self->{local_host} = $args{host} // 'localhost';
+ $self->{local_host} = $args{host} // '127.0.0.1';
$self->{local_port} = $args{port} // 24_642;
#for IO::Socket::IP
@@ -239,6 +248,7 @@ sub set_breakpoint {
return 1;
}
when ( $_ =~ /\S/sxm ) {
+
# say 'Non-whitespace charter found';
return 0;
}
@@ -332,6 +342,7 @@ sub get_y_zero {
# say 'running on perl '. $PERL_VERSION;
if ( $PERL_VERSION >= 5.017006 ) {
+
# say 'using y=1 instead as running on perl ' . $PERL_VERSION;
$self->_send('y 1');
} else {
@@ -385,10 +396,10 @@ sub get_x_vars {
#######
sub get_h_var {
my ( $self, $var ) = @_;
-
+
#added a flush buffer to stop help appending in an initional case
$self->{buffer} = undef;
-
+
if ( defined $var ) {
$self->_send("h $var");
} else {
@@ -605,7 +616,7 @@ sub _process_line {
# See 00-internal.t for test cases
sub _prompt {
my $self = shift;
-
+
my $prompt;
if ( $self->{buffer} =~ s/\s*DB<(?<prompt>\d+)>\s*$// ) {
$prompt = $+{prompt};
@@ -681,7 +692,7 @@ Debug::Client - debugger client side code for Padre, The Perl IDE.
=head1 VERSION
-This document describes Debug::Client version: 0.24
+This document describes Debug::Client version: 0.29
=head1 SYNOPSIS
@@ -693,9 +704,9 @@ to access the machine where Debug::Client runs. If they are on the same machine
this should be C<localhost>.
$port can be any port number where the Debug::Client could listen.
-This is the point where the external SUT needs to be launched
-by first setting
-
+This is the point where the external SUT needs to be launched
+ by first setting
+
$ENV{PERLDB_OPTS} = "RemotePort=$host:$port"
then running
@@ -728,8 +739,7 @@ Once the script under test was launched we can call the following:
$debugger->execute_code( '%phone_book = (foo => 123, bar => 456)' );
my $value = $debugger->get_value('%phone_book'); # $value is the dumped data?
-
-
+
$debugger->set_breakpoint( "file", 23 ); # set breakpoint on file, line
$debugger->get_stack_trace
@@ -738,19 +748,19 @@ Once the script under test was launched we can call the following:
my $script = 'script_to_debug.pl';
my @args = ('param', 'param');
-
+
my $perl = $^X; # the perl might be a different perl
- my $host = 'localhost';
+ my $host = '127.0.0.1';
my $port = 24642;
my $pid = fork();
die if not defined $pid;
-
+
if (not $pid) {
local $ENV{PERLDB_OPTS} = "RemotePort=$host:$port"
exec("$perl -d $script @args");
}
-
-
+
+
require Debug::Client;
my $debugger = Debug::Client->new(
host => $host,
@@ -765,9 +775,10 @@ Once the script under test was launched we can call the following:
This is a DEVELOPMENT Release only, you have been warned!
-The primary use of this module is to provide debugger functionality for Padre 0.98 and beyond,
+The primary use of this module is to provide debugger functionality for
+Padre 0.98 and beyond,
-This module has been tested against Perl 5.17.8.
+This module has been tested against Perl 5.18.0
=head1 METHODS
@@ -801,9 +812,9 @@ Return the internal debugger pointer to the line last executed, and print out th
=item get_lineinfo
-Return the internal debugger pointer to the line last executed,
-and generate file-name and row for where are we now.
-trying to use perl5db line-info in naff way,
+Return the internal debugger pointer to the line last executed,
+ and generate file-name and row for where are we now.
+ trying to use perl5db line-info in naff way,
$debugger->get_lineinfo();
@@ -811,7 +822,7 @@ Then use the following as and when.
$debugger->get_filename;
$debugger->get_row;
-
+
to get filename and row for ide due to changes in perl5db v1.35 see perl5156delta
=item show_view
@@ -826,13 +837,13 @@ View a few lines of code around the current line.
s [expr]
-Single step.
-Executes until the beginning of another statement, descending into subroutine calls.
-If an expression is supplied that includes function calls, it too will be single-stepped.
+Single step.
+Executes until the beginning of another statement, descending into subroutine calls.
+ If an expression is supplied that includes function calls, it too will be single-stepped.
$debugger->step_in();
-Expressions not supported.
+Expressions not supported.
=item step_over
@@ -868,13 +879,13 @@ Sends the stack trace command C<t> Toggle trace mode.
=item list_subroutine_names
-Sends the stack trace command C<S> [[!]pattern]
-List subroutine names [not] matching pattern.
+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).
@@ -908,12 +919,12 @@ value of that reference?
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,
+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,
+The DB::OUT filehandle is opened to /dev/tty,
regardless of where STDOUT may be redirected to.
From perldebug, but defaulted to y 0
@@ -925,24 +936,25 @@ 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.
+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,
+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:
+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);
@@ -969,18 +981,20 @@ 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.
+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();
@@ -1000,11 +1014,12 @@ Actually I think this is an internal method....
In SCALAR context will return all the buffer collected since the last command.
In LIST context will return ($prompt, $module, $file, $row, $content)
-Where $prompt is the what the standard debugger uses for prompt. Probably not too
-interesting.
+Where $prompt is the what the standard debugger uses for prompt. Probably not
+too interesting.
$file and $row describe the location of the next instructions.
-$content is the actual line - this is probably not too interesting as it is
-in the editor. $module is just the name of the module in which the current execution is.
+$content is the actual line - this is probably not too interesting as it is
+in the editor. $module is just the name of the module in which the current
+execution is.
=item get_filename
@@ -1038,19 +1053,23 @@ in the editor. $module is just the name of the module in which the current execu
=head1 BUGS AND LIMITATIONS
+If you get any issues installing, try install L<Term::ReadLine::Gnu> first.
+
Warning if you use List request you may get spurious results.
-When using against perl5db.pl v1.35 list mode gives an undef response, also leading single quote now correct.
+When using against perl5db.pl v1.35 list mode gives an undef response, also
+leading single quote now correct.
Tests are skipped for list mode against v1.35 now.
-Debug::Client 0.12 tests are failing, due to changes in perl debugger,
+Debug::Client 0.12 tests are failing, due to changes in perl debugger,
when using perl5db.pl v1.34
Debug::Client 0.13_01 skips added to failing tests.
c [line|sub]
-Continue, optionally inserting a one-time-only breakpoint at the specified line or subroutine.
+Continue, optionally inserting a one-time-only breakpoint at the specified
+line or subroutine.
c is now ignoring options [line|sub]
@@ -1064,7 +1083,8 @@ Perl::Critic Error Subroutine name is a homonym for built-in function
Use $debugger->listener instead
-It will work against perl 5.17.6-7 with rindolf patch 7a0fe8d applied for watches
+It will work against perl 5.17.6-7 with rindolf patch 7a0fe8d applied for
+watches
=head1 AUTHORS
@@ -1090,7 +1110,7 @@ Alexandr Ciornii E<lt>alexchorny@gmail.comE<gt>
Copyright 2008-2011 Gabor Szabo
-Some parts copyright 2011-2013 Kevin Dawson and CONTRIBUTORS as listed above.
+Some parts Copyright E<copy> 2011-2013 Kevin Dawson and CONTRIBUTORS as listed above.
=head1 LICENSE
@@ -1105,7 +1125,7 @@ that's your problem.
=head1 CREDITS and THANKS
-Originally started out from the remote-port.pl script from
+Originally started out from the remote-port.pl script from
Pro Perl Debugging written by Richard Foley.
=head1 See Also
@@ -0,0 +1,19 @@
+use strict;
+use warnings FATAL => 'all';
+
+use English qw( -no_match_vars );
+local $OUTPUT_AUTOFLUSH = 1;
+
+use Test::More;
+use Test::CheckDeps;
+
+check_dependencies();
+
+if (1) {
+ BAIL_OUT("Missing dependencies") if !Test::More->builder->is_passing;
+}
+
+done_testing;
+
+__END__
+
@@ -1,27 +1,36 @@
-#!/usr/bin/perl
-
use strict;
-use Test::More tests => 14;
+use warnings FATAL => 'all';
+
+use English qw( -no_match_vars );
+local $OUTPUT_AUTOFLUSH = 1;
+
+use Test::More tests => 18;
-use_ok('Debug::Client');
-use_ok('t::lib::Debugger');
+BEGIN {
+ use_ok('Debug::Client');
+ use_ok('t::lib::Debugger');
-use_ok( 'Carp', '1.20' );
-use_ok( 'IO::Socket::IP', '0.18' );
-use_ok( 'PadWalker', '1.96' );
-use_ok( 'Term::ReadLine', '1.07' );
-use_ok( 'Term::ReadLine::Perl', '1.0303' );
+ use_ok( 'Carp', '1.20' );
+ use_ok( 'IO::Socket::IP', '0.21' );
+ use_ok( 'PadWalker', '1.96' );
+ use_ok( 'Term::ReadLine', '1.1' );
+ use_ok( 'constant', '1.21' );
-use_ok( 'File::HomeDir', '1.00' );
-use_ok( 'File::Spec', '3.33' );
-use_ok( 'File::Temp', '0.22' );
-use_ok( 'Test::Class', '0.38' );
-use_ok( 'Test::Deep', '0.110' );
-use_ok( 'Test::More', '0.98' );
-use_ok( 'Time::HiRes', '1.9725' );
+ use_ok( 'Exporter', '5.64' );
+ use_ok( 'File::HomeDir', '1' );
+ use_ok( 'File::Spec', '3.4' );
+ use_ok( 'File::Temp', '0.2301' );
+ use_ok( 'Test::CheckDeps', '0.006' );
+ use_ok( 'Test::Class', '0.39' );
+ use_ok( 'Test::Deep', '0.11' );
+ use_ok( 'Test::More', '0.98' );
+ use_ok( 'Test::Requires', '0.07' );
+ use_ok( 'parent', '0.225' );
+ use_ok( 'version', '0.9902' );
+}
diag("Info: Testing Debug::Client $Debug::Client::VERSION");
-diag("Info: Perl $^V");
+diag("Info: Perl $PERL_VERSION");
done_testing();
@@ -1,11 +1,14 @@
-#!/usr/bin/perl
-
-use 5.010;
use strict;
use warnings FATAL => 'all';
-use Test::More tests => 29;
-use Debug::Client ();
+use English qw( -no_match_vars );
+local $OUTPUT_AUTOFLUSH = 1;
+
+use Test::More tests => 2;
+
+BEGIN {
+ use_ok( 'Debug::Client' );
+}
######
# let's check our subs/methods.
@@ -17,8 +20,10 @@ my @subs = qw( get_buffer get_filename get get_h_var get_lineinfo get_options ge
set_breakpoint set_option show_breakpoints show_line show_view show_line step_in step_over
toggle_trace );
-use_ok( 'Debug::Client', @subs );
-foreach my $subs (@subs) {
- can_ok( 'Debug::Client', $subs );
-}
+can_ok( 'Debug::Client', @subs );
+
+done_testing();
+
+__END__
+
@@ -1,16 +1,21 @@
-#!/usr/bin/env perl
-
use strict;
use warnings FATAL => 'all';
+use English qw( -no_match_vars );
+local $OUTPUT_AUTOFLUSH = 1;
+
+BEGIN {
+ unless ( $ENV{RELEASE_TESTING} ) {
+ require Test::More;
+ Test::More::plan( skip_all => 'Author tests, not required for installation.' );
+ }
+}
+
use Test::More;
+use Test::Requires { 'Test::Pod' => 1.48 };
-eval "use Test::Pod 1.45";
-plan skip_all => "Test::Pod 1.45 required for testing POD" if $@;
all_pod_files_ok();
done_testing();
-1;
-
-__END__
\ No newline at end of file
+__END__
@@ -1,14 +1,21 @@
-#!/usr/bin/env perl
-
use strict;
+use warnings FATAL => 'all';
+
+use English qw( -no_match_vars );
+local $OUTPUT_AUTOFLUSH = 1;
+
+BEGIN {
+ unless ( $ENV{RELEASE_TESTING} ) {
+ require Test::More;
+ Test::More::plan( skip_all => 'Author tests, not required for installation.' );
+ }
+}
+
use Test::More;
+use Test::Requires { 'Test::Pod::Coverage' => 1.08 };
-eval "use Test::Pod::Coverage 1.08";
-plan skip_all => "Test::Pod::Coverage 1.08 required for testing POD coverage" if $@;
all_pod_coverage_ok();
done_testing();
-1;
-
-__END__
\ No newline at end of file
+__END__
@@ -1,101 +0,0 @@
-#!/usr/bin/perl
-
-use 5.010;
-use strict;
-use warnings FATAL => 'all';
-
-# Turn on $OUTPUT_AUTOFLUSH
-local $| = 1;
-
-use Test::More tests => 11;
-use Test::Deep;
-use t::lib::Debugger;
-
-my ( $dir, $pid ) = start_script('t/eg/05-io.pl');
-my $path = $dir;
-if ( $^O =~ /Win32/i ) {
- require Win32;
- $path = Win32::GetLongPathName($dir);
-}
-
-# Patch for Debug::Client ticket #831 (MJGARDNER)
-# Turn off ReadLine ornaments
-local $ENV{PERL_RL} = ' ornaments=0';
-
-my $debugger = start_debugger();
-
-SCOPE:{
- my $out = $debugger->get;
-
- like( $out, qr/Loading DB routines from perl5db.pl version/, 'loading line' );
- like( $out, qr{main::\(t/eg/05-io.pl:4\):\s*\$\| = 1;}, 'line 4' );
-}
-# diag("Info: Perl version '$]'"); old
-# diag("Info: Perl version '$^V'"); new
-my $prefix = ( substr( $], 0, 5 ) eq '5.008006' ) ? "Default die handler restored.\n" : '';
-# diag("prefix: $prefix");
-
-# see relevant fail report here:
-# http://www.nntp.perl.org/group/perl.cpan.testers/2009/12/msg6486949.html
-# http://www.nntp.perl.org/group/perl.cpan.testers/2009/12/msg6481372.html
-
-{
- my @out = $debugger->step_in;
- # cmp_deeply( \@out, [ 'main::', 't/eg/05-io.pl', 6, 'print "One\n";' ], 'line 6' )
- # or diag( $debugger->buffer );
-}
-
-{
- my @out = $debugger->step_in;
- cmp_deeply( \@out, [ 'main::', 't/eg/05-io.pl', 7, 'print STDERR "Two\n";' ], 'line 7' )
- or diag( $debugger->buffer );
-}
-
-{
- my $out = slurp("$path/out");
- # diag("output: $out");
- is( $out, "One\n", 'STDOUT has One' );
- my $err = slurp("$path/err");
- # diag("error: $err");
- # is( $err, 'STDERR is empty' );
- is( $err, "${prefix}", 'STDERR is empty' );
-}
-
-{
- my @out = $debugger->step_in;
- cmp_deeply( \@out, [ 'main::', 't/eg/05-io.pl', 8, 'print "Three\n";' ], 'line 8' )
- or diag( $debugger->buffer );
-}
-
-{
- my $out = slurp("$path/out");
- # diag("output: $out");
- is( $out, "One\n", 'STDOUT has One' );
- my $err = slurp("$path/err");
- # diag("error: $err");
- # is( $err, "Two\n", 'STDERR has Two' );
- is( $err, "${prefix}Two\n", 'STDERR has Two' );
-}
-
-{
- my @out = $debugger->step_in;
- cmp_deeply( \@out, [ 'main::', 't/eg/05-io.pl', 9, 'print "Four";' ], 'line 9' )
- or diag( $debugger->buffer );
-}
-
-{
- my $out = slurp("$path/out");
- # diag("output: $out");
- is( $out, "One\nThree\n", 'STDOUT has One Three' );
- my $err = slurp("$path/err");
- # diag("error: $err");
- # is( $err, "Two\n", 'STDERR has Two' );
- is( $err, "${prefix}Two\n", 'STDERR has Two' );
-}
-
-$debugger->run;
-$debugger->quit;
-
-done_testing();
-
-__END__
@@ -1,103 +0,0 @@
-#!/usr/bin/perl
-
-use 5.010;
-use strict;
-use warnings FATAL => 'all';
-
-use English qw( -no_match_vars ); # Avoids regex performance penalty
-local $OUTPUT_AUTOFLUSH = 1;
-
-if ( $OSNAME eq 'MSWin32' ) {
- require Win32::Process;
- require Win32;
- use constant NORMALPRIORITYCLASS => 0x00000020;
-}
-
-use Test::More tests => 4;
-use Test::Deep;
-use Time::HiRes 'sleep';
-
-use File::Temp qw(tempdir);
-my ( $host, $port, $porto, $listen, $reuse_addr );
-SCOPE: {
- $host = 'localhost';
- $port = 24642;
- $porto = 'tcp';
- # $listen = 'SOMAXCONN';
- $listen = 1;
- $reuse_addr = 1;
- my ( $dir, $pid ) = run_perl5db( 't/eg/05-io.pl', $host, $port );
- require Debug::Client;
- ok( my $debugger = Debug::Client->new(
- host => $host,
- port => $port,
- porto => $porto,
- listen => $listen,
- reuse => $reuse_addr
- ),
- 'initialize with prams'
- );
- $debugger->run;
- # sleep(0.01) if $OSNAME eq 'MSWin32'; #helps against extra processes after exit
- ok( $debugger->quit, 'quit with prams' );
- if ( $OSNAME eq 'MSWin32' ) {
- $pid->Kill(0) or die "Cannot kill '$pid'";
- }
-}
-
-SCOPE: {
- $host = 'localhost';
- $port = 24642;
- my ( $dir, $pid ) = run_perl5db( 't/eg/05-io.pl', $host, $port );
- require Debug::Client;
- ok( my $debugger = Debug::Client->new(), 'initialize without prams' );
- $debugger->run;
- # sleep(0.01) if $OSNAME eq 'MSWin32'; #helps against extra processes after exit
- ok( $debugger->quit, 'quit witout prams' );
- if ( $OSNAME eq 'MSWin32' ) {
- $pid->Kill(0) or die "Cannot kill '$pid'";
- }
-}
-
-sub run_perl5db {
- my ( $file, $host, $port ) = @_;
- my $dir = tempdir( CLEANUP => 0 );
- my $path = $dir;
- my $pid;
- if ( $OSNAME eq 'MSWin32' ) {
- # require Win32;
- $path = Win32::GetLongPathName($path);
- local $ENV{PERLDB_OPTS} = "RemotePort=$host:$port";
- # sleep 1;
- sleep(0.080);
- Win32::Process::Create(
- $pid,
- $EXECUTABLE_NAME,
- qq(perl -d $file ),
- # qq(perl -d $file > "$path/out" 2> "$path/err"),
- 1,
- NORMALPRIORITYCLASS,
- '.',
- ) or die Win32::FormatMessage( Win32::GetLastError() );
- # system( 1, qq($OSNAME -d $file > "$path/out" 2> "$path/err") );
- } else {
- my $pid = fork();
- die if not defined $pid;
- if ( not $pid ) {
- local $ENV{PERLDB_OPTS} = "RemotePort=$host:$port";
- # sleep 1;
- sleep(0.080);
- exec qq($EXECUTABLE_NAME -d $file );
- # exec qq($EXECUTABLE_NAME -d $file > "$path/out" 2> "$path/err");
- exit 0;
- }
- }
- # return ($dir);
- return ( $dir, $pid );
-}
-
-done_testing();
-
-__END__
-
-Info: 06-initialize.t is effectively testing the win32/(linux, osx) bits of t/lib/Debugger.pm
\ No newline at end of file
@@ -0,0 +1,76 @@
+use strict;
+use warnings FATAL => 'all';
+
+use English qw( -no_match_vars );
+local $OUTPUT_AUTOFLUSH = 1;
+
+use version;
+use Test::More tests => 7;
+
+BEGIN {
+ use_ok( 'Term::ReadLine', '1.07' );
+}
+
+diag("\nInfo: Perl $PERL_VERSION");
+diag("Info: OS $OSNAME");
+
+SKIP: {
+ skip 'Skipping Columns & Lines as we are not running on win32', 2 if $OSNAME ne 'MSWin32';
+ is( $ENV{COLUMNS}, undef, '$ENV{COLUMS} is undefined' );
+ is( $ENV{LINES}, undef, '$ENV{LINES} is undefined' );
+}
+
+is( $ENV{PERL_RL}, undef, '$ENV{PERL_RL} is undefined' );
+
+{
+ eval 'use Term::ReadLine::Gnu';
+ if ($EVAL_ERROR) {
+ diag 'Info: Term::ReadLine::Gnu is not installed';
+ } else {
+ diag 'Info: Term::ReadLine::Gnu installed';
+ }
+}
+
+SKIP: {
+ eval { require Term::ReadLine::Gnu };
+ skip 'Term::ReadLine::Gnu not installed', 2 if $EVAL_ERROR;
+ use_ok('Term::ReadLine::Gnu');
+ cmp_ok(
+ version->parse($Term::ReadLine::Gnu::VERSION), 'ge', 0,
+ 'Term::ReadLine::Gnu version = ' . version->parse($Term::ReadLine::Gnu::VERSION)
+ );
+
+}
+
+{
+ my $term;
+ eval { $term = Term::ReadLine->new('none') };
+ if ($EVAL_ERROR) {
+ diag 'Warning: If test fail consider installing Term::ReadLine::Gnu' if $OSNAME ne 'MSWin32';
+ local $ENV{PERL_RL} = ' ornaments=0';
+ diag 'INFO: Setting $ENV{PERL_RL} -> ' . $ENV{PERL_RL};
+ } else {
+ diag 'Info: Using ReadLine implementation -> ' . $term->ReadLine;
+ }
+}
+
+# Patch for Debug::Client ticket #831 (MJGARDNER)
+# Turn off ReadLine ornaments
+##local $ENV{PERL_RL} = ' ornaments=0';
+if ( !exists $ENV{TERM} ) {
+ if ( $OSNAME eq 'MSWin32' ) {
+ $ENV{TERM} = 'dumb';
+ diag 'INFO: Setting $ENV{TERM} -> ' . $ENV{TERM};
+ } else {
+ local $ENV{PERL_RL} = ' ornaments=0';
+ diag 'INFO: Setting $ENV{PERL_RL} -> ' . $ENV{PERL_RL};
+ }
+}
+
+diag 'INFO: $ENV{TERM} -> ' . $ENV{TERM};
+ok( $ENV{TERM} !~ /undef/, '$ENV{TERM} is set to -> ' . $ENV{TERM} );
+
+
+done_testing();
+
+__END__
@@ -0,0 +1,101 @@
+use strict;
+use warnings FATAL => 'all';
+
+use English qw( -no_match_vars );
+local $OUTPUT_AUTOFLUSH = 1;
+
+use Term::ReadLine;
+if ( $OSNAME eq 'MSWin32' ) {
+ $ENV{TERM} = 'dumb';
+ local $ENV{PERL_RL} = ' ornaments=0';
+}
+
+if ( $OSNAME eq 'MSWin32' ) {
+ require Win32::Process;
+ require Win32;
+ use constant NORMALPRIORITYCLASS => 0x00000020;
+}
+
+use Test::More tests => 4;
+use Test::Deep;
+
+use File::Temp qw(tempdir);
+my ( $host, $port, $porto, $listen, $reuse_addr );
+SCOPE: {
+ $host = '127.0.0.1';
+ $port = 24_642 + int rand(1000);
+ $porto = 'tcp';
+ $listen = 1;
+ $reuse_addr = 1;
+ my ( $dir, $pid ) = run_perl5db( 't/eg/05-io.pl', $host, $port );
+ require Debug::Client;
+ ok( my $debugger = Debug::Client->new(
+ host => $host,
+ port => $port,
+ porto => $porto,
+ listen => $listen,
+ reuse => $reuse_addr
+ ),
+ 'initialize with prams'
+ );
+ $debugger->run;
+
+ sleep 1;
+
+ ok( $debugger->quit, 'quit with prams' );
+ if ( $OSNAME eq 'MSWin32' ) {
+ $pid->Kill(0) or die "Cannot kill '$pid'";
+ }
+}
+
+SCOPE: {
+ $host = '127.0.0.1';
+ $port = 24_642;
+ my ( $dir, $pid ) = run_perl5db( 't/eg/05-io.pl', $host, $port );
+ require Debug::Client;
+ ok( my $debugger = Debug::Client->new(), 'initialize without prams' );
+ $debugger->run;
+
+ sleep 1;
+
+ ok( $debugger->quit, 'quit witout prams' );
+ if ( $OSNAME eq 'MSWin32' ) {
+ $pid->Kill(0) or die "Cannot kill '$pid'";
+ }
+}
+
+sub run_perl5db {
+ my ( $file, $host, $port ) = @_;
+ my $dir = tempdir( CLEANUP => 0 );
+ my $path = $dir;
+ my $pid;
+ if ( $OSNAME eq 'MSWin32' ) {
+ $path = Win32::GetLongPathName($path);
+ local $ENV{PERLDB_OPTS} = "RemotePort=$host:$port";
+
+ sleep 1;
+
+ Win32::Process::Create(
+ $pid, $EXECUTABLE_NAME, qq(perl -d $file ),
+ 1, NORMALPRIORITYCLASS, '.',
+ ) or die Win32::FormatMessage( Win32::GetLastError() );
+ } else {
+ my $pid = fork();
+ die if not defined $pid;
+ if ( not $pid ) {
+ local $ENV{PERLDB_OPTS} = "RemotePort=$host:$port";
+
+ sleep 1;
+
+ exec qq($EXECUTABLE_NAME -d $file > "$path/out" 2> "$path/err");
+ exit 0;
+ }
+ }
+ return ( $dir, $pid );
+}
+
+done_testing();
+
+__END__
+
+Info: 06-initialize.t is effectively testing the win32/(linux, osx) bits of t/lib/Debugger.pm
@@ -0,0 +1,101 @@
+use strict;
+use warnings FATAL => 'all';
+
+use English qw( -no_match_vars );
+local $OUTPUT_AUTOFLUSH = 1;
+
+use Test::More tests => 12;
+use Test::Deep;
+use t::lib::Debugger;
+
+my ( $dir, $pid ) = start_script('t/eg/05-io.pl');
+my $path = $dir;
+
+if ( $OSNAME =~ /Win32/i ) {
+ require Win32;
+ $path = Win32::GetLongPathName($dir);
+}
+
+# Patch for Debug::Client ticket #831 (MJGARDNER)
+# Turn off ReadLine ornaments
+##local $ENV{PERL_RL} = ' ornaments=0';
+##$ENV{TERM} = 'dumb' if ! exists $ENV{TERM};
+
+my $debugger = t::lib::Debugger::start_debugger();
+
+SCOPE:{
+ my $out = $debugger->get;
+
+ like( $out, qr/Loading DB routines from perl5db.pl version/, 'loading line' );
+ like( $out, qr{main::\(t/eg/05-io.pl:4\):\s*\$\| = 1;}, 'line 4' );
+}
+# diag("Info: Perl version '$]'"); old
+# diag("Info: Perl version '$^V'"); new
+my $prefix = ( substr( $] , 0, 5 ) eq '5.008006' ) ? "Default die handler restored.\n" : '';
+# diag("prefix: $prefix");
+
+# see relevant fail report here:
+# http://www.nntp.perl.org/group/perl.cpan.testers/2009/12/msg6486949.html
+# http://www.nntp.perl.org/group/perl.cpan.testers/2009/12/msg6481372.html
+
+{
+ my @out = $debugger->step_in;
+## diag ( "\n @out" );
+ cmp_deeply( \@out, [ 'main::', 't/eg/05-io.pl', 6, 'print "One\n";' ], 'line 6' ) or diag( $debugger->get_buffer );
+## diag( $debugger->get_buffer );
+}
+
+{
+ my @out = $debugger->step_in;
+ cmp_deeply( \@out, [ 'main::', 't/eg/05-io.pl', 7, 'print STDERR "Two\n";' ], 'line 7' )
+ or diag( $debugger->get_buffer );
+}
+
+{
+ my $out = slurp("$path/out");
+ # diag("output: $out");
+ is( $out, "One\n", 'STDOUT has One' );
+ my $err = slurp("$path/err");
+ # diag("error: $err");
+ # is( $err, 'STDERR is empty' );
+ is( $err, "${prefix}", 'STDERR is empty' );
+}
+
+{
+ my @out = $debugger->step_in;
+ cmp_deeply( \@out, [ 'main::', 't/eg/05-io.pl', 8, 'print "Three\n";' ], 'line 8' )
+ or diag( $debugger->get_buffer );
+}
+
+{
+ my $out = slurp("$path/out");
+ # diag("output: $out");
+ is( $out, "One\n", 'STDOUT has One' );
+ my $err = slurp("$path/err");
+ # diag("error: $err");
+ # is( $err, "Two\n", 'STDERR has Two' );
+ is( $err, "${prefix}Two\n", 'STDERR has Two' );
+}
+
+{
+ my @out = $debugger->step_in;
+ cmp_deeply( \@out, [ 'main::', 't/eg/05-io.pl', 9, 'print "Four";' ], 'line 9' )
+ or diag( $debugger->get_buffer );
+}
+
+{
+ my $out = slurp("$path/out");
+ # diag("output: $out");
+ is( $out, "One\nThree\n", 'STDOUT has One Three' );
+ my $err = slurp("$path/err");
+ # diag("error: $err");
+ # is( $err, "Two\n", 'STDERR has Two' );
+ is( $err, "${prefix}Two\n", 'STDERR has Two' );
+}
+
+$debugger->run;
+$debugger->quit;
+
+done_testing();
+
+__END__
@@ -1,24 +1,16 @@
-#!/usr/bin/perl
-
-use 5.010;
use strict;
-use warnings FATAL => 'all';
-
-# Turn on $OUTPUT_AUTOFLUSH
-local $| = 1;
+use warnings FATAL => 'all';
-use Test::More tests => 5;
-use Test::Deep;
-use PadWalker;
-use t::lib::Debugger;
+use English qw( -no_match_vars );
+local $OUTPUT_AUTOFLUSH = 1;
-ok( start_script('t/eg/14-y_zero.pl'), 'start script' );
+use FindBin qw($Bin);
+use lib map "$Bin/$_", 'lib', '../lib';
-my $debugger;
-ok( $debugger = start_debugger(), 'start debugger' );
+use t::lib::Top_Tail;
-ok( $debugger->get, 'get debugger' );
+# run all the test methods
+Test::Class->runtests;
-like( $debugger->run, qr/Debugged program terminated/, 'Debugged program terminated' );
+__END__
-like( $debugger->quit, qr/1/, 'debugger quit' );
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+
+use 5.010;
+use strict;
+use warnings FATAL => 'all';
+
+# Turn on $OUTPUT_AUTOFLUSH
+local $| = 1;
+
+use Test::More tests => 5;
+use Test::Deep;
+use PadWalker;
+use t::lib::Debugger;
+
+ok( start_script('t/eg/14-y_zero.pl'), 'start script' );
+
+my $debugger;
+ok( $debugger = start_debugger(), 'start debugger' );
+
+ok( $debugger->get, 'get debugger' );
+
+like( $debugger->run, qr/Debugged program terminated/, 'Debugged program terminated' );
+
+like( $debugger->quit, qr/1/, 'debugger quit' );
@@ -54,9 +54,10 @@ isa_ok( $debugger, 'Debug::Client' );
{
my @out = $debugger->step_in;
+
# diag("@out");
# cmp_deeply( \@out, [ 'main::', 't/eg/01-add.pl', 6, 'my $x = 1;' ], 'line 6' )
- # or diag( $debugger->buffer );
+ # or diag( $debugger->get_buffer );
}
{
@@ -70,13 +71,15 @@ isa_ok( $debugger, 'Debug::Client' );
{
my $out = $debugger->show_line;
+
# diag($out);
is( $out, "main::(t/eg/01-add.pl:7):\tmy \$y = 2;", 'show_line line 7' )
- or diag( $debugger->buffer );
+ or diag( $debugger->get_buffer );
}
{
my $out = $debugger->show_view;
+
# diag($out);
is( $out, "4: \$| = 1;
5
@@ -86,8 +89,8 @@ isa_ok( $debugger, 'Debug::Client' );
9
10: 1;
11
-12 __END__", 'show_view8' )
- or diag( $debugger->buffer );
+12 __END__", 'show_view8'
+ ) or diag( $debugger->get_buffer );
}
{
@@ -98,7 +101,7 @@ isa_ok( $debugger, 'Debug::Client' );
{
my @out = $debugger->step_in;
cmp_deeply( \@out, [ 'main::', 't/eg/01-add.pl', 8, 'my $z = $x + $y;' ], 'line 8' )
- or diag( $debugger->buffer );
+ or diag( $debugger->get_buffer );
}
{
@@ -106,7 +109,7 @@ isa_ok( $debugger, 'Debug::Client' );
like( $out, qr/1/, 'debugger quit' );
}
-done_testing( );
+done_testing();
1;
@@ -2,7 +2,7 @@
use 5.010;
use strict;
-use warnings FATAL => 'all';
+use warnings FATAL => 'all';
# Turn on $OUTPUT_AUTOFLUSH
local $| = 1;
@@ -38,19 +38,19 @@ my $perl5db_ver;
{
my @out = $debugger->step_in;
cmp_deeply( \@out, [ 'main::', 't/eg/03-return.pl', 6, 'my $x = 11;' ], 'line 6' )
- or diag( $debugger->buffer );
+ or diag( $debugger->get_buffer );
}
{
my @out = $debugger->step_in;
cmp_deeply( \@out, [ 'main::', 't/eg/03-return.pl', 7, 'my $q = f("foo\nbar");' ], 'line 7' )
- or diag( $debugger->buffer );
+ or diag( $debugger->get_buffer );
}
{
SKIP: {
skip( "perl5db v$perl5db_ver dose not support list context", 1 ) unless $perl5db_ver < 1.35;
my @out = $debugger->step_in;
- cmp_deeply( \@out, [ 'main::f', 't/eg/03-return.pl', 16, ' my ($in) = @_;' ], 'line 16' )
- or diag( $debugger->buffer );
+ cmp_deeply( \@out, [ 'main::f', 't/eg/03-return.pl', 16, ' my ($in) = @_;' ], 'line 16' )
+ or diag( $debugger->get_buffer );
}
}
@@ -59,23 +59,23 @@ my $perl5db_ver;
skip( "perl5db v$perl5db_ver dose not support list context", 1 ) unless $perl5db_ver < 1.35;
my @out = $debugger->step_out;
cmp_deeply( \@out, [ 'main::', 't/eg/03-return.pl', 8, '$x++;', ], 'line 8' )
- or diag( $debugger->buffer );
+ or diag( $debugger->get_buffer );
}
}
{
SKIP: {
skip( "perl5db v$perl5db_ver dose not support list context", 1 ) unless $perl5db_ver < 1.35;
my @out = $debugger->step_in;
- cmp_deeply( \@out, [ 'main::', 't/eg/03-return.pl', 9, q{my @q = g('baz', "foo\nbar", 'moo');} ], 'line 9' )
- or diag( $debugger->buffer );
+ cmp_deeply( \@out, [ 'main::', 't/eg/03-return.pl', 9, q{my @q = g( 'baz', "foo\nbar", 'moo' );} ], 'line 9' )
+ or diag( $debugger->get_buffer );
}
}
{
SKIP: {
skip( "perl5db v$perl5db_ver dose not support list context", 1 ) unless $perl5db_ver < 1.35;
my @out = $debugger->step_in;
- cmp_deeply( \@out, [ 'main::g', 't/eg/03-return.pl', 22, ' my (@in) = @_;' ], 'line 22' )
- or diag( $debugger->buffer );
+ cmp_deeply( \@out, [ 'main::g', 't/eg/03-return.pl', 22, ' my (@in) = @_;' ], 'line 22' )
+ or diag( $debugger->get_buffer );
}
}
@@ -87,8 +87,7 @@ my $perl5db_ver;
1 'foo
bar'
2 'moo');
- cmp_deeply( \@out, [ 'main::', 't/eg/03-return.pl', 10, '$x++;' ], 'line 10' )
- or diag( $debugger->buffer );
+ cmp_deeply( \@out, [ 'main::', 't/eg/03-return.pl', 10, '$x++;' ], 'line 10' ) or diag( $debugger->get_buffer );
}
}
@@ -97,9 +96,9 @@ bar'
skip( "perl5db v$perl5db_ver dose not support list context", 1 ) unless $perl5db_ver < 1.35;
my @out = $debugger->step_in;
cmp_deeply(
- \@out, [ 'main::', 't/eg/03-return.pl', 11, q{my %q = h(bar => "foo\nbar", moo => 42);} ],
+ \@out, [ 'main::', 't/eg/03-return.pl', 11, q{my %q = h( bar => "foo\nbar", moo => 42 );} ],
'line 11'
- ) or diag( $debugger->buffer );
+ ) or diag( $debugger->get_buffer );
}
}
@@ -107,8 +106,8 @@ bar'
SKIP: {
skip( "perl5db v$perl5db_ver dose not support list context", 1 ) unless $perl5db_ver < 1.35;
my @out = $debugger->step_in;
- cmp_deeply( \@out, [ 'main::h', 't/eg/03-return.pl', 28, ' my (%in) = @_;' ], 'line 28' )
- or diag( $debugger->buffer );
+ cmp_deeply( \@out, [ 'main::h', 't/eg/03-return.pl', 28, ' my (%in) = @_;' ], 'line 28' )
+ or diag( $debugger->get_buffer );
}
}
{
@@ -121,7 +120,7 @@ bar'
# TODO check how to test the return data in this case as it looks like an array
cmp_deeply( \@out, [ 'main::', 't/eg/03-return.pl', 12, '$x++;', '' ], 'line 12' )
- or diag( $debugger->buffer );
+ or diag( $debugger->get_buffer );
}
}
@@ -2,7 +2,7 @@
use 5.010;
use strict;
-use warnings FATAL => 'all';
+use warnings FATAL => 'all';
# Turn on $OUTPUT_AUTOFLUSH
local $| = 1;
@@ -36,7 +36,7 @@ my $debugger = start_debugger();
{
my @out = $debugger->step_in;
cmp_deeply( \@out, [ 'main::', 't/eg/02-sub.pl', 6, 'my $x = 11;' ], 'line 6' )
- or diag( $debugger->buffer );
+ or diag( $debugger->get_buffer );
}
{
@@ -45,15 +45,17 @@ my $debugger = start_debugger();
# h q, h R or h o to get additional info.
# DB<1>
my $out = $debugger->run;
+
# like( $out, qr/Debugged program terminated/ );
}
{
my $out = $debugger->quit;
+
# like( $out, qr/1/, 'debugger quit' );
}
-done_testing( );
+done_testing();
1;
@@ -39,15 +39,15 @@ my $perl5db_index;
{
my @out = $debugger->step_in;
cmp_deeply( \@out, [ 'main::', 't/eg/02-sub.pl', 6, 'my $x = 11;' ], 'line 6' )
- or diag( $debugger->buffer );
+ or diag( $debugger->get_buffer );
}
SKIP: {
skip( "perl5db $] dose not support c [line|sub]", 1 ) if $] =~ m/5.01500(3|4|5)/;SKIP: {
skip( "perl5db v$perl5db_ver dose not support list context", 1 ) if $perl5db_ver == 1.35;
my @out = $debugger->run(17);
- cmp_deeply( \@out, [ 'main::func1', 't/eg/02-sub.pl', 17, ' my $multi = $q * $w;' ], 'line 17' )
- or diag( $debugger->buffer );
+ cmp_deeply( \@out, [ 'main::func1', 't/eg/02-sub.pl', 17, ' my $multi = $q * $w;' ], 'line 17' )
+ or diag( $debugger->get_buffer );
}
}
@@ -2,7 +2,7 @@
use 5.010;
use strict;
-use warnings FATAL => 'all';
+use warnings FATAL => 'all';
# Turn on $OUTPUT_AUTOFLUSH
local $| = 1;
@@ -22,7 +22,7 @@ my $perl5db_ver;
{
my $out = $debugger->get;
$out =~ m/(?<ver>1.\d{2})(?<index>_\d{2})*$/m;
- $perl5db_ver = $+{ver} // 0;
+ $perl5db_ver = $+{ver} // 0;
like( $out, qr/Loading DB routines from perl5db.pl version/, 'loading line' );
like( $out, qr{main::\(t/eg/02-sub.pl:4\):\s*\$\| = 1;}, 'line 4' );
@@ -31,7 +31,7 @@ my $perl5db_ver;
{
my @out = $debugger->step_in;
cmp_deeply( \@out, [ 'main::', 't/eg/02-sub.pl', 6, 'my $x = 11;' ], 'line 6' )
- or diag( $debugger->buffer );
+ or diag( $debugger->get_buffer );
}
SKIP: {
@@ -39,8 +39,8 @@ SKIP: {
SKIP: {
skip( "perl5db v$perl5db_ver dose not support list context", 1 ) if $perl5db_ver == 1.35;
my @out = $debugger->run('func1');
- cmp_deeply( \@out, [ 'main::func1', 't/eg/02-sub.pl', 16, ' my ($q, $w) = @_;' ], 'line 16' )
- or diag( $debugger->buffer );
+ cmp_deeply( \@out, [ 'main::func1', 't/eg/02-sub.pl', 16, ' my ( $q, $w ) = @_;' ], 'line 16' )
+ or diag( $debugger->get_buffer );
}
}
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-
+
use 5.010;
use strict;
use warnings FATAL => 'all';
@@ -19,7 +19,7 @@ start_script('t/eg/14-y_zero.pl');
my $debugger;
$debugger = start_debugger();
$debugger->get;
-$debugger->set_breakpoint( 't/eg/14-y_zero.pl', '14' );
+$debugger->set_breakpoint( 't/eg/14-y_zero.pl', '13' );
$debugger->run;
@@ -31,7 +31,7 @@ foreach ( 1 .. 3 ) {
my @out;
@out = $debugger->get_y_zero();
- cmp_deeply( \@out, ["\$line = $_"], "y (0) \$line = $_" ) or diag( $debugger->buffer );
+ cmp_deeply( \@out, ["\$line = $_"], "y (0) \$line = $_" ) or diag( $debugger->get_buffer );
}
@@ -19,7 +19,7 @@ start_script('t/eg/14-y_zero.pl');
my $debugger;
$debugger = start_debugger();
$debugger->get;
-$debugger->set_breakpoint( 't/eg/14-y_zero.pl', '14' );
+$debugger->set_breakpoint( 't/eg/14-y_zero.pl', '13' );
$debugger->run;
@@ -1,19 +1,16 @@
-#!/usr/bin/env perl
-
use strict;
-use warnings;
+use warnings FATAL => 'all';
-# Turn on $OUTPUT_AUTOFLUSH
-$| = 1;
+use English qw( -no_match_vars );
+local $OUTPUT_AUTOFLUSH = 1;
use FindBin qw($Bin);
use lib map "$Bin/$_", 'lib', '../lib';
use t::lib::Test_1415;
-# run all the test methods in Example::Test
+# run all the test methods
Test::Class->runtests;
-1;
-
__END__
+
@@ -12,14 +12,14 @@ use Test::More tests => 1;
use t::lib::Debugger;
if (rc_file) {
- diag('');
- diag('***************************************');
- diag('** YOU SEEM TO HAVE A ".perldb" FILE **');
- diag('** IN YOUR HOME DIRECTORY. IF YOU **');
- diag('** SEE TEST FAILURES, PLEASE MOVE IT **');
- diag('** SOMEWHERE ELSE, TRY AGAIN AND **');
- diag('** RESTORE IT AFTER INSTALLATION. **');
- diag('***************************************');
+ diag('');
+ diag('***************************************');
+ diag('** YOU SEEM TO HAVE A ".perldb" FILE **');
+ diag('** IN YOUR HOME DIRECTORY. IF YOU **');
+ diag('** SEE TEST FAILURES, PLEASE MOVE IT **');
+ diag('** SOMEWHERE ELSE, TRY AGAIN AND **');
+ diag('** RESTORE IT AFTER INSTALLATION. **');
+ diag('***************************************');
}
ok 1;
@@ -5,16 +5,16 @@ $| = 1;
my $x = 11;
my $y = 22;
-my $q = func1($x, $y);
+my $q = func1( $x, $y );
my $z = $x + $y;
-my $t = func1(19, 23);
+my $t = func1( 19, 23 );
$t++;
$z++;
sub func1 {
- my ($q, $w) = @_;
- my $multi = $q * $w;
- my $add = $q + $w;
- return $multi;
+ my ( $q, $w ) = @_;
+ my $multi = $q * $w;
+ my $add = $q + $w;
+ return $multi;
}
@@ -1,31 +1,31 @@
use strict;
use warnings;
-
+
$| = 1;
-
+
my $x = 11;
my $q = f("foo\nbar");
$x++;
-my @q = g('baz', "foo\nbar", 'moo');
+my @q = g( 'baz', "foo\nbar", 'moo' );
$x++;
-my %q = h(bar => "foo\nbar", moo => 42);
+my %q = h( bar => "foo\nbar", moo => 42 );
$x++;
-
-
+
+
sub f {
- my ($in) = @_;
- my $x = 1;
- return $in;
+ my ($in) = @_;
+ my $x = 1;
+ return $in;
}
-
+
sub g {
- my (@in) = @_;
- my $x = 1;
- return @in;
+ my (@in) = @_;
+ my $x = 1;
+ return @in;
}
-
+
sub h {
- my (%in) = @_;
- my $x = 1;
- return %in;
+ my (%in) = @_;
+ my $x = 1;
+ return %in;
}
@@ -7,11 +7,10 @@ use warnings;
# Turn on $OUTPUT_AUTOFLUSH
$| = 1;
-foreach (0..3)
-{
- my $line = $_;
- last unless defined $line;
- print "$_ : $line \n";
+foreach ( 0 .. 3 ) {
+ my $line = $_;
+ last unless defined $line;
+ print "$_ : $line \n";
}
1;
@@ -3,25 +3,29 @@ package t::lib::Debugger;
use strict;
use warnings FATAL => 'all';
-use English qw( -no_match_vars ); # Avoids regex performance penalty
+use English qw( -no_match_vars );
local $OUTPUT_AUTOFLUSH = 1;
+use Term::ReadLine;
+if ( $OSNAME eq 'MSWin32' ) {
+ $ENV{TERM} = 'dumb';
+ local $ENV{PERL_RL} = ' ornaments=0';
+}
+
if ( $OSNAME eq 'MSWin32' ) {
require Win32::Process;
require Win32;
use constant NORMALPRIORITYCLASS => 0x00000020;
}
-# Turn on $OUTPUT_AUTOFLUSH
-# local $| = 1;
+#use Data::Printer { caller_info => 1, colored => 1, };
use Exporter ();
use File::Temp qw(tempdir);
-use Time::HiRes 'sleep';
our @ISA = 'Exporter';
our @EXPORT = qw(start_script start_debugger slurp rc_file);
-my $host = 'localhost';
+my $host = '127.0.0.1';
my $port = 24642 + int rand(1000);
sub start_script {
@@ -31,44 +35,35 @@ sub start_script {
my $path = $dir;
my $pid;
if ( $OSNAME eq 'MSWin32' ) {
-
+ $pid = 'fudge'; # as we don't get one from win32
$path = Win32::GetLongPathName($path);
local $ENV{PERLDB_OPTS} = "RemotePort=$host:$port";
- sleep(0.080);
- # Win32::Process::Create(
- # $pid,
- # $EXECUTABLE_NAME,
- # # qq(perl -d $file ),
- # qq(perl -d $file > "$path/out" 2> "$path/err"),
- # 1,
- # NORMALPRIORITYCLASS,
- # '.',
- # ) or die Win32::FormatMessage( Win32::GetLastError() );
+ sleep 1;
system( 1, qq($^X -d $file > "$path/out" 2> "$path/err") );
+
#spawns an external process and immediately returns its process designator, without waiting for it to terminate
} else {
- my $pid = fork();
+ $pid = fork();
die if not defined $pid;
if ( not $pid ) {
local $ENV{PERLDB_OPTS} = "RemotePort=$host:$port";
- sleep(0.080);
- # exec qq($EXECUTABLE_NAME -d $file );
+
+ sleep 1;
exec qq($EXECUTABLE_NAME -d $file > "$path/out" 2> "$path/err");
exit 0;
}
}
- return ($dir);
+ return ( $dir, $pid );
}
sub start_debugger {
require Debug::Client;
- my $debugger = Debug::Client->new( host => $host, port => $port, );
- # $debugger->listener;
+ my $debugger = Debug::Client->new( host => $host, port => $port, );
return $debugger;
}
@@ -1,6 +1,9 @@
package t::lib::Test_1415;
-use base qw(Test::Class);
+use strict;
+use warnings FATAL => 'all';
+
+use parent qw(Test::Class);
use Test::More;
use Test::Deep;
@@ -0,0 +1,33 @@
+package t::lib::Top_Tail;
+
+use strict;
+use warnings FATAL => 'all';
+
+use parent qw(Test::Class);
+use Test::More;
+use Test::Deep;
+
+# startup methods are run before every test method.
+sub startup : Test(4) {
+ my $self = shift;
+
+ use_ok( 't::lib::Debugger');
+ ok( start_script('t/eg/14-y_zero.pl'), 'start script' );
+ ok( $self->{debugger} = start_debugger(), 'start debugger' );
+ ok( $self->{debugger}->get, 'get debugger' );
+
+}
+
+# teardown methods are run after every test method.
+sub teardown : Test(2) {
+ my $self = shift;
+
+ like( $self->{debugger}->run, qr/Debugged program terminated/, 'Debugged program terminated' );
+ like( $self->{debugger}->quit, qr/1/, 'debugger quit' );
+
+}
+
+1;
+
+__END__
+
@@ -0,0 +1,95 @@
+use strict;
+use warnings;
+
+#BEGIN {
+# unless ( $ENV{RELEASE_TESTING} ) {
+# require Test::More;
+# Test::More::plan(
+# skip_all => 'these tests are for release candidate testing' );
+# }
+#}
+
+our $VERSION = '0.04';
+use English qw( -no_match_vars );
+
+local $OUTPUT_AUTOFLUSH = 1;
+
+# use Data::Printer {caller_info => 1, colored => 1,};
+
+use Test::More;
+use Test::Requires { 'ExtUtils::MakeMaker' => 6.64 };
+use Test::Requires { 'File::Spec::Functions' => 3.40 };
+use Test::Requires { 'List::Util ' => 1.27 };
+
+use List::Util qw/max/;
+
+my @modules = qw(
+ Carp
+ Exporter
+ File::HomeDir
+ File::Spec
+ File::Temp
+ IO::Socket::IP
+ List::Util
+ PadWalker
+ Term::ReadLine
+ Test::CheckDeps
+ Test::Class
+ Test::Deep
+ Test::More
+ Test::Requires
+ Win32
+ Win32::Process
+ parent
+ version
+);
+
+# replace modules with dynamic results from MYMETA.json if we can
+# (hide CPAN::Meta from prereq scanner)
+my $cpan_meta = "CPAN::Meta";
+if ( -f "MYMETA.json" && eval "require $cpan_meta" ) { ## no critic
+ if ( my $meta = eval { CPAN::Meta->load_file("MYMETA.json") } ) {
+ my $prereqs = $meta->prereqs;
+
+ #p $prereqs;
+ my %uniq =
+ map { $_ => 1 } map { keys %$_ } map { values %$_ } values %$prereqs;
+ $uniq{$_} = 1 for @modules; # don't lose any static ones
+ @modules = sort keys %uniq;
+ }
+}
+
+my @reports = [qw/Version Module/];
+
+for my $mod (@modules) {
+ next if $mod eq 'perl';
+ my $file = $mod;
+ $file =~ s{::}{/}g;
+ $file .= ".pm";
+ my ($prefix) = grep { -e catfile( $_, $file ) } @INC;
+ if ($prefix) {
+ my $ver = MM->parse_version( catfile( $prefix, $file ) );
+ $ver = "undef" unless defined $ver; # Newer MM should do this anyway
+ push @reports, [ $ver, $mod ];
+ } else {
+ push @reports, [ "missing", $mod ];
+ }
+}
+
+if (@reports) {
+ my $vl = max map { length $_->[0] } @reports;
+ my $ml = max map { length $_->[1] } @reports;
+ splice @reports, 1, 0, [ "-" x $vl, "-" x $ml ];
+ diag "Prerequisite Report:\n", map { sprintf( " %*s %*s\n", $vl, $_->[0], -$ml, $_->[1] ) } @reports;
+}
+
+pass;
+
+done_testing();
+
+__END__
+
+pass;
+
+# vim: ts=2 sts=2 sw=2 et:
+