On Wed, Apr 17, 2002 at 02:03:21PM -0400, I wrote:
> There also may be a way of setting
> it in the .perldb startup file. (but I've never found .perldb to be a
> useful as I want it to be.)

After I posted that, it occured to me that putting the GET argument in
the perldb file is pretty straightforward too. A .perldb containing:

@ARGV=('type=preview_classification_data_detail&classid=46&cat_ids=53&' .
  'cat_names=Type&cat_ids=54&cat_names=Pathway&cat_ids=55&cat_names=Cell&' .
  'cat_count=3&unique_file=tsv-gene-mgr-101905348171.tsv&%0D%0ABMP-2A%09' .
  'data=%23DATA+FOR+CNS_Stem_Cell_7%0D%0A%23GENENAME%09Type%09Pathway%09Cell' .
  'SEC%09BMP%09neuron%0D%0ABMP-2B%09SEC%09BMP%09oligodendrocyte');

will set up the CGI parameters into the argument list, where CGI.pm's 
debugging mode will expect to find it.

Other interesting things to put in your .perldb include:

   ## break on warnings or errors.
   @ENV{__WARN__,__DIE__} = sub { $DB::single++ unless $^S };


And for CGI scripts, sometimes it is helpful to see the output
rendered after the script runs. (Assuming development on Unix with
netscape as a browser)

  BEGIN {
      # redirect STDOUT to a file, but restore it later.
      open SAVEOUT, ">&STDOUT";
      open STDOUT, "|tee perldb-$$"
  }

  END {
      close STDOUT; # close pipe to tee
      open STDOUT, ">&SAVEOUT"; # restore STDOUT
      # re-open the CGI output, strip headers.
      open DEBUGOUT, "perldb-$$";  
      open DEBUGHTML, ">perldb-$$.html"; 
      while(<DEBUGOUT>) {
          print DEBUGHTML if /^\r?$/ .. eof;
      }
      close DEBUTOUT;
      close DEBUGHTML;
      # notify netscape to display the file.
      system("netscape -remote 'openFile('`pwd`'/perldb-$$.html)'");
  }


The thing the .perldb doesn't do, and which causes it to to always
seem worthless to me, is allow you to save your current breakpoints,
watchpoints, and actions. Maybe it does now, Ilya has worked on
it. And like most other things that he has touched it now has dozens
more features, some of which seem useful, but with an interface I just
can't wrap my head around.



-- 
"Daddy. The Powerpuff Girls aren't fighting. 
They are saving the day." -- Samantha Langmead, age 4 1/2.

Reply via email to