[Templates-cvs] cvs commit: TT3/lib/Template Directives.pm
cvs@template-toolkit.org
cvs@template-toolkit.org
Fri, 10 Dec 2004 13:39:18 +0000
cvs 04/12/10 13:39:18
Modified: lib/Template Directives.pm
Log:
* subclass from Template::Factory::Modules and remove old methods
Revision Changes Path
1.5 +9 -30 TT3/lib/Template/Directives.pm
Index: Directives.pm
===================================================================
RCS file: /template-toolkit/TT3/lib/Template/Directives.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Directives.pm 2004/12/10 09:59:24 1.4
+++ Directives.pm 2004/12/10 13:39:18 1.5
@@ -15,7 +15,7 @@
# modify it under the same terms as Perl itself.
#
# REVISION
-# $Id: Directives.pm,v 1.4 2004/12/10 09:59:24 abw Exp $
+# $Id: Directives.pm,v 1.5 2004/12/10 13:39:18 abw Exp $
#
#========================================================================
@@ -23,10 +23,10 @@
use strict;
use warnings;
-use Template::Modules;
-use base qw( Template::Modules );
+use Template::Factory::Modules;
+use base qw( Template::Factory::Modules );
-our $VERSION = sprintf("%d.%02d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/);
+our $VERSION = sprintf("%d.%02d", q$Revision: 1.5 $ =~ /(\d+)\.(\d+)/);
our $DEBUG = 0 unless defined $DEBUG;
our $ERROR = '';
our $THROW = 'directive';
@@ -34,36 +34,15 @@
our $PATH = 'Template::Directive' unless defined $PATH;
our $LOADED = { } unless defined $LOADED;
our $MODULES = { } unless defined $MODULES;
+our $PRELOAD = 1;
-# define $DIRECTIVE and directive() (and directives()??) as aliases
-# for $MODULES, module() (and modules())
+# define $DIRECTIVE and directive() and directives() as aliases
+# for $MODULES, module() and modules()
our $DIRECTIVES = $MODULES;
*directive = __PACKAGE__->can('module');
-# *directives = __PACKAGE__->can('modules'); # see below
+*directives = __PACKAGE__->can('modules');
-sub init {
- my ($self, $config) = @_;
-
- # call Template::Modules base class init() method
- $self->SUPER::init($config) || return;
-
- # delete any directives that are set false
- my $dirs = $self->{ modules };
-
- while (my ($key, $value) = each %$dirs) {
- delete $dirs->{ $key } unless $value;
- }
-
- return $self;
-}
-
-sub directives {
- my $self = shift;
- $self->load_all() || return;
- $self->modules();
-}
-
1;
__END__
@@ -90,7 +69,7 @@
=head1 VERSION
-$Revision: 1.4 $
+$Revision: 1.5 $
=head1 COPYRIGHT