Commit dcb68c6a by PotatoGim

mojolicious: move all tutorial examples to 'tutorials' directory.

parent 1838da15
......@@ -11,64 +11,12 @@
# LICENSE: Artistic License 2.0
# NOTE:
#=============================================================================
use strict;
use warnings;
use utf8;
use Mojolicious::Lite;
get '/with_block' => 'block';
app->start;
1;
__END__
=encoding utf8
=head1 NAME
blocks.pl -
=head1 SYNOPSIS
=head1 DESCRIPTION
=over
=item B<Item 1>
=item B<Item 2>
=item B<Item 3>
=back
=head1 AUTHOR
Ji-Hyeon Gim <potatogim@gluesys.com>
=head1 CONTRIBUTORS
=head1 COPYRIGHT AND LICENSE
Copyright(c) 2015 by Ji-Hyeon Gim <potatogim@gluesys.com>
This is free software; you can redistribute it and/or modify it
under the same terms as Perl 5 itself at:
L<http://www.perlfoundation.org/artistic_license_2_0>
You may obtain a copy of the full license at:
L<http://www.perl.com/perl/misc/Artistic.html>
=head1 SEE ALSO
=cut
# 아래 __DATA__ 섹션에서는 첫번째 begin과 마지막 end가 한쌍,
#
# 그리고 <%= link_to 주소 => 이름 %>에서 이름을 변수화하기 위한 begin과 end가
......
......@@ -13,10 +13,6 @@
# LICENSE: Artistic License 2.0
# NOTE:
#=============================================================================
use strict;
use warnings;
use utf8;
use Mojolicious::Lite;
# Not found
......@@ -29,52 +25,3 @@ get "/missing" => sub { shift->render(template => "does_not_exist") };
get "/dies" => sub { die "Intentional error" };
app->start;
1;
__END__
=encoding utf8
=head1 NAME
builtin_except.pl -
=head1 SYNOPSIS
=head1 DESCRIPTION
=over
=item B<Item 1>
=item B<Item 2>
=item B<Item 3>
=back
=head1 AUTHOR
Ji-Hyeon Gim <potatogim@gluesys.com>
=head1 CONTRIBUTORS
=head1 COPYRIGHT AND LICENSE
Copyright(c) 2015 by Ji-Hyeon Gim <potatogim@gluesys.com>
This is free software; you can redistribute it and/or modify it
under the same terms as Perl 5 itself at:
L<http://www.perlfoundation.org/artistic_license_2_0>
You may obtain a copy of the full license at:
L<http://www.perl.com/perl/misc/Artistic.html>
=head1 SEE ALSO
=cut
......@@ -11,10 +11,6 @@
# LICENSE: Artistic License 2.0
# NOTE:
#=============================================================================
use strict;
use warnings;
use utf8;
use Mojolicious::Lite;
# agent, host와 같은 조건으로 더 강력한 경로 구성이 가능하다.
......@@ -38,52 +34,3 @@ get '/bar' => (host => "mojolicio.us") => sub {
};
app->start;
1;
__END__
=encoding utf8
=head1 NAME
conditions.pl -
=head1 SYNOPSIS
=head1 DESCRIPTION
=over
=item B<Item 1>
=item B<Item 2>
=item B<Item 3>
=back
=head1 AUTHOR
Ji-Hyeon Gim <potatogim@potatogim.net>
=head1 CONTRIBUTORS
=head1 COPYRIGHT AND LICENSE
Copyright(c) 2015 by Ji-Hyeon Gim <potatogim@potatogim.net>
This is free software; you can redistribute it and/or modify it
under the same terms as Perl 5 itself at:
L<http://www.perlfoundation.org/artistic_license_2_0>
You may obtain a copy of the full license at:
L<http://www.perl.com/perl/misc/Artistic.html>
=head1 SEE ALSO
=cut
......@@ -11,10 +11,6 @@
# LICENSE: Artistic License 2.0
# NOTE:
#=============================================================================
use strict;
use warnings;
use utf8;
use Mojolicious::Lite;
# /hello (Accept: application/json)
......@@ -46,52 +42,3 @@ get '/hello' => sub {
# app->types->type(rdf => "application/rdf+xml");
app->start;
1;
__END__
=encoding utf8
=head1 NAME
content_negotiation.pl -
=head1 SYNOPSIS
=head1 DESCRIPTION
=over
=item B<Item 1>
=item B<Item 2>
=item B<Item 3>
=back
=head1 AUTHOR
Ji-Hyeon Gim <potatogim@potatogim.net>
=head1 CONTRIBUTORS
=head1 COPYRIGHT AND LICENSE
Copyright(c) 2015 by Ji-Hyeon Gim <potatogim@potatogim.net>
This is free software; you can redistribute it and/or modify it
under the same terms as Perl 5 itself at:
L<http://www.perlfoundation.org/artistic_license_2_0>
You may obtain a copy of the full license at:
L<http://www.perl.com/perl/misc/Artistic.html>
=head1 SEE ALSO
=cut
......@@ -11,10 +11,6 @@
# LICENSE: Artistic License 2.0
# NOTE:
#=============================================================================
use strict;
use warnings;
use utf8;
use Mojolicious::Lite;
# Render template "templates/foo/bar.html.ep"
......@@ -25,52 +21,3 @@ any '/external' => sub {
};
app->start;
1;
__END__
=encoding utf8
=head1 NAME
external_templates.pl -
=head1 SYNOPSIS
=head1 DESCRIPTION
=over
=item B<Item 1>
=item B<Item 2>
=item B<Item 3>
=back
=head1 AUTHOR
Ji-Hyeon Gim <potatogim@potatogim.net>
=head1 CONTRIBUTORS
=head1 COPYRIGHT AND LICENSE
Copyright(c) 2015 by Ji-Hyeon Gim <potatogim@potatogim.net>
This is free software; you can redistribute it and/or modify it
under the same terms as Perl 5 itself at:
L<http://www.perlfoundation.org/artistic_license_2_0>
You may obtain a copy of the full license at:
L<http://www.perl.com/perl/misc/Artistic.html>
=head1 SEE ALSO
=cut
......@@ -11,9 +11,6 @@
# LICENSE: Artistic License 2.0
# NOTE:
#=============================================================================
use strict;
use warnings;
use utf8;
# multipart/form-data 요청으로 올려지는 모든 파일들은 자동으로 Mojo::Upload
# 객체로 사용 가능하고, 메모리 점유율은 신경 안써도 된다.
......
......@@ -11,10 +11,6 @@
# LICENSE: Artistic License 2.0
# NOTE:
#=============================================================================
use strict;
use warnings;
use utf8;
use Mojolicious::Lite;
# /detection
......@@ -27,54 +23,6 @@ get '/detection' => sub {
app->start;
1;
__END__
=encoding utf8
=head1 NAME
formats.pl -
=head1 SYNOPSIS
=head1 DESCRIPTION
=over
=item B<Item 1>
=item B<Item 2>
=item B<Item 3>
=back
=head1 AUTHOR
Ji-Hyeon Gim <potatogim@potatogim.net>
=head1 CONTRIBUTORS
=head1 COPYRIGHT AND LICENSE
Copyright(c) 2015 by Ji-Hyeon Gim <potatogim@potatogim.net>
This is free software; you can redistribute it and/or modify it
under the same terms as Perl 5 itself at:
L<http://www.perlfoundation.org/artistic_license_2_0>
You may obtain a copy of the full license at:
L<http://www.perl.com/perl/misc/Artistic.html>
=head1 SEE ALSO
=cut
__DATA__
@@ detected.html.ep
......
......@@ -11,10 +11,6 @@
# LICENSE: Artistic License 2.0
# NOTE:
#=============================================================================
use strict;
use warnings;
use utf8;
use Mojolicious::Lite;
# /hello.json
......@@ -31,52 +27,3 @@ get '/hello' => [format => [qw/json txt/]] => sub {
# 그런데... HTTP 요청에서 stash를 설정하려면 대체 어떻게 해야 하지?
app->start;
1;
__END__
=encoding utf8
=head1 NAME
formats2.pl -
=head1 SYNOPSIS
=head1 DESCRIPTION
=over
=item B<Item 1>
=item B<Item 2>
=item B<Item 3>
=back
=head1 AUTHOR
Ji-Hyeon Gim <potatogim@potatogim.net>
=head1 CONTRIBUTORS
=head1 COPYRIGHT AND LICENSE
Copyright(c) 2015 by Ji-Hyeon Gim <potatogim@potatogim.net>
This is free software; you can redistribute it and/or modify it
under the same terms as Perl 5 itself at:
L<http://www.perlfoundation.org/artistic_license_2_0>
You may obtain a copy of the full license at:
L<http://www.perl.com/perl/misc/Artistic.html>
=head1 SEE ALSO
=cut
......@@ -11,10 +11,6 @@
# LICENSE: Artistic License 2.0
# NOTE:
#=============================================================================
use strict;
use warnings;
use utf8;
use Mojolicious::Lite;
# /hello
......@@ -34,52 +30,3 @@ get '/foo' => { text => 'No format detection again.' };
get '/bar' => [format => 'txt'] => { text => ' Just one format.' };
app->start;
1;
__END__
=encoding utf8
=head1 NAME
formats3.pl -
=head1 SYNOPSIS
=head1 DESCRIPTION
=over
=item B<Item 1>
=item B<Item 2>
=item B<Item 3>
=back
=head1 AUTHOR
Ji-Hyeon Gim <potatogim@potatogim.net>
=head1 CONTRIBUTORS
=head1 COPYRIGHT AND LICENSE
Copyright(c) 2015 by Ji-Hyeon Gim <potatogim@potatogim.net>
This is free software; you can redistribute it and/or modify it
under the same terms as Perl 5 itself at:
L<http://www.perlfoundation.org/artistic_license_2_0>
You may obtain a copy of the full license at:
L<http://www.perl.com/perl/misc/Artistic.html>
=head1 SEE ALSO
=cut
......@@ -11,10 +11,6 @@
# LICENSE: Artistic License 2.0
# NOTE:
#=============================================================================
use strict;
use warnings;
use utf8;
use Mojolicious::Lite;
# /foo?user=sri
......@@ -26,53 +22,3 @@ get '/foo' => sub {
};
app->start;
1;
__END__
=encoding utf8
=head1 NAME
get_and_post_parms.pl -
=head1 SYNOPSIS
=head1 DESCRIPTION
=over
=item B<Item 1>
=item B<Item 2>
=item B<Item 3>
=back
=head1 AUTHOR
Ji-Hyeon Gim <potatogim@gluesys.com>
=head1 CONTRIBUTORS
=head1 COPYRIGHT AND LICENSE
Copyright(c) 2015 by Ji-Hyeon Gim <potatogim@gluesys.com>
This is free software; you can redistribute it and/or modify it
under the same terms as Perl 5 itself at:
L<http://www.perlfoundation.org/artistic_license_2_0>
You may obtain a copy of the full license at:
L<http://www.perl.com/perl/misc/Artistic.html>
=head1 SEE ALSO
=cut
......@@ -10,6 +10,7 @@ get '/' => sub {
};
app->start;
__DATA__
@@ index.html.ep
......
......@@ -11,10 +11,6 @@
# LICENSE: Artistic License 2.0
# NOTE:
#=============================================================================
use strict;
use warnings;
use utf8;
use Mojolicious::Lite;
# A helper to identify visitors
......@@ -36,53 +32,6 @@ get '/secret' => sub {
app->start;
1;
__END__
=encoding utf8
=head1 NAME
helpers.pl -
=head1 SYNOPSIS
=head1 DESCRIPTION
=over
=item B<Item 1>
=item B<Item 2>
=item B<Item 3>
=back
=head1 AUTHOR
Ji-Hyeon Gim <potatogim@gluesys.com>
=head1 CONTRIBUTORS
=head1 COPYRIGHT AND LICENSE
Copyright(c) 2015 by Ji-Hyeon Gim <potatogim@gluesys.com>
This is free software; you can redistribute it and/or modify it
under the same terms as Perl 5 itself at:
L<http://www.perlfoundation.org/artistic_license_2_0>
You may obtain a copy of the full license at:
L<http://www.perl.com/perl/misc/Artistic.html>
=head1 SEE ALSO
=cut
__DATA__
@@ secret.html.ep
......
......@@ -11,10 +11,6 @@
# LICENSE: Artistic License 2.0
# NOTE:
#=============================================================================
use strict;
use warnings;
use utf8;
use Mojolicious::Lite;
# Access request informatin
......@@ -35,52 +31,3 @@ post "/echo" => sub {
};
app->start;
1;
__END__
=encoding utf8
=head1 NAME
http.pl -
=head1 SYNOPSIS
=head1 DESCRIPTION
=over
=item B<Item 1>
=item B<Item 2>
=item B<Item 3>
=back
=head1 AUTHOR
Ji-Hyeon Gim <potatogim@gluesys.com>
=head1 CONTRIBUTORS
=head1 COPYRIGHT AND LICENSE
Copyright(c) 2015 by Ji-Hyeon Gim <potatogim@gluesys.com>
This is free software; you can redistribute it and/or modify it
under the same terms as Perl 5 itself at:
L<http://www.perlfoundation.org/artistic_license_2_0>
You may obtain a copy of the full license at:
L<http://www.perl.com/perl/misc/Artistic.html>
=head1 SEE ALSO
=cut
......@@ -11,10 +11,6 @@
# LICENSE: Artistic License 2.0
# NOTE:
#=============================================================================
use strict;
use warnings;
use utf8;
use Mojolicious::Lite;
# GET /hello
......@@ -54,52 +50,3 @@ any '/whatever' => sub {
};
app->start;
1;
__END__
=encoding utf8
=head1 NAME
http_methods.pl -
=head1 SYNOPSIS
=head1 DESCRIPTION