### Install perlbrew Source: https://github.com/perldancer/dancer2/blob/main/CONTRIBUTING.md Install the perlbrew utility using cpanm. ```bash $ cpanm App::perlbrew ``` -------------------------------- ### Basic Dancer2 Application Source: https://github.com/perldancer/dancer2/blob/main/README.md A minimal example demonstrating how to create a simple web application with Dancer2. This snippet requires the Dancer2 module to be installed. ```perl use Dancer2; get '/' => sub { "Hello World" }; dance; ``` -------------------------------- ### Install Dist::Zilla Source: https://github.com/perldancer/dancer2/blob/main/CONTRIBUTING.md Install the Dist::Zilla distribution builder. ```bash $ cpanm Dist::Zilla ``` -------------------------------- ### Install project dependencies Source: https://github.com/perldancer/dancer2/blob/main/CONTRIBUTING.md Install all dependencies required by Dancer2. ```bash $ dzil listdeps | cpanm -n ``` -------------------------------- ### Install Dist::Zilla plugins Source: https://github.com/perldancer/dancer2/blob/main/CONTRIBUTING.md Install missing Dist::Zilla plugins required by the project's dist.ini. ```bash $ dzil authordeps | cpanm -n ``` -------------------------------- ### Install cpanm for brewed Perl Source: https://github.com/perldancer/dancer2/blob/main/CONTRIBUTING.md Install cpanm into the current perlbrew environment. ```bash $ perlbrew install-cpanm ``` -------------------------------- ### Install a specific Perl version Source: https://github.com/perldancer/dancer2/blob/main/CONTRIBUTING.md Install a specific Perl version with a custom name and without running tests to speed up the process. ```bash $ perlbrew install -n perl-5.14.4 --as dancer_development -j 3 ``` -------------------------------- ### Switch Perl version Source: https://github.com/perldancer/dancer2/blob/main/CONTRIBUTING.md Switch the active Perl environment to the newly installed version. ```bash $ perlbrew switch dancer_development ``` -------------------------------- ### List available Perl versions Source: https://github.com/perldancer/dancer2/blob/main/CONTRIBUTING.md Check which Perl versions are available for installation via perlbrew. ```bash $ perlbrew available ``` -------------------------------- ### Initialize perlbrew Source: https://github.com/perldancer/dancer2/blob/main/CONTRIBUTING.md Initialize the perlbrew environment. ```bash $ perlbrew init ``` -------------------------------- ### Run test suite Source: https://github.com/perldancer/dancer2/blob/main/CONTRIBUTING.md Verify changes using either prove or Dist::Zilla before submitting. ```bash $ prove -lvr t/ ``` ```bash $ dzil test --all ``` -------------------------------- ### Perform Dancer2 Release Source: https://github.com/perldancer/dancer2/blob/main/Releasing-Dancer2.md Execute this command to initiate the Dancer2 release process. It runs tests, builds a tarball, uploads to PAUSE, and commits changes. Ensure your PAUSE credentials are set up. ```bash dzil release --all ``` -------------------------------- ### Run local Dancer2 binary Source: https://github.com/perldancer/dancer2/blob/main/CONTRIBUTING.md Execute the Dancer2 binary using the local lib directory to avoid conflicts with system-installed versions. ```bash perl -Ilib script/dancer2 gen -s share/skel --overwrite --path /tmp/d2app -a MyApp::App ``` -------------------------------- ### Configure upstream remote Source: https://github.com/perldancer/dancer2/blob/main/CONTRIBUTING.md Set up the official repository as an upstream remote to track changes. ```bash $ git remote add upstream https://github.com/PerlDancer/Dancer2.git $ git fetch upstream ``` -------------------------------- ### Push branch to fork Source: https://github.com/perldancer/dancer2/blob/main/CONTRIBUTING.md Upload your topic branch to your GitHub fork. ```bash # ... commits ... git push origin pr/$name ``` -------------------------------- ### Session Engine Configuration Source: https://github.com/perldancer/dancer2/wiki/Migration Configuration is passed to the engine constructor; define attributes in the engine class to match the configuration keys. ```yaml session: "DBIC" engines: session: DBIC: dsn: "DBI:mysql:database=testing;host=127.0.0.1;port=3306" # DBI Data Source Name schema_class: "Interchange6::Schema" # DBIx::Class schema ``` ```perl has dsn => ( is => 'ro', ); has schema_class => ( is => 'ro', ); ``` -------------------------------- ### Run plugins auto tests Source: https://github.com/perldancer/dancer2/blob/main/tools/plugins_auto_tests/readme.txt Execute the testing suite within the plugins_auto_test directory. ```bash $ cd plugins_auto_test $ make #report will be in plugins_auto_test/result.csv ``` -------------------------------- ### Create a topic branch Source: https://github.com/perldancer/dancer2/blob/main/CONTRIBUTING.md Isolate your changes in a new branch for the pull request. ```bash # you should be in main here $ git checkout -b pr/$name ``` -------------------------------- ### Build and test Dancer2 Source: https://github.com/perldancer/dancer2/blob/main/CONTRIBUTING.md Build the project and run tests without author-specific tests. ```bash $ dzil build $ dzil test --no-author ``` -------------------------------- ### Verify Perl path Source: https://github.com/perldancer/dancer2/blob/main/CONTRIBUTING.md Verify that the active Perl binary is the one managed by perlbrew. ```bash $ which perl ``` -------------------------------- ### Clone Dancer2 repository Source: https://github.com/perldancer/dancer2/blob/main/CONTRIBUTING.md Clone the Dancer2 source code from GitHub. ```bash $ git clone git://github.com/yourname/Dancer2.git ``` -------------------------------- ### Merge Branch and Push Source: https://github.com/perldancer/dancer2/blob/main/Releasing-Dancer2.md Use this command to merge a feature branch into the main branch and push the changes. Ensure all tests pass and Changes are updated before merging. ```bash git merge --no-ff && git push ``` -------------------------------- ### Explicit Application Name Setting Source: https://github.com/perldancer/dancer2/wiki/Migration Use the appname directive to share namespaces and variables across different modules. ```perl package myapp; use Dancer2; use myapp::admin; hook before => sub { var db => "..."; }; prefix undef; get '/' => sub {...}; 1; package myapp::admin; use Dancer2 appname => "myapp"; prefix '/admin'; get '/' => sub {...}; ``` -------------------------------- ### Implement host predicate route decorator Source: https://github.com/perldancer/dancer2/wiki/Wishlist Use this syntax to restrict a route to a specific virtual host within a Dancer2 application. ```perl get '/' => host 'my.host.com' => sub {"Hello from my.host.com root"}; ``` -------------------------------- ### Sync local branch Source: https://github.com/perldancer/dancer2/blob/main/CONTRIBUTING.md Update your local main branch with the latest changes from upstream. ```bash $ git pull upstream main $ git push origin main ``` -------------------------------- ### Configure Vim to fold Dancer2 route handlers Source: https://github.com/perldancer/dancer2/wiki/Undocumented-development-tips-and-tricks Add this setting to your .vimrc file to enable folding for anonymous subroutines used in route handlers. ```vim let g:perl_fold_anonymous_subs = 1 ``` -------------------------------- ### Cleanup after merge Source: https://github.com/perldancer/dancer2/blob/main/CONTRIBUTING.md Remove local and remote topic branches after a successful merge. ```bash $ git checkout main $ git branch -D pr/$name $ git push origin :pr/$name ``` -------------------------------- ### Deprecated Import Syntax Source: https://github.com/perldancer/dancer2/wiki/Migration These import tags are no longer valid or required in Dancer2. ```perl use Dancer2 qw(:syntax); use Dancer2 qw(:tests); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.