--- trunk/lib/Frey/Web.pm 2008/07/17 19:33:51 161 +++ trunk/lib/Frey/Web.pm 2008/11/17 20:14:12 385 @@ -12,6 +12,13 @@ default => sub { [ 'static/frey.css' ] }, ); +=head2 inline_smaller_than + +Inline JavaScript and CSS smaller than this size into page reducing +round-trips to server. + +=cut + has 'inline_smaller_than' => ( is => 'rw', isa => 'Int', @@ -35,15 +42,16 @@ $path =~ s!^/!!; if ( $path =~ m/\.js$/ ) { $out .= $self->_inline_path( $path ) ? - qq|| : + qq|| : qq||; } elsif ( $path =~ m/\.css$/ ) { $out .= $self->_inline_path( $path ) ? - qq|| : + qq|| : qq||; } else { confess "don't know how to render $path"; } + $out .= "\n"; } return $out; } @@ -76,6 +84,20 @@ our $reload_counter = 0; + +=head2 page + + $self->page( + title => 'page title', + head => '', + body => 'Page Body', + ); + +=cut + +use Frey::Bookmarklet; +use Frey::ClassBrowser; + sub page { my $self = shift; my $a = {@_}; @@ -85,16 +107,30 @@ my $html = qq|| . $self->_head_html . '' . ( $a->{title} || ref($self) ) . '' + . '' . ( $a->{head} || '' ) . '' . ( $a->{body} || '' ) - . qq|
Frey $Frey::VERSION reload
| - . '' - ; + . qq|
+ Frey $Frey::VERSION + | . dump( $ENV{'REQUEST_URI'} ) . qq| + Bookmarklets| . Frey::Bookmarklet->markup . qq| + ClassBrowser| . Frey::ClassBrowser->markup . qq| + ENV| . dump( %ENV ) . qq| +
+ + |; warn "## >>> page ",length($html), " bytes\n" if $self->debug; return $html; } +sub error { + my ( $self, $error ) = @_; + warn $error; + $error =~ s{at\s+(\S+)\s+line\s+(\d+)}{ $1 line $2}gsm; + return qq|
$error
|; +} + 1;