/[Frey]/branches/zimbardo/lib/Frey/Web.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /branches/zimbardo/lib/Frey/Web.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 949 by dpavlin, Tue Jan 6 16:05:05 2009 UTC revision 965 by dpavlin, Wed Jan 7 22:59:23 2009 UTC
# Line 71  has 'html_dump_width' => ( Line 71  has 'html_dump_width' => (
71          default => 250,          default => 250,
72  );  );
73    
74    has 'wrap_in_page' => (
75            documentation => 'wrap full html page with status bar around content',
76            is => 'rw',
77            isa => 'Bool',
78            default => 1,
79    );
80    
81  my %escape = ('<'=>'&lt;', '>'=>'&gt;', '&'=>'&amp;', '"'=>'&quot;');  my %escape = ('<'=>'&lt;', '>'=>'&gt;', '&'=>'&amp;', '"'=>'&quot;');
82  my $escape_re  = join '|' => keys %escape;  my $escape_re  = join '|' => keys %escape;
83    
84  sub html_escape {  sub html_escape {
85          my ( $self, $html ) = @_;          my ( $self, $html ) = @_;
86            return '' unless defined $html;
87          $html =~ s/($escape_re)/$escape{$1}/g;          $html =~ s/($escape_re)/$escape{$1}/g;
88          return $html;          return $html;
89  }  }
# Line 238  sub add_js { Line 246  sub add_js {
246  our $reload_counter = 0;  our $reload_counter = 0;
247    
248    
249  =head2 page  =head2 html_page
250    
251    $self->page(    $self->html_page(
252          title => 'page title',          title => 'page title',
253          head  => '<!-- optional head markup -->',          head  => '<!-- optional head markup -->',
254          body  => '<b>Page Body</b>',          body  => '<b>Page Body</b>',
# Line 253  sub status { @status }; Line 261  sub status { @status };
261    
262  our $icon_html;  our $icon_html;
263    
264  sub page {  sub html_page {
265          my $self = shift;          my $self = shift;
266          my $a = {@_};          my $a = {@_};
267    
# Line 276  sub page { Line 284  sub page {
284                  warn "# no body, invoke $self->$run on ", ref($self);                  warn "# no body, invoke $self->$run on ", ref($self);
285                  $body = $self->$run;                  $body = $self->$run;
286          }          }
287          if ( $self->content_type !~ m{html} ) {          if ( $self->content_type !~ m{html} || ! $self->wrap_in_page ) {
288                  warn "# return only $self body ", $self->content_type;                  warn "# return only $self body ", $self->content_type;
289                  return $body                  return $body
290          } elsif ( ! defined $body ) {          } elsif ( ! defined $body ) {

Legend:
Removed from v.949  
changed lines
  Added in v.965

  ViewVC Help
Powered by ViewVC 1.1.26