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

View of /WebApplication/SimpleWebPage.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (download) (as text) (annotate)
Tue Nov 15 18:04:03 2011 UTC (8 years, 7 months ago) by olson
Branch: MAIN
Changes since 1.2: +20 -2 lines
Add stacktrace support to SimpleWebPage.

if $FIG_Config::developer_mode is set, a failed page load of a web application will display the failure.

package SimpleWebPage;

use base qw( WebPage );

use strict;
use warnings;
use SubsystemPrimer;

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;

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

    local $SIG{__DIE__} = sub {
	my $trace = Devel::StackTrace->new(frame_filter => sub {
	    my($dat) = @_;
	    return ($dat->{args}->[0] 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