Dancer2...ickStart(3)

πŸ“¦
version 2.2.1 Β· 3 versions
, in fedora 44

✨ 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 🫢


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