Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

.dancer -- what's it for

by kcott (Archbishop)
on Jan 22, 2021 at 16:28 UTC ( [id://11127292]=perlquestion: print w/replies, xml ) Need Help??

kcott has asked for the wisdom of the Perl Monks concerning the following question:

G'day All,

I keep seeing the file '.dancer' when working with Dancer2. It's in every tutorial but never explained. I've no idea what this file is for.

Any ideas?

— Ken

Replies are listed 'Best First'.
Re: .dancer -- what's it for
by Discipulus (Canon) on Jan 22, 2021 at 17:20 UTC
    Hello kcot,

    a short search pointed me to perl-dancer-conference-2015-report

    > It is recommended to add an empty .dancer file to your app’s directory, which indicates that this is a Dancer app (other Perl frameworks do similarly).

    also found in Changes and this github issue

    L*

    PS

    In the main doc at BOOTSTRAPPING-A-NEW-APP they list the skeleton files created and you can view also at share/skel github repo where the above fix (the simplest fix of the history! ;) was merged.

    PPS the meaning of this file to be there is exposed in the above github issue:

    > There's no reason why we shouldn't generate this file. It might help move away from the bin/lib directory checks.

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

      G'day Discipulus,

      Thanks for taking the time to dig out this information; unfortunately, it gives vague hints but nothing concrete. I appreciate that you're only reporting what you found; I'm not trying to shoot the messenger in any of the following paragraphs.

      It's mentioned as a bug fix; however, I can't find any description of the bug it is supposed to fix. Can you provide a link to the actual bug? I just see #1032 pointing to #1043 and vice versa; I don't see any bug report.

      If .dancer is supposed to identify a Dancer app, I'd have thought that .dancer2 would be more appropriate to identify a Dancer2 app.

      "There's no reason why we shouldn't generate this file." — fair enough, but what's the reason to generate it?

      "It might help move away from the bin/lib directory checks." — what checks? what's wrong with them? why move away from them?

      — Ken

      Yeah. Never did understand, though, what this file was for. So far as I know, nothing tests for it.
Re: .dancer -- what's it for
by 1nickt (Canon) on Jan 22, 2021 at 23:00 UTC

    Hi Ken, FWIW I never heard of this until today and I've been using Dancer and Dancer2 for some years. I always build up my app directories from scratch though, not using the supplied script. I'm rather sure you can ignore it or cease using it altogether.

    Hope this helps!


    The way forward always starts with a minimal test.

      G'day 1nickt,

      I've had some minimal exposure to Dancer but don't recall ever seeing .dancer associated with that.

      I've just started a new $work project that uses Dancer2. That required a fair bit of reading and this is where .dancer kept appearing.

      I'm also not using the supplied script; but I have been looking at its documented output as a reference source. Some files I'll need with some modifications; some I won't want at all; and then there was .dancer with a huge question mark hanging over it.

      — Ken

        The only thing I can speculate is that it's a marker for the base directory -- but that would be odd since there's a method for that. On the other hand, I do usually always have such a dot-file marking the root of my app installation on the FS, so that scripts know where to look for library paths, and so on. Most of my scripts start with something like:

        BEGIN { use Path::Tiny; my $base = path(__FILE__)->parent; $base = $base->parent until -f "$base/.some-dot-file" or $base->is +_rootdir; unshift @INC, "$base/lib"; }
        ... so that they don't have to know where they live. Possibly .dancer has or once had a purpose like that?


        The way forward always starts with a minimal test.
Re: .dancer -- what's it for -- doc PR
by Discipulus (Canon) on Jul 31, 2023 at 09:03 UTC
    Hello kcott,

    In Jan 26, 2021 I submitted this issue just to get the attention of Dancer2 devs on something missing in their docs or a leftover in their codebase: I digged it a bit but I was unsure.

    Well they needed some time but the important is that now there is a PR fixing it and yes! the file is used by lib/Dancer2/Core/Role/HasLocation.pm and so proposed to be added in the docs:

    > A default skeleton is used to bootstrap the new a script to start it. Finally, .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.

    Thanks to cromedome for their work and you for your patience.

    Happy End! :)

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

      G'day Discipulus,

      "Thanks to cromedome for their work and you for your patience."

      And to you for following-up after all this time. ++

      — Ken

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11127292]
Approved by haukex
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-16 18:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found