Bläddra i källkod

Fix bug with callback validator forcing all cbs for posts to be ::posts

George S. Baugh 1 år sedan
förälder
incheckning
b53b45de49
3 ändrade filer med 6 tillägg och 6 borttagningar
  1. 1 0
      lib/TCMS.pm
  2. 5 3
      lib/Trog/DataModule.pm
  3. 0 3
      lib/Trog/Log.pm

+ 1 - 0
lib/TCMS.pm

@@ -328,6 +328,7 @@ sub _app {
     # Redirecting somewhere naughty not allow
     $query->{to} = URI->new( $query->{to} // '' )->path() || $query->{to} if $query->{to};
 
+    DEBUG("DISPATCH $path to $routes{$path}{callback}");
     #XXX there is a trick to now use strict refs, but I don't remember it right at the moment
     {
         no strict 'refs';

+ 5 - 3
lib/Trog/DataModule.pm

@@ -271,15 +271,17 @@ my $not_ref = sub {
 my $valid_cb = sub {
     my $subname = shift;
     my ($modname) = $subname =~ m/^([\w|:]+)::\w+$/;
-    eval { require $modname; } or do {
-        WARN("Post uses a callback whos module cannot be found!");
+
+    # Modules always return 0 if they succeed!
+    eval { require $modname; } and do {
+        WARN("Post uses a callback whos module ($modname) cannot be found!");
         return 0;
     };
 
     no strict 'refs';
     my $ref = eval '\&' . $subname;
     use strict;
-    return is_coderef($ref);
+    return Ref::Util::is_coderef($ref);
 };
 
 my $hashref_or_string = sub {

+ 0 - 3
lib/Trog/Log.pm

@@ -56,9 +56,6 @@ sub log_init {
     $log->add($dblog);
 
     uuid("INIT");
-    DEBUG("If you see this message, you are running in DEBUG mode.  Turn off WWW_VERBOSE env var if you are running in production.");
-    uuid("BEGIN");
-
     return 1;
 }