Re: testing scripts inside your distro

[email protected] (yary)
Newsgroups perl.cpan.testers.discuss
Message-ID <CAG2CFAYmGwwWWLo8xgOQ1fqQdeTEXAgOkrxuBUYn+xgE6AOrVg@mail.gmail.com>
I was a little puzzled by the first response, but figured, to each their
own! Glad to know we are all on the same page.

On Fri, Mar 2, 2018, 4:13 PM Jonas B. Nielsen <[email protected]> wrote:

> Huh?
>
> Just must have been drunk or something,
>
> I mean to say, I can ONLY agree with this approach.
>
> Sorry for any confusion and thanks for not roasting me :-)
>
> Have a nice weekend,
>
> jonasbn
>
>
> On 1 Mar 2018, at 17.36, Jonas B. Nielsen <[email protected]> wrote:
>
> I cannot agree with this approach, but sometimes a single file is the
> easiest to distribute.
>
> Currently I am looking at App::Fatpacker -
> https://metacpan.org/pod/App::FatPacker
>
> On 1 Mar 2018, at 15.00, yary <[email protected]> wrote:
>
>
> On Thu, Mar 1, 2018 at 9:56 AM, David Cantrell <[email protected]>
> wrote:
>
>>
>> My approach is to have the script be mostly a wrapper around more
>> easily-testable modules - the script just wrangles arguments and shows
>> results.
>>
>
> +1 for that approach in general. Makes it easy to call the "useful" code
> in the script in other places.
>
> Something to do in small scripts which don't aren't module material, is to
> put all the "useful" code into subs, put the command-line processing &
> printing into a "sub MAIN", and then have only this top-level statement:
>
>     exit MAIN unless caller;
>
> That lets the script be called normally, executing when run from the
> command line. On the other hand, another perl program can "require '
> the_code_file.pl'" and load all the subs without anything executing- so
> your test code can call MAIN after setting @ARGV to whatever it wants - or
> can test the other subs as needed.
>
>
>
>
>
> —
> pauseid: JONASBN
> email: [email protected] <[email protected]>
> twitter: @jonasbn
> blog: https://lastmover.wordpress.com/
>
>
>
>
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.