X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FExcel%2FTemplate%2FBase.pm;h=32e723690b98deaf58db7d1ab82d3cbe5e589753;hb=d01e47224d7454eac9a23d08b004a0493292dad5;hp=fe7600294ed3a1aa59ae33bed47d48dd836d7c67;hpb=e976988f30574c0c21cfa29fc5d080827e003fb6;p=p5sagit%2FExcel-Template.git diff --git a/lib/Excel/Template/Base.pm b/lib/Excel/Template/Base.pm index fe76002..32e7236 100644 --- a/lib/Excel/Template/Base.pm +++ b/lib/Excel/Template/Base.pm @@ -2,30 +2,27 @@ package Excel::Template::Base; use strict; -BEGIN { -} - use Excel::Template::Factory; sub new { my $class = shift; - - push @_, %{shift @_} while defined $_[0] && UNIVERSAL::isa($_[0], 'HASH'); - (@_ % 2) + + push @_, %{shift @_} while ref $_[0] eq 'HASH'; + (@_ % 2) and die "$class->new() called with odd number of option parameters\n"; - + my %x = @_; - + # Do not use a hashref-slice here because of the uppercase'ing my $self = {}; $self->{uc $_} = $x{$_} for keys %x; - + bless $self, $class; } - -sub isa { Excel::Template::Factory::isa(@_) } -sub is_embedded { Excel::Template::Factory::is_embedded(@_) } + +*isa = *isa = \&Excel::Template::Factory::isa; +*is_embedded = *is_embedded = \&Excel::Template::Factory::is_embedded; #sub calculate { ($_[1])->get(@_[0,2]) } #{ @@ -34,7 +31,7 @@ sub is_embedded { Excel::Template::Factory::is_embedded(@_) } # # return $context->get($self, $attr); #} - + sub enter_scope { ($_[1])->enter_scope($_[0]) } #{ # my $self = shift; @@ -42,38 +39,41 @@ sub enter_scope { ($_[1])->enter_scope($_[0]) } # # return $context->enter_scope($self); #} - -sub exit_scope { ($_[1])->exit_scope(@_[0, 2]) } + +sub exit_scope { ($_[1])->exit_scope($_[0], $_[2]) } #{ # my $self = shift; # my ($context, $no_delta) = @_; # # return $context->exit_scope($self, $no_delta); #} - + sub deltas { # my $self = shift; # my ($context) = @_; - + return {}; } - -sub resolve -{ + +# Everyone seems to have their own versions. +# Maybe, it's part of the API to require that you have the right one of these +# defined? +#sub resolve +#{ # my $self = shift; # my ($context) = @_; - - ''; -} - -sub render -{ +# +# ''; +#} +# +#sub render +#{ # my $self = shift; # my ($context) = @_; - - 1; -} +# +# 1; +#} 1; __END__