73 |
$self->usage->{ $class }++; |
$self->usage->{ $class }++; |
74 |
|
|
75 |
my $o; |
my $o; |
76 |
eval { $o = $class->new( %{ $self->params } ) }; |
my ( $meta, $is_role, $instance ) = $self->class_meta( $class ); |
77 |
if ( $@ ) { |
if ( $is_role ) { |
78 |
warn "can't call $class->new: $@" if $@; |
$o = $instance; |
79 |
my ( $meta, $is_role, $instance ) = $self->class_meta( $class ); |
} else { |
80 |
$o = $instance if $is_role; |
$o = $class->new( %{ $self->params } ); |
81 |
} |
} |
|
confess "can't create class instance for $class" unless $o; |
|
82 |
|
|
83 |
$o->depends if $o->can('depends'); |
$o->depends if $o->can('depends'); |
84 |
|
|
87 |
if ( $self->run eq 'markup' ) { |
if ( $self->run eq 'markup' ) { |
88 |
warn "## using ",ref($o), "->markup"; |
warn "## using ",ref($o), "->markup"; |
89 |
if ( $o->can('page') ) { |
if ( $o->can('page') ) { |
90 |
#$html = $o->page; |
$html = $o->page; |
|
$body = $o->markup unless $html; |
|
|
} else { |
|
|
$body = $o->markup; |
|
91 |
} |
} |
92 |
|
$body = $o->markup unless $html; |
93 |
|
|
94 |
warn ">>> markup $class ",length( $html || $body ), " ", $html ? 'html' : 'body', " bytes"; |
warn ">>> markup $class ",length( $html || $body ), " ", $html ? 'html' : 'body', " bytes"; |
95 |
} elsif ( $self->run eq 'sponge' ) { |
} elsif ( $self->run eq 'sponge' ) { |
134 |
}; |
}; |
135 |
}; |
}; |
136 |
|
|
137 |
$html = $self->page( title => $self->class, body => dump($html) . $self->error( $@ ) ) if $@; |
$html = $self->page( title => $self->class, body => $self->error( $@ ) ) if $@; |
138 |
|
|
139 |
return $html; |
return $html; |
140 |
} |
} |