| 1 |
# ABSTRACT: Quickly install Dancer2 and boostrap a new application |
| 2 |
package Dancer2::Manual::QuickStart; |
| 3 |
|
| 4 |
__END__ |
| 5 |
|
| 6 |
=pod |
| 7 |
|
| 8 |
=encoding UTF-8 |
| 9 |
|
| 10 |
=head1 NAME |
| 11 |
|
| 12 |
Dancer2::Manual::QuickStart - Quickly install Dancer2 and boostrap a new application |
| 13 |
|
| 14 |
=head1 VERSION |
| 15 |
|
| 16 |
version 2.2.2 |
| 17 |
|
| 18 |
=head1 Installing Dancer2 |
| 19 |
|
| 20 |
Installation of Dancer2 is simple, either by using CPAN or your operating |
| 21 |
system's package manager. |
| 22 |
|
| 23 |
=head2 Via CPAN |
| 24 |
|
| 25 |
Use your favorite method to install from CPAN: |
| 26 |
|
| 27 |
sudo cpan install Dancer2 |
| 28 |
|
| 29 |
Or: |
| 30 |
|
| 31 |
sudo cpanm Dancer2 |
| 32 |
|
| 33 |
(If you don't have root access, omit the 'sudo', and cpanminus will install |
| 34 |
Dancer2 and prereqs into F<~/perl5>.) |
| 35 |
|
| 36 |
=head2 Via OS Package Manager |
| 37 |
|
| 38 |
Dancer2 is also available as a package for a number of freely-available |
| 39 |
OSes, including most Linux distributions, FreeBSD, and OpenBSD. |
| 40 |
|
| 41 |
On Debian/Ubuntu, you can install Dancer2 as such: |
| 42 |
|
| 43 |
sudo apt install libdancer2-perl |
| 44 |
|
| 45 |
For other popular operating systems (the use of sudo is implied |
| 46 |
if necessary): |
| 47 |
|
| 48 |
# RedHat |
| 49 |
dnf install perl-Dancer2 |
| 50 |
|
| 51 |
# MacPorts |
| 52 |
port install p5-dancer2 |
| 53 |
|
| 54 |
# FreeBSD |
| 55 |
pkg install p5-Dancer2 |
| 56 |
|
| 57 |
# OpenBSD |
| 58 |
pkg_add p5-Dancer2 |
| 59 |
|
| 60 |
# NetBSD |
| 61 |
pkgin install p5-Dancer2 |
| 62 |
|
| 63 |
Do be aware, though, that distribution-packaged versions sometimes lag behind |
| 64 |
the most recent version on CPAN. |
| 65 |
|
| 66 |
=head1 Bootstrapping a new Dancer2 application |
| 67 |
|
| 68 |
Create a web application using the C<dancer2> script: |
| 69 |
|
| 70 |
$ dancer2 gen -a MyApp && cd MyApp |
| 71 |
+ MyApp |
| 72 |
+ MyApp/config.yml |
| 73 |
+ MyApp/Makefile.PL |
| 74 |
+ MyApp/MANIFEST.SKIP |
| 75 |
+ MyApp/.dancer |
| 76 |
+ MyApp/cpanfile |
| 77 |
+ MyApp/bin |
| 78 |
+ MyApp/bin/app.psgi |
| 79 |
+ MyApp/environments |
| 80 |
+ MyApp/environments/development.yml |
| 81 |
+ MyApp/environments/production.yml |
| 82 |
+ MyApp/lib |
| 83 |
+ MyApp/lib/MyApp.pm |
| 84 |
+ MyApp/public |
| 85 |
+ MyApp/public/favicon.ico |
| 86 |
+ MyApp/public/500.html |
| 87 |
+ MyApp/public/dispatch.cgi |
| 88 |
+ MyApp/public/404.html |
| 89 |
+ MyApp/public/dispatch.fcgi |
| 90 |
+ MyApp/public/css |
| 91 |
+ MyApp/public/css/error.css |
| 92 |
+ MyApp/public/css/style.css |
| 93 |
+ MyApp/public/images |
| 94 |
+ MyApp/public/images/perldancer.jpg |
| 95 |
+ MyApp/public/images/perldancer-bg.jpg |
| 96 |
+ MyApp/public/javascripts |
| 97 |
+ MyApp/public/javascripts/jquery.js |
| 98 |
+ MyApp/t |
| 99 |
+ MyApp/t/001_base.t |
| 100 |
+ MyApp/t/002_index_route.t |
| 101 |
+ MyApp/views |
| 102 |
+ MyApp/views/index.tt |
| 103 |
+ MyApp/views/layouts |
| 104 |
+ MyApp/views/layouts/main.tt |
| 105 |
|
| 106 |
It creates a directory named after the name of the app, along with a |
| 107 |
configuration file, a views directory (where your templates and layouts |
| 108 |
will live), an environments directory (where environment-specific |
| 109 |
settings live), a module containing the actual guts of your application, and |
| 110 |
a script to start it. Finally, F<.dancer> indicates the root directory of |
| 111 |
your app, making it easier for Dancer2 to determine the various paths it |
| 112 |
needs for finding resources and code within your application. |
| 113 |
|
| 114 |
Because Dancer2 is a L<PSGI> web application framework, you can use the |
| 115 |
C<plackup> tool (provided by L<Plack>) for launching the application: |
| 116 |
|
| 117 |
plackup bin/app.psgi |
| 118 |
|
| 119 |
View the web application at: |
| 120 |
|
| 121 |
http://localhost:5000/ |
| 122 |
|
| 123 |
=head1 AUTHOR |
| 124 |
|
| 125 |
Dancer Core Developers |
| 126 |
|
| 127 |
=head1 COPYRIGHT AND LICENSE |
| 128 |
|
| 129 |
This software is copyright (c) 2026 by Alexis Sukrieh. |
| 130 |
|
| 131 |
This is free software; you can redistribute it and/or modify it under |
| 132 |
the same terms as the Perl 5 programming language system itself. |
| 133 |
|
| 134 |
=cut |