[Asterisk-Dev] Does anyone know how to get a perl debugger t

astdev at newww.com astdev at newww.com
Thu Sep 25 10:47:53 MST 2003


On 25-Sep-03 Steven Critchfield wrote:
> On Thu, 2003-09-25 at 08:48, Fats Neutron wrote:
>> I have been trying to figure this one out and decided ask the list as you
>> probably have an answer.
>> 
>> What I am trying to do is setup a perl dev environment so that I can write
>> an AGI script for interfacing with Asterisk. Before I get started I want to
>> ensure I can launch the debugger when the script gets run from asterisk so
>> that I can step through the code during testing.
>> 
>> I have been looking at maybe using the perl environment called Komodo on
>> Linux from Active State. It's a pretty straight format IDE and relatively
>> cheap.
>> 
>> Have anyone managed to do boot the debuggers on entry top the agi and what
>> tools do you use for perl development.
> 
> Your problem is mainly trying to connect to the process that you want to
> deal with. I don't think the perl debugger works like gdb in that you
> can connect to a already running process.
> 
> Of course I have to ask why you need a full dubugging environment when
> you could just as well use a few prints to STDERR and watch the console
> to see what comes out. AGI isn't itself so dificult that once you have
> your base few functions down with respect to dealing with asterisk that
> the rest is all that difficult to do. 
> -- 
> Steven Critchfield  <critch at basesys.com>
> 
> _______________________________________________
> Asterisk-Dev mailing list
> Asterisk-Dev at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-dev


Printing diagnostics to STDERR is your best bet. I have also used a
global variable $SHELL to indicate if the script is being run from 
the shell or as a true AGI and then code prompts as follows:

sub get_empid {
  if ($SHELL) {
        $empid = $term->readline("enter employer number: ");
  }
  else {
        $empid  = $AGI->get_data("cs/employerid",$wait,7);
  }

  return $empid;
}


This can be very useful if your trying to just debug the flow of the
script or interactions between the script and other systems ie. 
web or database servers.

        Dave

----------------------------------------------------------------
Dave Belser (astdev at newww.com)



More information about the asterisk-dev mailing list