[Bio] / WebApplication / SimpleWebPage.pm Repository:
ViewVC logotype

View of /WebApplication/SimpleWebPage.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (download) (as text) (annotate)
Thu Jan 19 22:00:44 2012 UTC (8 years, 5 months ago) by olson
Branch: MAIN
Changes since 1.4: +3 -1 lines
fix undefined str bug

package SimpleWebPage;

use base qw( WebPage );

use strict;
use warnings;
use Devel::StackTrace::AsHTML;

1;

=pod

=head1 NAME

SimpleWebPage

=head1 DESCRIPTION


=head1 METHODS

=over 4

=item * B<init> ()

Called when the web page is instanciated.

=cut

sub init {
  my ($self) = @_;
  
  $self->title($self->page_title());

  return 1;
}

=item * B<output> ()

Returns the html output of the Annotation page.

=cut

sub output {
    my ($self) = @_;
    
    my $application = $self->application;
    my $cgi = $application->cgi;
    
    my $fig = $application->data_handle('FIG');
    
    my $user = $application->session->user;

    my $page = $cgi->param('page');
    my $url = $application->url."?page=".$page;

    my $username = ref($user) ? $user->login : "";

    local $SIG{__DIE__} = sub {
	my $trace = Devel::StackTrace->new(frame_filter => sub {
	    my($dat) = @_;
	    my $arg = $dat->{args}->[0];
	    
	    return (defined($arg) && $arg eq 'Devel::StackTrace') ? 0 : 1;
	});
	
	die $trace->as_html;
    };

    my $output;

    eval {
	$output = $self->page_content($fig, $cgi, $username, $url);
    };
    if ($@)
    {
	$output = "<h1>Error during execution of page $page:</h1>" . $@;
    }

    return $output;
}


1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3