Mojolicious::Liteでテキストボックスに値を入れておく

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env perl
use Mojolicious::Lite;

get '/' => sub {
    my $c    = shift;
    my $user = $c->param('user');
    $c->stash(hello => qq{Hello $user!});
    $c->render(template => 'index');
};

app->start;
__DATA__
@@ index.html.ep
<!DOCTYPE html>
<html>

<head>
    <title>title</title>
</head>

<body>
    %= form_for '/', begin
        %= text_field 'user'
        %= submit_button 'Submit!'
    % end
    <p><%= $hello %></p>
</body>

</html>
1
2
3
4
    %= form_for '/', begin
        %= text_field 'user'
        %= submit_button 'Submit!'
    % end
comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy