Apache::ASP Powered by ModPerl & Apache Powered by Apache::ASP
Demo ASP: syntax_error.asp 2014-11-01

We are creating a perl syntax error... this should demonstrate how error handling is done. Please check the error log file if you are interested in the output there.

You can turn this error messaging off by setting the Debug variable in the ASP config to 1 or 0.

Also here is an example of how you can use debugging, an API extension $Response->Debug(@args), in your script. The debug output will show up below, and in your error logs. This user style debugging is turned off with the same Debug setting set to 0.

Try this script also with buffering on.

This script by default does a runtime syntax error. If you would like to see a script compile error, click here.

view this file's source

Errors Output

  1. Can't call method "SyntaxError" on an undefined value at /usr/local/proj/asp/eg/syntax_error.asp line 59. , /usr/local/share/perl5/Apache/ASP.pm line 1522
Debug Output
  1. RUN ASP (v2.62) for /usr/local/proj/asp/eg/syntax_error.asp
  2. call srand() post fork
  3. GlobalASA package Apache::ASP::Demo
  4. global.asa was not cached for __ASP__usr_local_proj_asp_eg__xxApache::ASP::Demo
  5. compiling global.asa Apache::ASP::Demo __ASP__usr_local_proj_asp_eg__xxApache::ASP::Demo exists 1 - asp: Apache::ASP=HASH(0x7f768c47f5c8); compiled: HASH(0x7f768c418470); exists: 1; package: Apache::ASP::Demo; - --- - exists: 0; mtime: 0;
  6. global.asa routines - Application_OnEnd: 1; Application_OnStart: 1; Script_OnEnd: 1; Script_OnFlush: 1; Script_OnStart: 1; Session_OnEnd: 1; Session_OnStart: 1;
  7. creating dbm for file /tmp/asp_demo/server/internal, db SDBM_File, serializer: Data::Dumper
  8. creating dbm for file /tmp/asp_demo/server/application, db SDBM_File, serializer: Data::Dumper
  9. refreshing 0c232771d3cfd6c757c95ed2715fac2f with timeout 1414801007
  10. new session id 0c232771d3cfd6c757c95ed2715fac2f
  11. creating dbm for file /tmp/asp_demo/0c/0c232771d3cfd6c757c95ed2715fac2f, db SDBM_File, serializer: Data::Dumper
  12. tieing session 0c232771d3cfd6c757c95ed2715fac2f
  13. clearing starting session
  14. Session_OnStart - session: 0c232771d3cfd6c757c95ed2715fac2f;
  15. executing Session_OnStart
  16. parse file /usr/local/proj/asp/eg/syntax_error.asp
  17. parsing /usr/local/proj/asp/eg/syntax_error.asp
  18. found header.inc at /usr/local/proj/asp/eg/header.inc
  19. runtime exec of dynamic include header.inc args ()
  20. parse file /usr/local/proj/asp/eg/header.inc
  21. parsing /usr/local/proj/asp/eg/header.inc
  22. start parse of data - 1145
  23. undefing sub Apache::ASP::Demo::__ASP__usr_local_proj_asp_eg_header_incx3864049467064319c46bd308cab557d6xINC code CODE(0x7f768cb534d0)
  24. compiling into package Apache::ASP::Demo subid [Apache::ASP::Demo::__ASP__usr_local_proj_asp_eg_header_incx3864049467064319c46bd308cab557d6xINC]
  25. start parse of data - 1484
  26. undefing sub Apache::ASP::Demo::__ASP__local_proj_asp_eg_synta__error_aspxf2f778798549d60d1f68fc363c612db1xINC code CODE(0x7f768cb53608)
  27. compiling into package Apache::ASP::Demo subid [Apache::ASP::Demo::__ASP__local_proj_asp_eg_synta__error_aspxf2f778798549d60d1f68fc363c612db1xINC]
  28. register include /usr/local/proj/asp/eg/header.inc with success
  29. parse file /usr/local/proj/asp/eg/compile_error.inc
  30. parsing /usr/local/proj/asp/eg/compile_error.inc
  31. start parse of data - 116
  32. undefing sub Apache::ASP::Demo::__ASP_local_proj_asp_eg_compile_error_incx570fffd12d34e55bd9a18f2cde319a64xINC code CODE(0x7f768cb65620)
  33. compiling into package Apache::ASP::Demo subid [Apache::ASP::Demo::__ASP_local_proj_asp_eg_compile_error_incx570fffd12d34e55bd9a18f2cde319a64xINC]
  34. undefing sub Apache::ASP::Demo::__ASP_local_proj_asp_eg_compile_error_incx570fffd12d34e55bd9a18f2cde319a64xINC code CODE(0x7f768cb65620)
  35. register include compile_error.inc with error:
  36. Script_OnStart
  37. executing Script_OnStart
  38. [syntax_error.asp] - Script_OnStart /usr/local/proj/asp/eg/syntax_error.asp in global.asa
  39. executing Apache::ASP::Demo::__ASP__local_proj_asp_eg_synta__error_aspxf2f778798549d60d1f68fc363c612db1xINC
  40. Script_OnFlush
  41. executing Script_OnFlush
  42. [syntax_error.asp] - Script_OnFlush: about to flush 1 bytes to client
  43. building headers
  44. sending cgi headers
  45. executing Apache::ASP::Demo::__ASP__usr_local_proj_asp_eg_header_incx3864049467064319c46bd308cab557d6xINC
  46. Script_OnFlush
  47. executing Script_OnFlush
  48. [syntax_error.asp] - Script_OnFlush: about to flush 871 bytes to client
  49. Script_OnFlush
  50. executing Script_OnFlush
  51. [syntax_error.asp] - Script_OnFlush: about to flush 82 bytes to client
  52. done executing include code Apache::ASP::Demo::__ASP__usr_local_proj_asp_eg_header_incx3864049467064319c46bd308cab557d6xINC
  53. Script_OnFlush
  54. executing Script_OnFlush
  55. [syntax_error.asp] - Script_OnFlush: about to flush 537 bytes to client
  56. [syntax_error.asp] - Debugging - can; take - just: about; - any; kind - of reference - or scalar
  57. Script_OnFlush
  58. executing Script_OnFlush
  59. [syntax_error.asp] - Script_OnFlush: about to flush 77 bytes to client
  60. Script_OnFlush
  61. executing Script_OnFlush
  62. [syntax_error.asp] - Script_OnFlush: about to flush 269 bytes to client
  63. Can't call method "SyntaxError" on an undefined value at /usr/local/proj/asp/eg/syntax_error.asp line 59. , /usr/local/share/perl5/Apache/ASP.pm line 1522
  64. ASP Done Processing Apache::ASP=HASH(0x7f768c47f5c8) - Application: Apache::ASP::Application=HASH(0x7f768cac0f60); GlobalASA: Apache::ASP::GlobalASA=HASH(0x7f768c418ae8); Internal: Apache::ASP::State=HASH(0x7f768ca6a388); Request: Apache::ASP::Request=HASH(0x7f768cb23558); Response: Apache::ASP::Response=HASH(0x7f768cb23270); Server: Apache::ASP::Server=HASH(0x7f768cb23378); Session: Apache::ASP::Session=HASH(0x7f768caa3d60); app_state: 1; basename: syntax_error.asp; cleanup: ARRAY(0x7f768c1efe60); compile_checksum: 3864049467064319c46bd308cab557d6; compile_includes: 1; compile_perl_count: 3; cookie_domain: ; cookie_path: /; dbg: 3; debugs_output: ARRAY(0x7f768c418e30); destroy: 1; dir_config: APR::Table=HASH(0x7f768c020940); dirname: /usr/local/proj/asp/eg/; errors_output: ARRAY(0x7f768cb67b78); errs: 1; filename: /usr/local/proj/asp/eg/syntax_error.asp; global: /usr/local/proj/asp/eg//.; global_package: Apache::ASP::Demo; group_refresh: 30; headers_in: APR::Table=HASH(0x7f768c020898); includes_dir: ARRAY(0x7f768c47f5e0); init_packages: ARRAY(0x7f768cb23078); inode_names: ; lang_comment: #; lang_language: PerlScript; lang_module: Apache::ASP::Lang::PerlScript; lang_object: Apache::ASP::Lang::PerlScript=HASH(0x7f768c4551e8); last_compile_include_data: HASH(0x7f768cb535f0); last_time: 1414800707.4250; no_cache: ; package: Apache::ASP::Demo; paranoid_session: ; parse_config: 1; parse_file_count: 3; pod_comments: 1; r: Apache2::RequestRec=SCALAR(0x7f768c020910); register_includes: HASH(0x7f768cb535d8); remote_ip: 54.163.72.86; request_binary_read: 1; response_tied: 1; run_perl_script: SCALAR(0x7f768cb53578); search_dirs_cache: HASH(0x7f768cb1eb30); secure_session: ; session_count: 1; session_id: 0c232771d3cfd6c757c95ed2715fac2f; session_serialize: ; session_state: 1; session_timeout: 300; session_url: 1; session_url_force: ; session_url_match: ; session_url_parse: 0; session_url_parse_match: ; start_time: 1414800707.40869; stat_inc: 0; stat_inc_match: 0; stat_scripts: 1; state_db: ; state_dir: /tmp/asp_demo; state_manager: 10; state_serialize: ; state_serializer: ; ua: CCBot/2.0 (http://commoncrawl.org/faq/); use_strict: 1; win32: 0; xml_subs_match: my:\w+; xml_subs_perl_args: 1; xml_subs_strict: ; xslt: ;
  65. errors out
  66. Can't call method "SyntaxError" on an undefined value at /usr/local/proj/asp/eg/syntax_error.asp line 59. , /usr/local/share/perl5/Apache/ASP.pm line 1522
