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 <jona...@gmail.com> 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 <jona...@gmail.com> 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 <not....@gmail.com> wrote:
>
>
> On Thu, Mar 1, 2018 at 9:56 AM, David Cantrell <da...@cantrell.org.uk>
> 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: jona...@cpan.org <jona...@cpan.org>
> twitter: @jonasbn
> blog: https://lastmover.wordpress.com/
>
>
>
>
>
>

Reply via email to