Changeset 5575


Ignore:
Timestamp:
11/18/09 12:21:02 (3 years ago)
Author:
MichaelDaum
Message:

Item2375:

  • fixed use of undef value
  • some minor optimizations
Location:
trunk/SetVariablePlugin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/SetVariablePlugin/data/System/SetVariablePlugin.txt

    r5552 r5575  
    104104               and scope of the variable 
    105105 
    106 ---+++ DEBUGRULES 
    107 Display a table of all definition rules as far as collected by SETVAR and UNSERVAR. 
    108  
    109106---++ Installation Instructions 
    110107%$INSTALL_INSTRUCTIONS% 
  • trunk/SetVariablePlugin/lib/Foswiki/Plugins/SetVariablePlugin.pm

    r5552 r5575  
    2424 
    2525$VERSION = '$Rev: 4287 (2009-06-23) $'; 
    26 $RELEASE = '1.01'; 
     26$RELEASE = '1.02'; 
    2727 
    2828$SHORTDESCRIPTION = 'Flexible handling of topic variables'; 
    2929$NO_PREFS_IN_TOPIC = 1; 
    3030 
     31use constant DEBUG => 0; #toggle me 
    3132 
    3233############################################################################### 
    3334sub initPlugin { 
    34   my( $topic, $web, $user, $installWeb ) = @_; 
     35  my ($topic, $web, $user, $installWeb) = @_; 
    3536 
    3637  Foswiki::Func::registerTagHandler('SETVAR', \&handleSetVar); 
     
    3839  Foswiki::Func::registerTagHandler('DELVAR', \&handleUnsetVar); 
    3940  Foswiki::Func::registerTagHandler('UNSETVAR', \&handleUnsetVar); 
    40   Foswiki::Func::registerTagHandler('DEBUGRULES', \&handleDebugRules); 
     41  Foswiki::Func::registerTagHandler('DEBUGRULES', \&handleDebugRules) if DEBUG; 
    4142 
    42   undef $core; 
     43  $core = undef; 
    4344 
    4445  return 1; 
     
    5657 
    5758############################################################################### 
    58 sub handleSetVar { getCore()->handleSetVar(@_); } 
     59sub handleSetVar {  
     60  getCore()->handleSetVar(@_) if Foswiki::Func::getContext()->{save} || DEBUG; 
     61  return '' ; 
     62} 
     63 
     64############################################################################### 
     65sub handleUnsetVar {  
     66  getCore()->handleUnsetVar(@_) if Foswiki::Func::getContext()->{save} || DEBUG; 
     67  return '' ; 
     68} 
     69 
     70############################################################################### 
    5971sub handleGetVar { getCore()->handleGetVar(@_); } 
    60 sub handleUnsetVar { getCore()->handleUnsetVar(@_); } 
    6172sub handleDebugRules { getCore()->handleDebugRules(@_); } 
    6273sub beforeSaveHandler { getCore()->handleBeforeSave(@_); } 
  • trunk/SetVariablePlugin/lib/Foswiki/Plugins/SetVariablePlugin/Core.pm

    r5552 r5575  
    2424sub new { 
    2525  my $class = shift; 
    26   my $this = bless({}, $class); 
    27  
    28   $this->{rules} = (); 
    29  
    30   return $this; 
     26 
     27  return bless({}, $class); 
    3128} 
    3229 
     
    5653sub applyRules { 
    5754  my ($this, $web, $topic, $meta, $text) = @_; 
     55 
     56  return unless $this->{rules}; 
    5857 
    5958  $text ||= ''; 
Note: See TracChangeset for help on using the changeset viewer.