12 |
default => sub { [ 'static/frey.css' ] }, |
default => sub { [ 'static/frey.css' ] }, |
13 |
); |
); |
14 |
|
|
15 |
|
=head2 inline_smaller_than |
16 |
|
|
17 |
|
Inline JavaScript and CSS smaller than this size into page reducing |
18 |
|
round-trips to server. |
19 |
|
|
20 |
|
=cut |
21 |
|
|
22 |
has 'inline_smaller_than' => ( |
has 'inline_smaller_than' => ( |
23 |
is => 'rw', |
is => 'rw', |
24 |
isa => 'Int', |
isa => 'Int', |
95 |
|
|
96 |
=cut |
=cut |
97 |
|
|
98 |
|
use Frey::Bookmarklet; |
99 |
|
use Frey::ClassBrowser; |
100 |
|
|
101 |
sub page { |
sub page { |
102 |
my $self = shift; |
my $self = shift; |
103 |
my $a = {@_}; |
my $a = {@_}; |
107 |
my $html = qq|<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"><html><head>| |
my $html = qq|<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"><html><head>| |
108 |
. $self->_head_html |
. $self->_head_html |
109 |
. '<title>' . ( $a->{title} || ref($self) ) . '</title>' |
. '<title>' . ( $a->{title} || ref($self) ) . '</title>' |
110 |
|
. '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">' |
111 |
. ( $a->{head} || '' ) |
. ( $a->{head} || '' ) |
112 |
. '</head><body>' |
. '</head><body>' |
113 |
. ( $a->{body} || '<!-- no body -->' ) |
. ( $a->{body} || '<!-- no body -->' ) |
114 |
. qq|<div class="frey-status-line"> <a href="/">Frey</a> $Frey::VERSION <a href="?reload=$reload_counter">reload</a> </div>| |
. qq|<div class="frey-status-line"> |
115 |
. '</body></html>' |
<a href="/">Frey</a> $Frey::VERSION |
116 |
; |
<a href="?reload=$reload_counter"><code>| . dump( $ENV{'REQUEST_URI'} ) . qq|</code></a> |
117 |
|
<span class="frey-popup">Bookmarklets<span>| . Frey::Bookmarklet->markup . qq|</span></span> |
118 |
|
<span class="frey-popup">ClassBrowser<span>| . Frey::ClassBrowser->markup . qq|</span></span> |
119 |
|
<span class="frey-popup">ENV<span><code>| . dump( %ENV ) . qq|</code></span></span> |
120 |
|
</div> |
121 |
|
</body></html> |
122 |
|
|; |
123 |
|
|
124 |
warn "## >>> page ",length($html), " bytes\n" if $self->debug; |
warn "## >>> page ",length($html), " bytes\n" if $self->debug; |
125 |
|
|
126 |
return $html; |
return $html; |
127 |
} |
} |
128 |
|
|
129 |
|
sub error { |
130 |
|
my ( $self, $error ) = @_; |
131 |
|
warn $error; |
132 |
|
$error =~ s{at\s+(\S+)\s+line\s+(\d+)}{ <a href="/editor$1+$2" target="editor">$1</a> line $2}gsm; |
133 |
|
return qq|<pre class="frey-error">$error</pre>|; |
134 |
|
} |
135 |
|
|
136 |
1; |
1; |