home *** CD-ROM | disk | FTP | other *** search
/ Acorn User 10 / AU_CD10.iso / Updates / Perl / Non-RPC / Docs / RISCOS-Library-Docs / Throwback.pm < prev    next >
Text File  |  1999-04-17  |  2KB  |  63 lines

  1. NAME
  2.     RISCOS::Throwback -- provide throwback for perl
  3.  
  4. SYNOPSIS
  5.         use RISCOS::Throwback;
  6.  
  7.  
  8. DESCRIPTION
  9.     `RISCOS::Throwback' attaches handlers to capture messages
  10.     generated by `die' and `warn' and send them via the throwback
  11.     system to a text editor, providing a rapid way to go to the
  12.     source code that generated the error.
  13.  
  14.     The module works by attaching to perl's `$SIG{__DIE__}' and
  15.     `$SIG{__WARN__}' handlers, parsing the error messages that it
  16.     receives, and forwarding them to `DDEUtils'. Unfortunately
  17.     messages generated by `yyerror' due to syntax errors detected by
  18.     the lexer do not use `$SIG{__DIE__}', but are printed direct to
  19.     `STDERR', so there is no simple way to capture this text.
  20.  
  21.     The module provides two subroutines to allow the user to
  22.     generate throwback.
  23.  
  24.     throwback <filename>, <line>, <seriousness>, <message>
  25.         Send an "error" message for the specified file.
  26.         *seriousness* values are:
  27.  
  28.     0 warning
  29.  
  30.     1 error
  31.  
  32.     2 serious error
  33.  
  34.  
  35.     throwback_info <filename>, <line>, <message>
  36.         Sends an "informational message" for the specified file.
  37.  
  38.  
  39. BUGS
  40.     As noted, perl doesn't (yet) allow capture of all errors found
  41.     while parsing the script. Also, the pattern matcher doesn't
  42.     always correctly extract the line number from the message, which
  43.     creates spurious line numbers in the text editor's throwback
  44.     window. Ultimately what is needed is a well defined `C' hook
  45.     inside perl for capturing diagnostic output.
  46.  
  47.     There is no option to make the line-number and filename in
  48.     runtime errors and warnings refer to the last filehandle and
  49.     line, rather than the script line.
  50.  
  51.     Throwback naïvely assumes that a script name of '-', '-e' or
  52.     'eval 1' refers to a file.
  53.  
  54.     Throwback appears to be giving double messages for syntax errors
  55.     inside modules. I presume this is due to problems with `eval'
  56.     and `__DIE__' handlers. (the handler is called once inside the
  57.     `eval', and a second time from the cleanup performed by `use'
  58.     after (failing) to pass the module).
  59.  
  60. AUTHOR
  61.     Nicholas Clark <nick@unfortu.net>
  62.  
  63.