ASP to Perl Script 

  -: use strict;;;use vars qw($Application $Session $Response $Server $Request);;
  -: #line 1 /usr/local/proj/asp/eg/syntax_error.asp
  1: ;;
  2: 
  3: ;  
  4: use File::Basename;
  5: if($Request->QueryString('buffer')) {
  6: 	$Response->{Buffer} = 1;
  7: } else {
  8: 	$Response->{Buffer} = 0; 
  9: }
 10: ; &Apache::ASP::WriteRef($main::Response, \('
 11: ')); $Response->Include('/usr/local/proj/asp/eg/header.inc', ); ; &Apache::ASP::WriteRef($main::Response, \('
 12: We are creating a perl syntax error... this should demonstrate 
 13: how error handling is done.  Please check the error log file if 
 14: you are interested in the output there.
 15: <p>
 16: You can turn this error messaging off by setting the Debug variable
 17: in the ASP config to 1 or 0.
 18: <p>
 19: Also here is an example of how you can use debugging, an API
 20: extension $Response->Debug(@args), in your script.  The debug 
 21: output will show up below, and in your error logs.  This user 
 22: style debugging is turned off with the same Debug setting set to 0.
 23: <p>
 24: 
 25: 
 26: 
 27: ')); 
 28:    $Response->Debug(
 29: 	"Debugging", 
 30: 	['can', 'take'], 
 31: 	{'just'=>'about'},
 32: 	sub { ['any', 'kind']},
 33: 	\"of reference",
 34: 	"or scalar"
 35: 	);
 36: 
 37:    print "Try this script also with <a href=".basename($0)."?buffer=1>buffering on.</a>";
 38: ; &Apache::ASP::WriteRef($main::Response, \('
 39: 
 40: <p>
 41: 
 42: This script by default does a runtime syntax error.  If you would like
 43: to see a script <b>compile error, <a href="'.( basename($0) ).'?compile_error=1">click here</a></b>.
 44: 
 45: <p>
 46: <a href="source.asp?file='.($Request->ServerVariables("SCRIPT_NAME")).'">
 47: view this file\'s source
 48: </a>
 49: 
 50: <br>
 51: <br>
 52: 
 53: ')); 
 54: if($Request->QueryString('compile_error')) {
 55:   $Response->Include("compile_error.inc");
 56: } else {
 57:         my $Object;
 58: 	# create a run-time syntax error
 59: 	$Object->SyntaxError(); 
 60: }
 61: ; &Apache::ASP::WriteRef($main::Response, \('
 62: 
 63: 
 64: 
 65: 
 66: 
 67: 
 68: 
 69: 
 70: 
 71: 
 72: 
 73: 
 74: Misc Text Below Error'));


An error has occured with the Apache::ASP script just run. If you are the developer working on this script, and cannot work through this problem, please try researching it at the Apache::ASP web site, specifically the FAQ section. Failing that, check out your support options, and if necessary include this debug output with any query.