[Catalyst-dev] Ignoring Emacs temp files

Dave Rolsky autarch at urth.org
Sun Aug 26 19:41:46 GMT 2007

When you're editing a buffer in emacs, it will create a temporary symlink 
in the same directory of the file in the form ".#<filename>".

Since these have the same .pm ending as normal modules, Catalyst will 
attempt to load them on startup, and they get included in the watch list 
for the restarting HTTP server. I've attached two patches to tighten up 
the regexes involved so as to avoid this problem.

The first is for Catalyst.pm itself. When using Module::Pluggable::Object, 
it passes a regex to ignore any class name that include ".#", which isn't 
a valid Perl class name anyway (this could be further tightened to really 
only accept valid class names).

The Other is for Catalyst::Devel, and it tweaks the $restart_regex in the 
foo_server.pl script it generates. It basically excludes any path that 
has ".#" at the beginning of the filename or after a slash.


VegGuide.Org                        www.BookIRead.com
Your guide to all that's veg.       My book blog
-------------- next part --------------
Index: lib/Catalyst.pm
--- lib/Catalyst.pm	(revision 6740)
+++ lib/Catalyst.pm	(working copy)
@@ -1865,6 +1865,7 @@
     my $locator = Module::Pluggable::Object->new(
         search_path => [ map { s/^(?=::)/$class/; $_; } @paths ],
+        except => qr/\.#/,
-------------- next part --------------
Index: lib/Catalyst/Helper.pm
--- lib/Catalyst/Helper.pm	(revision 6740)
+++ lib/Catalyst/Helper.pm	(working copy)
@@ -859,7 +859,7 @@
 my $keepalive         = 0;
 my $restart           = $ENV{[% appenv %]_RELOAD} || $ENV{CATALYST_RELOAD} || 0;
 my $restart_delay     = 1;
-my $restart_regex     = '\.yml$|\.yaml$|\.pm$';
+my $restart_regex     = '(?:/|^)(?!\.#).+(?:\.yml$|\.yaml$|\.pm)$';
 my $restart_directory = undef;
 my @argv = @ARGV;

More information about the Catalyst-dev mailing list