Dancer2...ickStart(3)
β¨ NAME β¨
Dancer2::Manual::QuickStart β the lil' glow-up guide to installing Dancer2 and bootstrapping a brand new app, bestie π
(also hi, this is the Dancer2...ickStart(3) page, from the User Contributed Perl Documentation section, mwah π)
πΈ VERSION πΈ
version 2.2.1 β that's the one, no cap β¨
π¦ Installing Dancer2 π¦
Okay so installing Dancer2 is literally so easy. You've got two routes: CPAN, or your operating system's package manager. Pick your fighter π
π Via CPAN
Use whatever your fave method is to install from CPAN:
sudo cpan install Dancer2
Or, if you're a cpanm girlie:
sudo cpanm Dancer2
π«Ά psst β if you don't have root access, just drop the'sudo', and cpanminus will install Dancer2 and its prereqs into~/perl5. Iconic behavior tbh.
π Via OS Package Manager
Dancer2 is also available as a package for a whole bunch of freely-available OSes, including most Linux distributions, FreeBSD, and OpenBSD. The range? Obsessed.
On Debian/Ubuntu, you can install Dancer2 like this:
sudo apt install libdancer2-perl
For other popular operating systems (the use of sudo is implied if necessary, don't come for me π):
# RedHat
dnf install perl-Dancer2
# MacPorts
port install p5-dancer2
# FreeBSD
pkg install p5-Dancer2
# OpenBSD
pkg_add p5-Dancer2
# NetBSD
pkgin install p5-Dancer2
β οΈ Do be aware though, bestie β distribution-packaged versions sometimes lag behind the most recent version on CPAN. So if you want the freshest fit, CPAN is giving main character energy.
π Bootstrapping a new Dancer2 application π
Time to make a web app with the dancer2 script. Watch this:
$ dancer2 gen -a MyApp && cd MyApp
+ MyApp
+ MyApp/config.yml
+ MyApp/Makefile.PL
+ MyApp/MANIFEST.SKIP
+ MyApp/.dancer
+ MyApp/cpanfile
+ MyApp/bin
+ MyApp/bin/app.psgi
+ MyApp/environments
+ MyApp/environments/development.yml
+ MyApp/environments/production.yml
+ MyApp/lib
+ MyApp/lib/MyApp.pm
+ MyApp/public
+ MyApp/public/favicon.ico
+ MyApp/public/500.html
+ MyApp/public/dispatch.cgi
+ MyApp/public/404.html
+ MyApp/public/dispatch.fcgi
+ MyApp/public/css
+ MyApp/public/css/error.css
+ MyApp/public/css/style.css
+ MyApp/public/images
+ MyApp/public/images/perldancer.jpg
+ MyApp/public/images/perldancer-bg.jpg
+ MyApp/public/javascripts
+ MyApp/public/javascripts/jquery.js
+ MyApp/t
+ MyApp/t/001_base.t
+ MyApp/t/002_index_route.t
+ MyApp/views
+ MyApp/views/index.tt
+ MyApp/views/layouts
+ MyApp/views/layouts/main.tt
Look at all that π Here's what you just got, fr fr:
- A directory named after the name of the app (that's the
<name>of your app, cutie) - A configuration file
- A views directory β that's where your templates and layouts will live
- An environments directory β that's where environment-specific settings live
- A module containing the actual guts of your application
- A script to start it
And finally, .dancer indicates the root directory of your app, which makes it easier for Dancer2 to determine the various paths it needs for finding resources and code within your application. It's giving "I know where I am" energy π§β¨
Because Dancer2 is a PSGI web application framework, you can use the plackup tool (provided by Plack) for launching the application:
plackup bin/app.psgi
Then go view the web application at:
http://localhost:5000/
Slay. You're live. π₯
π AUTHOR π
Dancer Core Developers β the legends themselves π«Ά
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2026 by Alexis Sukrieh.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Periodt. β
okay that's the whole thing, bestie β this was perl v5.42.3, dated 2026-09-20, and you just read Dancer2...ickStart(3). go build something iconic ππ¦β¨
π¦ where this page comes from
- fedora 44: perl-Dancer2 2.2.1-1.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms