New CPAN Distribution Help

[email protected] (Tim Ka) Wed, 26 May 2021 08:45:49 +0200
Newsgroups perl.module-authors
Message-ID <CALd3OqGBfayeb3tuiiZJfaR5ZBygwU6wJpuTm9ni-KzkCVctkQ@mail.gmail.com>
Hey all,

I am looking for advice on making my *VERY FIRST* cpan distribution. ☺
I have few modules which I use for a tool I wrote (pod.pl) and wanted to
share it with the Perl community.

Here is my github repo <https://github.com/poti1/mojo>.

It includes:
 - Mojo-Pod: A stub module folder (using Module::Starter. I wanted to pull
out the modules into here, but was debating the names to use).
 - dir.pl: Original idea.
 - *pod.pl <http://pod.pl>*: Tool and Modules inside. Look here.

----------------------------------------------------
Background:

I had been using Python alot for work in the past year and I really liked
the dir() function to be able to quickly show all the available methods of
a Class or Object. I wrote about it here:
https://stackoverflow.com/questions/25810035/python-dir-equivalent-in-perl#answer-66832483

dir.pl is just a simple example showing the available methods in a
class/object.

I took the idea from dir.pl and built it into a tool I use quite regularly
now especially when learning Mojo.

----------------------------------------------------
Here are some sample outputs from the tool:

*Help section*
[image: image.png]

List all methods with a summary:
*perl pod.pl <http://pod.pl> ojo*
[image: image.png]

Show the documentation for a specific method:
*perl pod.pl <http://pod.pl> ojo x*
[image: image.png]

*perl pod.pl <http://pod.pl> Mojo::UserAgent*
[image: image.png]
----------------------------------------------------
Modules:

I created a few modules inside the tool which I wanted to extract into its
own distribution if possible.

*My::Pod::Simple::SimpleTree* - Take a pod file and return a simple linear
representation of it.
(I built upon the example from Pod::Simple::SimpleTree).

Sample output can be found in _mock_root().
   [
      [
         "head1",
         "NAME",
      ],
        [
         "Vervatim",
         "My new module",
      ],
      [
         "head1",
         " SYNOPSIS ",
      ],
  ]

*My::Pod* - Uses the structure generated by My::Pod::Simple::SimpleTree to
create a tree which is structured to include the sub tags like so:

{
   tag => "head1",
   text => ["NAME"],
   sub => [
   {
      tag => "verbatim",
     text => ["My new module"],
   }
  ],
},
{
   tag => "head1",
   text => ["SYNOPSIS"],
   sub => [
   {
      tag => "verbatim",
      text => ["Example usage"],
   }
  ],
}

The main roles of My::Pod are:
1. parse the linear (SimpleTree) into a structure.
2. Allow querying the pod tree.

----------------------------------------------------
*Pod Query API* (as found in _check_sections() )
[image: image.png]

So if I want the module name, I could do this:

*say My::Pod->new("ojo")->find_title;*

Where *find_title *is:
[image: image.png]

Similarly one can extract the *method*:
[image: image.png]

Or the *method summary* (when all methods are listed):
[image: image.png]

Lastly, using the query API, one can also pull out the *events *listed in a
pod file like so:
[image: image.png]


----------------------------------------------------
Summary

Please try of the *pod.pl <http://pod.pl>* script and give me your feedback.
I'd like to be able to contribute it and/or its sub modules to CPAN if
possible.


Kind Regards,
~Tim
image.png (image/png, 48 KB) - not displayed
image.png (image/png, 13.1 KB) - not displayed
image.png (image/png, 21.7 KB) - not displayed
image.png (image/png, 108.4 KB) - not displayed
image.png (image/png, 14.1 KB) - not displayed
image.png (image/png, 8.7 KB) - not displayed
image.png (image/png, 9.5 KB) - not displayed
image.png (image/png, 11.8 KB) - not displayed
image.png (image/png, 13.3 KB) - not displayed