Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Starting out with Dancer and falling at the first hurdle

by stevieb (Canon)
on Mar 31, 2022 at 02:41 UTC ( [id://11142559]=note: print w/replies, xml ) Need Help??


in reply to Starting out with Dancer and falling at the first hurdle

Very cryptic and bizarre. Although I've always been pleased with the Dancer2 documentation, I don't believe I've ever used that functionality before. I don't like how odd the 'help' messages are.

Here's what I've got on v0.301004:

steve@maezi ~/scratch >dancer2 -a Unknown option: a Usage: dancer2 [-h] -h --help --man [subcommand] at /Users/steve/perl5 +/perlbrew/perls/perl-5.32.1/lib/site_perl/5.32.1/CLI/Osprey/Descripti +ve/Usage.pm line 329. steve@maezi ~/scratch >dancer2 -h Usage: dancer2 [-h] [-h] [--help] [--man] [subcommand] Subcommands available: gen | version -h show a short help message --help show a long help message --man show the manual steve@maezi ~/scratch >dancer2 gen application is missing Usage: dancer2 gen [-acdghoprsx] [-p|--path directory] [-a|--applicati +on appname] [-d|--directory directory] [-c|--docker] [-g|--git] [-x|--no-check] [-o|--overwrite] [-r|--remo +te URI] [-s|--skel directory] [-h] [--help] [--man]

...ahh, looks like we may be getting somewhere!

steve@maezi ~/scratch >dancer2 gen --help Usage: dancer2 gen [-acdghoprsx] [-p|--path directory] [-a|--applicati +on appname] [-d|--directory directory] [-c|--docker] [-g|--git] [-x|--no-check] [-o|--overwrite] [-r|--remo +te URI] [-s|--skel directory] [-h] [--help] [--man] -p|--path directory application path (default: current directory +) -a|--application appname application name -d|--directory directory application directory (default: same as appl +ication name) -c|--docker create a dockerfile (container definition) -g|--git init git repository -x|--no-check don't check latest Dancer2 version (default: + check - requires internet) -o|--overwrite overwrite existing files -r|--remote URI URI for git repository (implies -g) -s|--skel directory skeleton directory -h show a short help message --help show a long help message --man show the manual

Let's try it:

steve@maezi ~/scratch >dancer2 gen -a AppName The latest stable Dancer2 release is 0.400000. You are currently using + 0.301004. Please check https://metacpan.org/pod/Dancer2/ for updates. + AppName + AppName/cpanfile + AppName/MANIFEST.SKIP + AppName/config.yml + AppName/Makefile.PL + AppName/.dancer + AppName/bin + AppName/bin/app.psgi + AppName/environments + AppName/environments/production.yml + AppName/environments/development.yml + AppName/t + AppName/t/001_base.t + AppName/t/002_index_route.t + AppName/public + AppName/public/favicon.ico + AppName/public/dispatch.cgi + AppName/public/500.html + AppName/public/404.html + AppName/public/dispatch.fcgi + AppName/lib + AppName/lib/AppName.pm + AppName/views + AppName/views/index.tt + AppName/public/css + AppName/public/css/style.css + AppName/public/css/error.css + AppName/public/images + AppName/public/images/perldancer-bg.jpg + AppName/public/images/perldancer.jpg + AppName/public/javascripts + AppName/public/javascripts/jquery.js + AppName/views/layouts + AppName/views/layouts/main.tt Your new application is ready! To run it: cd AppName plackup bin/app.psgi To access your application, point your browser to http://localhost:500 +0 If you need community assistance, the following resources are availabl +e: - Dancer website: https://perldancer.org - Twitter: https://twitter.com/PerlDancer/ - GitHub: https://github.com/PerlDancer/Dancer2/ - Mailing list: https://lists.perldancer.org/mailman/listinfo/dancer-u +sers - IRC: irc.perl.org#dancer Happy Dancing!

So it appears as though the tutorial is missing the gen keyword/command. If I get a chance tomorrow morning, I'll create a pull request with the fix (unless someone beats me to it).

Replies are listed 'Best First'.
Re^2: Starting out with Dancer and falling at the first hurdle
by stevieb (Canon) on Mar 31, 2022 at 16:01 UTC

      That's great and it's nice to see a well-organised repo and a responsive team.

      Not to take advantage of you, but what about the fact that the 'correct usage' message apparently comes from a die() in CLI::Osprey::Descriptive::Usage … whatever that is. It seems like a module with that name should be improving the user experience, not making it uglier.

        I'm too busy to worry about the die() thing. The entire error message was in my PR comments, so if they feel it necessary, they can deal with it.

        The documentation is updated now, so when the next release arrives, it'll be fixed, presumably minimizing that die from happening anyway.

Re^2: Starting out with Dancer and falling at the first hurdle
by LittleJack (Beadle) on Mar 31, 2022 at 22:17 UTC

    Thanks for your reply and for following up.

    I got very busy yesterday and didn't have a chance to reply—I eventually figured out the gen trick myself and have successfully created my first Dancer app.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11142559]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (6)
As of 2024-04-23 13:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found