Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^3: How do I package a module and related apps for successful upload to cpan

by hippo (Bishop)
on Sep 15, 2022 at 15:58 UTC ( [id://11146895]=note: print w/replies, xml ) Need Help??


in reply to Re^2: How do I package a module and related apps for successful upload to cpan
in thread How do I package a module and related apps for successful upload to cpan

I’ll try /scripts. I had read that /scripts and /bin were supported in Dist:Zilla, it I don’t recall there being any clear distinction made and I was following other examples on cpan where /bin is used, like App::cpanminus.

If you take a look at how MetaCPAN treats the file in bin/ in App::cpanminus you will notice that it too is labelled as "Documentation". Arguably, it shouldn't be but if you put your scripts in scripts/ like HTML::Template then they evidently won't be considered as documentation. It's a very minor point, all told.

Edited for link typo (Thanks, pryrt)


🦛

Replies are listed 'Best First'.
Re^4: How do I package a module and related apps for successful upload to cpan
by PUCKERING (Sexton) on Sep 15, 2022 at 17:17 UTC
    After some experimentation I discovered the key difference between putting scripts in /bin vs /scripts: the installer Dist::Zilla creates will install scripts it finds in /bin into the perl/site/bin directory, but it doesn't do that for /scripts. It also automatically generates .bat files for them on Windows. I haven't checked Unix, but it wouldn't surprise me if it generates files without the .pl extension and sets the executable permission on them.

    This actually suits my use case. I built ghcn_fetch.pl to be general purpose (albeit for a very specific application) so anyone interested in climate data could use it find weather stations of interest and to retrieve daily or summarized data from NOAA GHCN and easily analyze that data in Excel or other tools. So, when I install Weather::GHCN I want it to install the ghcn_*.pl scripts in site/bin so I can execute them.

    Is this not reasonable? Is there a better or more preferred way?

    As a side note, the scripts are really just a thin wrapper that uses a like-named module (e.g. ghcn_fetch.pl uses Fetch.pl) and calls its run() sub, plus a lot of POD. I've currently put these app modules in App::GHCN. But now I'm wondering if that's the right approach.

    My original vision was to have module GHCN and application scripts ghcn_fetch, ghcn_extremes and ghcn_station_counts all show up in CPAN when you search for GHCN. Now I'm thinking there are two ways to package this stuff:

    Plan A

    1. Weather-GHCN will be the package name, and it will contain lib Weather/GHCN and the .pm files for the GHCN modules.

    2. The app modules Fetch.pm, Extremes.pm and StationCounts.pm could live there too, or maybe in an App subfolder (e.g. use Weather::GHCN::App::Fetch inside ghcn_fetch.pl)

    3. The ghcn_*.pl scripts go in a /bin folder so they'll be installed in site/bin

    The downside to this plan is that I don't think that ghcn_fetch et al will show up in cpan at all. The POD in the GHCN modules documents the API. The POD in ghcn_fetch documents the application and how one would use it. If someone is looking for a tool to extract and analyze climate data, I want them to find ghcn_fetch and read it's POD, not the POD for any of the GHCN modules. They only need that to build their own tool.

    Plan B

    1. same as Plan A

    2. same as Plan A

    3. The ghcn_*.pl scripts are each packaged separately: App::ghcn_fetch, App:ghcn_extremes, and App:ghcn_station_counts

    The advantage to this plan is that the ghcn scripts will show up in a cpan search and, perhaps more importantly, the documentation will be picked up from the script and be a lot more meaningful than the POD for a GHCN class API. So, I'm leaning in this direction.

    Your feedback on these plans, and other suggestions, would be much appreciated.

    Thank you for your time on this matter. You've been a real help. I've been programming off and on in perl for years, am retired now, and it's become something of a hobby. I'm a neophyte when it comes to cpan though, and I'd like to start giving back to the community so I plan to put your help to good use.

    - Gary

    P.S. I considered using Weather::NOAA for GHCN, but when I tried emailing the owner of the modules in that namespace email failed. Apparently lbecchi@cpan.org is no longer a valid email. I also downloaded the module Weather::NOAA:GFS, which is from 2004, and discovered that the servers it accesses do not respond to ping. The code is likely quite out of data. So, I didn't want my code coexisting with a couple of defunct modules in the ::NOAA subspace.

      I just thought of a Plan C:

      Plan C

      1. Weather-GHCN will be the package name, and it will contain lib Weather/GHCN and the .pm files for the GHCN modules.

      2. App-ghcn will be the package name for the app modules in lib) and all three scripts (in /bin)

      This way, App::ghcn will show up in cpan search, and installing App::ghcn will install the scripts in /site/bin. Weather::GHCN will be a dependency.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-19 11:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found