| MetaStore documentation | Contained in the MetaStore distribution. |
MetaStore::Kern - Class of kernel object.
use MetaStore::Kern;
use base qw/ MetaStore::Kern /;
Class of kernel object.
Initialize object
Return Auth object ( See MetaStore::Auth ).
Default return undef.
Use execute2 api
Metasore, README
Zahatski Aliaksandr, <zag@cpan.org>
Copyright (C) 2005-2008 by Zahatski Aliaksandr
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
| MetaStore documentation | Contained in the MetaStore distribution. |
package MetaStore::Kern; #$Id: Kern.pm 927 2010-12-22 14:53:53Z zag $
use WebDAO::Engine; use MetaStore::Config; use MetaStore::Response; use Data::Dumper; use Carp; use strict; use warnings; use base qw(WebDAO::Engine); __PACKAGE__->attributes qw/_conf __template_obj__/;
sub init { my $self = shift; my (%opt) = @_; $self->RegEvent( $self, "_sess_ended", sub { $self->commit } ); return $self->SUPER::init(@_); } sub config { my $self = shift; return $self->_conf; } sub response { my $self = shift; my $sess = $self->_session; my $resp = new MetaStore::Response:: session => $sess, cv => $sess->Cgi_obj; $resp->set_header( -type => 'text/html; charset=utf-8' ); return $resp; }
sub auth { return; } sub create_object { my $self = shift; return $_[0]->_createObj(@_); } sub _createObj { my $self = shift; my $name_mod = $_[1]; #try check mod via auth if ( my $auth = $self->auth ) { return unless $auth->is_access($name_mod); } return $self->SUPER::_createObj(@_); }
sub execute { my $self = shift; return $self->execute2(@_); } sub parse_template { my $self = shift; my ( $template, $predefined, $template_config ) = @_; $predefined->{self} = $self unless exists $predefined->{self}; $predefined->{system} = $self unless exists $predefined->{system}; $template_config ||= {}; # my $template_obj = $self->__template_obj__ || new Template my $template_obj = new Template INTERPOLATE => 0, EVAL_PERL => 0, ABSOLUTE => 1, RELATIVE => 1, %{$template_config}, VARIABLES => $predefined, or do { $self->_log1( "TTK Error:", [$Template::ERROR] ); return }; $self->__template_obj__($template_obj); $template_obj->context->stash->update( {} ); $template_obj->context->reset; my $res; $template_obj->process( $template, $predefined, \$res ) or do { my $error = $template_obj->error(); $self->_log1( "TTK Error:" . $error . "; file: $template" ); return; }; return $res; } sub commit { my $self = shift; } sub _destroy { my $self = shift; $self->_conf(undef); $self->SUPER::_destroy(@_); } 1; __END__