Ignore:
Timestamp:
01/26/12 02:45:28 (4 months ago)
Author:
PaulHarvey
Message:

Item11431: add ASSERTs for SINGLE_SINGLETONS

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/lib/Foswiki.pm

    r13394 r13826  
    8585# corrupting data spaces. 
    8686our $inUnitTestMode = 0; 
     87 
     88sub SINGLE_SINGLETONS       { 0 } 
     89sub SINGLE_SINGLETONS_TRACE { 0 } 
    8790 
    8891# Returns the full path of the directory containing Foswiki.pm 
     
    16651668    my $this = bless( { sandbox => 'Foswiki::Sandbox' }, $class ); 
    16661669 
     1670    if (SINGLE_SINGLETONS_TRACE) { 
     1671        require Data::Dumper; 
     1672        print STDERR "new $this: " 
     1673          . Data::Dumper->Dump( [ [caller], [ caller(1) ] ] ); 
     1674    } 
     1675 
    16671676    # Tell Foswiki::Response which charset we are using if not default 
    16681677    $Foswiki::cfg{Site}{CharSet} ||= 'iso-8859-1'; 
     
    16751684    # This is required in case we get an exception during 
    16761685    # initialisation, so that we have a session to handle it with. 
     1686    ASSERT( !$Foswiki::Plugins::SESSION ) if SINGLE_SINGLETONS; 
    16771687    $Foswiki::Plugins::SESSION = $this; 
     1688    ASSERT( $Foswiki::Plugins::SESSION->isa('Foswiki') ) if DEBUG; 
    16781689 
    16791690    # hash of zone records 
     
    21322143 
    21332144    undef $this->{DebugVerificationCode};    # from Foswiki::UI::Register 
     2145    if (SINGLE_SINGLETONS_TRACE) { 
     2146        require Data::Dumper; 
     2147        print STDERR "finish $this: " 
     2148          . Data::Dumper->Dump( [ [caller], [ caller(1) ] ] ); 
     2149    } 
     2150    if (SINGLE_SINGLETONS) { 
     2151        ASSERT( defined $Foswiki::Plugins::SESSION ); 
     2152        ASSERT( $Foswiki::Plugins::SESSION == $this ); 
     2153        ASSERT( $Foswiki::Plugins::SESSION->isa('Foswiki') ); 
     2154    } 
     2155    undef $Foswiki::Plugins::SESSION; 
    21342156 
    21352157    if (DEBUG) { 
     
    24002422 
    24012423    # Make sure func works, for registered tag handlers 
     2424    if (SINGLE_SINGLETONS) { 
     2425        ASSERT( defined $Foswiki::Plugins::SESSION ); 
     2426        ASSERT( $Foswiki::Plugins::SESSION == $this ); 
     2427    } 
    24022428    local $Foswiki::Plugins::SESSION = $this; 
     2429    ASSERT( $Foswiki::Plugins::SESSION->isa('Foswiki') ) if DEBUG; 
    24032430 
    24042431    my $text = $topicObject->text(); 
     
    27292756 
    27302757    # Make sure func works, for registered tag handlers 
    2731     $Foswiki::Plugins::SESSION = $this; 
     2758    if (SINGLE_SINGLETONS) { 
     2759        ASSERT( defined $Foswiki::Plugins::SESSION ); 
     2760        ASSERT( $Foswiki::Plugins::SESSION == $this ); 
     2761    } 
     2762    local $Foswiki::Plugins::SESSION = $this; 
     2763    ASSERT( $Foswiki::Plugins::SESSION->isa('Foswiki') ) if DEBUG; 
    27322764 
    27332765    # NOTE TO DEBUGGERS 
Note: See TracChangeset for help on using the changeset viewer.