lib/perl5db/t/taint Tests for the Perl debugger
lib/perl5db/t/test-l-statement-1 Tests for the Perl debugger
lib/perl5db/t/test-l-statement-2 Tests for the Perl debugger
+lib/perl5db/t/test-m-statement-1 Tests for the Perl debugger
lib/perl5db/t/test-r-statement Tests for the Perl debugger
lib/perl5db/t/test-w-statement-1 Tests for the Perl debugger
lib/perl5db/t/uncalled-subroutine Tests for the Perl debugger
}
}
-plan(86);
+plan(88);
my $rc_filename = '.perldb';
);
}
-# Add a test for H (without arguments)
+# Test the m statement.
{
my $wrapper = DebugWrap->new(
{
);
}
+# Test the m statement.
+{
+ my $wrapper = DebugWrap->new(
+ {
+ cmds =>
+ [
+ 'b 41',
+ 'c',
+ 'm $obj',
+ 'q',
+ ],
+ prog => '../lib/perl5db/t/test-m-statement-1',
+ }
+ );
+
+ $wrapper->contents_like(qr#^greet$#ms,
+ "Test m for obj - 1",
+ );
+
+ $wrapper->contents_like(qr#^via UNIVERSAL: can$#ms,
+ "Test m for obj - 1",
+ );
+}
+
END {
1 while unlink ($rc_filename, $out_fn);
}
--- /dev/null
+use strict;
+use warnings;
+
+package MyClass;
+
+sub new
+{
+ my $class = shift;
+
+ my $self = bless {}, $class;
+
+ $self->_init(@_);
+
+ return $self;
+}
+
+sub _init
+{
+ my $self = shift;
+
+ $self->{foo} = 'bar';
+
+ return;
+}
+
+sub greet
+{
+ my ($self, $msg) = @_;
+
+ print "$msg - $self->{foo}\n";
+
+ return;
+}
+
+1;
+
+package main;
+
+my $obj = MyClass->new;
+
+$obj->greet("Hello");
+
+1;