Skip to content

Commit

Permalink
Item2511: 'use' would compile the core unconditionally. Wrapping it i…
Browse files Browse the repository at this point in the history
…n an eval delays evaluation until the code is actually run (lazy loading) for a significantly reduced load time for the plugin

git-svn-id: http://svn.foswiki.org/trunk@5822 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
CrawfordCurrie authored and CrawfordCurrie committed Dec 18, 2009
1 parent 475ec6e commit 8adbd57
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions TablePlugin/lib/Foswiki/Plugins/TablePlugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,9 @@
# Allow sorting of tables, plus setting of background colour for
# headings and data cells. See %SYSTEMWEB%.TablePlugin for details of use

use strict;

package Foswiki::Plugins::TablePlugin;

use Foswiki::Func (); # The plugins API
use Foswiki::Plugins (); # For the API version
use strict;

our $VERSION = '$Rev$';
our $RELEASE = '1.121';
Expand Down Expand Up @@ -78,7 +75,8 @@ sub preRenderingHandler {
_readPluginSettings() if !%pluginAttributes;

# on-demand inclusion
use Foswiki::Plugins::TablePlugin::Core;
eval "use Foswiki::Plugins::TablePlugin::Core ()";
die $@ if $@;
Foswiki::Plugins::TablePlugin::Core::handler(@_);
}

Expand Down

0 comments on commit 8adbd57

Please sign in to comment.