« Day 3: Using plackup | Main | Day 5: Run a static web server with Plack »



Feed You can follow this conversation by subscribing to the comment feed for this post.

Brad Choate

Django's autoreloader used with the native 'runserver' command uses a secondary thread that scans loaded modules (sys.modules), sleeps for a second, then repeats. You could do something similar by monitoring mtimes for files found in %INC. That just hits code of course -- it wouldn't cause the app to reload when static files are modified (like a configuration 'yaml' file or something). But Django's configuration is also a Python module, so that's covered.


Brad: Yes, the way we scan file mtimes is almost the same -- except that we don't use thread but use forked child process instead. Using %INC would be neat and could be a sensible default.

Though I don't think you'll ever need to edit modules that are loaded from the system path. Instead you can simply specify your application path with -R and done with it.


I was worried you had reinvented File::ChangeNotify but it looks like you're using it. Cool. :)


Sartak: Yes i intentionally reinvented File::ChangeNotify - as another CPAN module Filesys::Notify::Simple. The whole purpose was to eliminate the non-core XS dependency and make it easier to install.

The comments to this entry are closed.

June 2013

Sun Mon Tue Wed Thu Fri Sat
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
Blog powered by Typepad