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 '/' => 'index';

get '/foo' => sub {
    my $c    = shift;
    my $user = $c->param('user');
    $c->render(text => qq{Hello $user!});
};

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

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

<body>
    <form action="/foo">
        <input name="user" type="text">
        <input type="submit" value="Submit!">
    </form>
</body>

</html>
1
2
#!/usr/bin/env perl
use Mojolicious::Lite;
1
get '/' => 'index';
1
2
3
4
5
get '/foo' => sub {
    my $c = shift;
    my $user = $c->param('user');
    $c->render(text => qq{Hello $user!});
};
1
app->start;
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
__DATA__
@@ index.html.ep
<!DOCTYPE html>
<html>

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

<body>
    <form action="/foo">
        <input name="user" type="text">
        <input type="submit" value="Submit!">
    </form>
</body>

</html>
comments powered by Disqus
Built with Hugo
テーマ StackJimmy によって設計されています。