package MyApp::Controller::Play; use strict; use warnings; use parent 'Catalyst::Controller'; use YAML (); use CGI ":standard"; my $th_style = { -style => "font-family:sans-serif; font-size:13px; text-align:right; border:1px solid black; padding: 1px 3px; margin:1px;background-color:#fef;" }; my $td_style = { -style => "font-family:sans-serif; font-size:12px;border:1px solid black; padding: 1px 3px; margin:1px; background-color:#efe" }; my $td_style2 = { -style => "font-family:sans-serif; font-size:12px;border:1px solid black; padding: 1px 3px; margin:1px; background-color:#eff" }; sub schema : Local { my ( $self, $c ) = @_; my $schema = $c->model("DB")->schema; my @sources = start_html("DB schema"); for my $src ( sort { "$a" cmp "$b" } $schema->sources ) { push @sources, h2($src); push @sources, '
##
package MyApp::View::Alloy;
use strict;
no warnings "uninitialized";
use parent "Catalyst::View::TT::Alloy";
use Scalar::Util "blessed";
__PACKAGE__->config( RECURSION => 1 );
Template::Alloy->define_vmethod
(
"SCALAR",
blessed => sub {
blessed(+shift);
}
);
####
[% INCLUDE show_object
title = object.blessed()
obj = object %]
[% BLOCK show_object %]
[% title %]
[% FOR col IN obj.columns %]
[% col %]
[% IF obj.$col.blessed %]
[% INCLUDE show_object
title = obj.$col.blessed()
obj = obj.$col %]
[% ELSE %]
[% obj.$col || "na" %]
[% END %]
[% END %]
[% END %]