[Catalyst] Self restarting test server!

Sebastian Riedel sri at oook.de
Mon Oct 17 19:14:45 CEST 2005


Many people requested it, now it's in trunk! :)

     http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst

Just update your script directory and start the test server with -r  
flag. (script/myapp_server.pl -r)

It will monitor your files in a 1 second interval and restart the  
server when files matching the regex (defaults to '\.yml$|\.yaml$|\.pm 
$') are modified.
Syntax errors are catched and presented in the logs.

The implementation is platform independent (using File::Find and stat 
()), so it should work on all Unix flavours and Windows. (and no,  
it's not slow) ;)

There seems to be a Mac OS X related bug (at least on my test  
machine, as usual) that lets the server die after about 3 - 5 syntax  
errors in a row, so it would be nice to get as much feedback as  
possible for different platforms!

Here's a example session:

odyssey:~/MyApp sri$ script/myapp_server.pl -r
[Mon Oct 17 19:03:00 2005] [catalyst] [debug] Debug messages enabled
[Mon Oct 17 19:03:00 2005] [catalyst] [debug] Loaded dispatcher  
"Catalyst::Dispatcher"
[Mon Oct 17 19:03:00 2005] [catalyst] [debug] Loaded engine  
"Catalyst::Engine::HTTP"
[Mon Oct 17 19:03:00 2005] [catalyst] [debug] Found home "/Users/sri/ 
MyApp"
[Mon Oct 17 19:03:00 2005] [catalyst] [debug] Loaded private actions:
.-------------------------------------- 
+---------------------------------------.
| Private                              |  
Class                                 |
|=------------------------------------- 
+--------------------------------------=|
| /default                             |  
MyApp                                 |
'-------------------------------------- 
+---------------------------------------'
[Mon Oct 17 19:03:00 2005] [catalyst] [info] MyApp powered by  
Catalyst 5.49_01
You can connect to your server at http://odyssey.local:3000
File(s) "/Users/sri/MyApp/script/../lib/MyApp.pm" modified, restarting

[Mon Oct 17 19:03:11 2005] [catalyst] [debug] Debug messages enabled
[Mon Oct 17 19:03:11 2005] [catalyst] [debug] Loaded dispatcher  
"Catalyst::Dispatcher"
[Mon Oct 17 19:03:11 2005] [catalyst] [debug] Loaded engine  
"Catalyst::Engine::HTTP"
[Mon Oct 17 19:03:11 2005] [catalyst] [debug] Found home "/Users/sri/ 
MyApp"
[Mon Oct 17 19:03:11 2005] [catalyst] [debug] Loaded private actions:
.-------------------------------------- 
+---------------------------------------.
| Private                              |  
Class                                 |
|=------------------------------------- 
+--------------------------------------=|
| /default                             |  
MyApp                                 |
'-------------------------------------- 
+---------------------------------------'
[Mon Oct 17 19:03:11 2005] [catalyst] [info] MyApp powered by  
Catalyst 5.49_01
You can connect to your server at http://odyssey.local:3000
File "/Users/sri/MyApp/script/../lib/MyApp.pm" modified, not restarting

************************************************************************ 
********
syntax error at /Users/sri/MyApp/script/../lib/MyApp.pm line 37, near  
"}"
BEGIN not safe after errors--compilation aborted at /Users/sri/MyApp/ 
script/../lib/MyApp.pm line 37.
Compilation failed in require at (eval 25) line 1.
************************************************************************ 
********
File(s) "/Users/sri/MyApp/script/../lib/MyApp.pm" modified, restarting

[Mon Oct 17 19:03:22 2005] [catalyst] [debug] Debug messages enabled
[Mon Oct 17 19:03:22 2005] [catalyst] [debug] Loaded dispatcher  
"Catalyst::Dispatcher"
[Mon Oct 17 19:03:22 2005] [catalyst] [debug] Loaded engine  
"Catalyst::Engine::HTTP"
[Mon Oct 17 19:03:22 2005] [catalyst] [debug] Found home "/Users/sri/ 
MyApp"
[Mon Oct 17 19:03:22 2005] [catalyst] [debug] Loaded private actions:
.-------------------------------------- 
+---------------------------------------.
| Private                              |  
Class                                 |
|=------------------------------------- 
+--------------------------------------=|
| /default                             |  
MyApp                                 |
'-------------------------------------- 
+---------------------------------------'
[Mon Oct 17 19:03:22 2005] [catalyst] [info] MyApp powered by  
Catalyst 5.49_01
You can connect to your server at http://odyssey.local:3000


--
sebastian




More information about the Catalyst mailing list