hello,

i have an object ($myobj) in which constructor i set up a template-object.
to this template-object i want to define some predefined blocks which are
implemented as subs of $myobj. how can i do this.
a little example:

package MyPackage;
sub new {
   my $proto = shift;
   my %params = @_;
   my $class = ref($proto) || $proto;
   my $self = {};
   bless $self, $class;
   $self->{__myvar} = $params->{myvar};
   $self->{__template} = new Template({
      INCLUDE_PATH => '/mydir',
      BLOCKS => {
         'mysub1' => ??? # this should be something that points to mysub1
      }
   });
   return $self;
}


sub mysub1 {
   my $self = shift;
   my ($context) = @_;
   # do some stuff which needs information about the object of type
MyPackage
   # eg. access $self->{__myvar} 
}

thanks in advance 

Gernot Homma
Cyber-Atelier
Shuttleworthstrasse 4-8 / Objekt 50
fon: +43 1 272 92 51 6
fax: +43 1 272 92 51 9
mail: [EMAIL PROTECTED]


_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.ourshack.com/mailman/listinfo/templates

Reply via email to