qleem has asked for the wisdom of the Perl Monks concerning the following question:
Including this code causes the script to run to completion and exit when called with perl -d myscript.pl Works fine when removed. I'm guessing messing with the definition of the DB package is overwriting something I shouldn't be. I was hoping the monks could shed some light as to what's going on and how to work around it or do it correctly. Thanks!#!/usr/bin/perl use strict; use warnings; print 1; #insert __END__ here and debugger works fine use DB; sub import { *{(caller)[0].'::called_args'} = \&called_args if $_[1] eq 'called_args'; } sub called_args { &DB::called_args } package DB; sub called_args { my ($level) = @_; my @foo = caller( ( $level || 0 ) + 3 ); wantarray ? @DB::args : \@DB::args; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Debugger doesn't interrupt
by Mr. Muskrat (Canon) on Jun 27, 2014 at 18:24 UTC | |
|
Re: Debugger doesn't interrupt # caller() in DB:: context
by LanX (Saint) on Jun 27, 2014 at 22:29 UTC | |
|
Re: Debugger doesn't interrupt
by LanX (Saint) on Jun 26, 2014 at 21:16 UTC |