8 A subclass of CXGN::Scrap, which is the superclass of CXGN::Page, this module performs a few actions in the constructor appropriate for Ajax Pages.
9 Use this as a Page module replacement for scripts that don't produce much output and are called asynchronously.
15 Creates a new AjaxPage object. Receives a content type as an optional argument, which defaults to "text/xml"
18 my $AjaxPage = CXGN::Scrap::AjaxPage->new();
19 $AjaxPage->send_http_header() default "text/xml"
20 print $AjaxPage->header();
21 print "<option name="candy">cookie</option>"
22 print $AjaxPage->footer();
26 Christopher Carpita <csc32@cornell.edu>
30 package CXGN
::Scrap
::AjaxPage
;
31 use base qw
/CXGN::Scrap/;
36 my $self = $class->SUPER::new
();
37 $self->{content_type
} = shift || 'application/json';
41 sub send_http_header
{
43 $self->send_content_type_header();
48 $self->{doc_header_called
} = 1;
49 my $extra_head = shift;
50 my $caller = $self->caller();
52 # $extra_head = "<caller>$caller</caller>\n" . $extra_head;
56 #<?xml version="1.0" encoding="UTF-8"?>
65 $self->{doc_footer_called
} = 1;
66 my $extra_foot = shift;
68 # return "$extra_foot\n</scrap>";
74 $self->{caller} = $caller if $caller;
75 return $self->{caller};
79 my ( $self, $message ) = @_;
80 print $self->header() unless $self->{doc_header_called
};
81 print "<error>$message</error>";
82 print $self->footer();