[Rt-commit] r11994 - rt/branches/3.8-TESTING/lib/RT

ruz at bestpractical.com ruz at bestpractical.com
Thu May 1 16:22:17 EDT 2008


Author: ruz
Date: Thu May  1 16:22:17 2008
New Revision: 11994

Modified:
   rt/branches/3.8-TESTING/lib/RT/Config.pm

Log:
* implement PostLoadCheck

Modified: rt/branches/3.8-TESTING/lib/RT/Config.pm
==============================================================================
--- rt/branches/3.8-TESTING/lib/RT/Config.pm	(original)
+++ rt/branches/3.8-TESTING/lib/RT/Config.pm	Thu May  1 16:22:17 2008
@@ -164,6 +164,17 @@
             },
         },
     },
+    DisableGraphViz => {
+        Type            => 'SCALAR',
+        PostLoadCheck   => sub {
+            my $value = shift;
+            return unless $value;
+            return if $INC{'GraphViz'};
+            local $@;
+            return if eval {require GraphViz; 1};
+            warn "You've enabled GraphViz, but we couldn't load the module: $@";
+        },
+    },
     MailPlugins         => {
         Type            => 'ARRAY'
     },
@@ -224,6 +235,7 @@
     my @configs = $self->Configs;
     $self->InitConfig( File => $_ ) foreach @configs;
     $self->LoadConfig( File => $_ ) foreach @configs;
+    $self->PostLoadCheck;
     return;
 }
 
@@ -332,6 +344,13 @@
     return 1;
 }
 
+sub PostLoadCheck {
+    my $self = shift;
+    foreach my $o ( grep $META{$_}{'PostLoadCheck'}, $self->Options( Overridable => undef ) ) {
+        $META{$o}->{'PostLoadCheck'}->( $self->Get($o) );
+    }
+}
+
 =head2 Configs
 
 Returns list of the top level configs file names. F<RT_Config.pm> is always


More information about the Rt-commit mailing list