=head2 Writing Your Own Debugger
=head3 Environment Variables
-
+
The C<PERL5DB> environment variable can be used to define a debugger.
For example, the minimal "working" debugger (it actually doesn't do anything)
consists of one line:
-
+
sub DB::DB {}
It can easily be defined like this:
-
+
$ PERL5DB="sub DB::DB {}" perl -d your-script
Another brief debugger, slightly more useful, can be created
This debugger prints a number which increments for each statement
encountered and waits for you to hit a newline before continuing
to the next statement.
-
+
The following debugger is actually useful:
-
+
{
package DB;
sub DB {}
After the rc file is read, the debugger reads the PERLDB_OPTS
environment variable and uses it to set debugger options. The
contents of this variable are treated as if they were the argument
-of an C<O ...> debugger command (q.v. in L<perldebug/Options>).
+of an C<o ...> debugger command (q.v. in L<perldebug/Options>).
=head3 Debugger internal variables
In addition to the file and subroutine-related variables mentioned above,
main::bar((eval 170):2):
42
-with this one, once the C<O>ption C<frame=2> has been set:
+with this one, once the C<o>ption C<frame=2> has been set:
- DB<4> O f=2
+ DB<4> o f=2
frame = '2'
DB<5> t print foo() * bar()
3: foo() * bar()