[Rt-commit] rt branch, 4.0/convenient-rt-init, updated. rt-4.0.11rc1-30-g906cd2b

Thomas Sibley trs at bestpractical.com
Wed Apr 24 18:42:24 EDT 2013


The branch, 4.0/convenient-rt-init has been updated
       via  906cd2b7b0c1aea2eccc709172ed523d98b7ecbe (commit)
      from  042ac27969a8d38038aee9db16cb96c2b79eb5d2 (commit)

Summary of changes:
 lib/RT.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit 906cd2b7b0c1aea2eccc709172ed523d98b7ecbe
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Apr 24 15:37:59 2013 -0700

    Docs: RT->LoadConfig and ->Init need to happen at compile time
    
    Most of the time things will still work without the BEGIN block, but any
    plugin that provides a library overlay (such as Ticket_Vendor.pm) won't
    correctly load it if the script also contains, continuing the example, a "use
    RT::Ticket" line.
    
    This is because use statements are is evaluated at compile-time before
    LoadConfig and Init are called, and at that point plugins aren't setup
    yet when the core library file looks for overlays to load.

diff --git a/lib/RT.pm b/lib/RT.pm
index 875525a..0599cc3 100644
--- a/lib/RT.pm
+++ b/lib/RT.pm
@@ -100,8 +100,10 @@ You have the option of handling the timing of config loading and the actual
 init sequence yourself with:
 
     use RT;
-    RT->LoadConfig;
-    RT->Init;
+    BEGIN {
+        RT->LoadConfig;
+        RT->Init;
+    }
 
 or you can let RT do it all:
 

-----------------------------------------------------------------------


More information about the Rt-commit mailing list