Reputation: 685
I wrote a bunch of functions for the Perl debugger, but every time I want to test them I need to do export PERL5DB="my code"
. Is there a way I can set it to a file and then use it?
I tried adding a file myperldb.pl
in /usr/lib/perl/
, but it doesn't allow me. That's because I am not the administrator user. So is there a workaround to it?
Upvotes: 2
Views: 97
Reputation: 25282
You may use this command:
PERL5DB="BEGIN{ require 'my_debugger.pm' }" perl -d script.pl
$cat my_debugger.pm
package DB;
sub DB {
}
sub sub {
print "$DB::sub called\n";
return &$DB::sub;
}
1;
You may find more information here.
Upvotes: 0
Reputation: 118695
Make a copy of /usr/lib/perl/perl5db.pl
in some other directory, change it to your heart's content, and debug your scripts with
perl -I/dir/that/contains/your/perl5db.pl/copy/ -d your_script.pl
The -I<dir>
switch will get perl to look in the directory you choose to find libraries before it looks in its default directories.
Upvotes: 4