/[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 398 by dpavlin, Tue Nov 18 02:14:40 2008 UTC revision 418 by dpavlin, Tue Nov 18 16:54:10 2008 UTC
# Line 10  use Data::Dump qw/dump/; Line 10  use Data::Dump qw/dump/;
10  use Carp qw/confess/;  use Carp qw/confess/;
11  use File::Slurp;  use File::Slurp;
12    
13    use Frey::Bookmarklet;
14    use Frey::ClassBrowser;
15    
16  has 'head' => (  has 'head' => (
17          is => 'rw',          is => 'rw',
18          isa => 'ArrayRef[Str]',          isa => 'ArrayRef[Str]',
# Line 21  has 'status' => ( Line 24  has 'status' => (
24          isa => 'ArrayRef[HashRef[Str]]',          isa => 'ArrayRef[HashRef[Str]]',
25          lazy => 1,          lazy => 1,
26          default => sub { [          default => sub { [
27                  { 'Bookmarklets' => Frey::Bookmarklet->markup },                  { 'Bookmarklets' => Frey::Bookmarklet->new->markup },
28                  { 'ClassBrowser' => Frey::ClassBrowser->markup },                  { 'ClassBrowser' => Frey::ClassBrowser->new->markup },
29          ] },          ] },
30  );  );
31    
# Line 32  has 'request_url' => ( Line 35  has 'request_url' => (
35          default => '/',          default => '/',
36  );  );
37    
38    has 'title' => (
39            is => 'rw',
40            isa => 'Str',
41            lazy => 1,
42            default => sub {
43                    my ($self) = @_;
44                    ref($self);
45            },
46    );
47    
48  =head2 inline_smaller_than  =head2 inline_smaller_than
49    
50  Inline JavaScript and CSS smaller than this size into page reducing  Inline JavaScript and CSS smaller than this size into page reducing
# Line 115  our $reload_counter = 0; Line 128  our $reload_counter = 0;
128    
129  =cut  =cut
130    
 use Frey::Bookmarklet;  
 use Frey::ClassBrowser;  
   
131  sub page {  sub page {
132          my $self = shift;          my $self = shift;
133          my $a = {@_};          my $a = {@_};
# Line 144  sub page { Line 154  sub page {
154          my $html = join("\n",          my $html = join("\n",
155                  qq|<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"><html><head>|,                  qq|<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"><html><head>|,
156                  $self->_head_html,                  $self->_head_html,
157                  '<title>' . ( $a->{title} || ref($self) ) . '</title>',                  '<title>' . ( $self->title || $a->{title} || ref($self) ) . '</title>',
158                  '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">',                  '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">',
159                  ( $a->{head} || '' ),                  ( $a->{head} || '' ),
160                  '</head><body>',                  '</head><body>',
161                  ( $a->{body} || '<!-- no body -->' ),                  ( $a->{body} || $self->markup || '<!-- no body -->' ),
162                  qq|                  qq|
163                  <div class="frey-status-line">                  <div class="frey-status-line">
164                          <a href="/">Frey</a> $Frey::VERSION                          <a href="/">Frey</a> $Frey::VERSION
# Line 170  sub error { Line 180  sub error {
180          my ($package, $filename, $line) = caller;          my ($package, $filename, $line) = caller;
181          $error .= " at $filename line $line" if $error !~ m{ at };          $error .= " at $filename line $line" if $error !~ m{ at };
182          warn "WARN: $error\n";          warn "WARN: $error\n";
183          $error =~ s{at\s+(\S+)\s+line\s+(\d+)}{at <a href="/editor$1+$2" target="editor">$1</a> line $2}gsm;          $error =~ s{at\s+(\S+)\s+line\s+(\d+)}{at <a target="editor" href="/editor+$1+$2">$1</a> line $2}gsm;
184            $error =~ s{(via package ")([\w:]+)(")}{$1<a target="editor" href="/editor+$2+1">$2</a>$3}gsm;
185          return qq|<pre class="frey-error">$error</pre>|;          return qq|<pre class="frey-error">$error</pre>|;
186  }  }
187    

Legend:
Removed from v.398  
changed lines
  Added in v.418

  ViewVC Help
Powered by ViewVC 1.1.26