Stuff under examples, eg, or ex directories are, IMO, partially meant for documentation to show how the module is used. Putting real codes (read: runnable examples) along with some description are best to put in the POD, be it in the main package or a package of its own.

But I assume that the examples are supposed to be runnable so they must be on their on files. If this is the case then it's actually natural to have these files are officially installed somewhere in the path. The problem is, the standard path installation of Perl modules are not like normal programs. For Linux system for example, there's a bunch of places to put different kind of stuff around.

My suggestion is to specify those examples files as executable files so the module installation process will put those files to the standard place, e.g. /usr/bin. To achieve this you say in the Makefile.PL file:

WriteMakefile( # other standard pairs EXE_FILES => [qw( examples/file1 examples/file2 examples/fileN )], );
For other destination of where to install the examples, you may want to tweak the Makefile.PL based on ExtUtils::MakeMaker, or other means for module installation like Module::Build or Module::Install.

Yet, I don't guarantee this to be "intuitive" :-)


Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!


In reply to Re: examples in CPAN distributions by naikonta
in thread examples in CPAN distributions by zby

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.