KES777 / mojo

Mojolicious - Perl real-time web framework
http://mojolicio.us
Artistic License 2.0
0 stars 0 forks source link

include не работает для шаблонов комманд из DATA секции #68

Open KES777 opened 5 years ago

KES777 commented 5 years ago
<> kes: kes it wouldn't matter, because just *loading* a command shouldn't affect things anyway
<> and by $command->run warmup *should* have been called
<> so changing this would be stupid, and also not solve your problem
<> write the code, write a test, write a comment, be happy.
<kes> : Thus [documentation](https://mojolicious.org/perldoc/Mojolicious/Renderer#classes) should mention that: 
<kes> push @{ $self->app->renderer->classes }, __PACKAGE__
<kes> has no effect for commands
<kes> and $app->include does not work for templates from DATA sections
<kes> : test was here: 
package MaitreD::Command::gen_schema;
use Mojo::Base 'Mojolicious::Command';

sub run {
    my( $self, @args ) =  @_;
    return   unless @args;

        push @{ $self->app->renderer->classes }, __PACKAGE__;

    print $self->render_data( 'example' )
}

1;

=head1 SYNOPSIS

  Usage: APPLICATION gen_schema <ResourceName/resource_name>

=cut

__DATA__

@@ example.html.ep
%= include 'example/part'

@@ example/part.html.ep
This is included