File: QuickStart.pod

package info (click to toggle)
libdancer2-perl 2.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,768 kB
  • sloc: perl: 8,671; sql: 14; makefile: 8
file content (134 lines) | stat: -rw-r--r-- 3,358 bytes parent folder | download
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# ABSTRACT: Quickly install Dancer2 and boostrap a new application
package Dancer2::Manual::QuickStart;

__END__

=pod

=encoding UTF-8

=head1 NAME

Dancer2::Manual::QuickStart - Quickly install Dancer2 and boostrap a new application

=head1 VERSION

version 2.0.1

=head1 Installing Dancer2

Installation of Dancer2 is simple, either by using CPAN or your operating
system's package manager.

=head2 Via CPAN

Use your favorite method to install from CPAN:

    sudo cpan install Dancer2

Or:

    sudo cpanm Dancer2

(If you don't have root access, omit the 'sudo', and cpanminus will install
Dancer2 and prereqs into F<~/perl5>.)

=head2 Via OS Package Manager

Dancer2 is also available as a package for a number of freely-available
OSes, including most Linux distributions, FreeBSD, and OpenBSD.

On Debian/Ubuntu, you can install Dancer2 as such:

    sudo apt install libdancer2-perl

For other popular operating systems (the use of sudo is implied
if necessary):

    # 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, that distribution-packaged versions sometimes lag behind
the most recent version on CPAN.

=head1 Bootstrapping a new Dancer2 application

Create a web application using the C<dancer2> script:

    $ 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

It creates a directory named after the name of the app, along with a
configuration file, a views directory (where your templates and layouts
will live), an environments directory (where environment-specific
settings live), a module containing the actual guts of your application, and
a script to start it. Finally, F<.dancer> indicates the root directory of
your app, making it easier for Dancer2 to determine the various paths it
needs for finding resources and code within your application.

Because Dancer2 is a L<PSGI> web application framework, you can use the
C<plackup> tool (provided by L<Plack>) for launching the application:

    plackup bin/app.psgi

View the web application at:

    http://localhost:5000/

=head1 AUTHOR

Dancer Core Developers

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2025 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.

=cut