sub output { my ($self) = @_; my $outputtype = $outputtype_of{ident $self}; #croak $outputtype; my $send_handler = ( html => do { $self->generate_html() }, js => do { $self->generate_js() }, jpg => do { $self->generate_jpg() }, zip => do { $self->generate_zip() }, ); my $send_header = ( html => 'text/html', js => 'text/javascript', jpg => 'image/jpeg', zip => 'archive/zip', ); my $output = $send_handler{$outputtype}; # OUTPUT IST LEER print "Content-Type: $send_header{$outputtype} \n\n"; print $output; } sub generate_html { my ($self) = @_; my $template = $template_of{ident $self}; require HTML::Template; # check if page exists: if(!-e qq{./res/template/$template.html}) { croak "template not found."; } my $output = HTML::Template->new( filename => qq{./res/template/$template.html}, die_on_bad_params => 0, )->output(); return $output; }