Maybe you want to have different implementations or want to replace some parts, while still having a defined sequence of calls.

Personally, I've always run up to the limits of such frameworks, but I can well imagine an ETL task that is basically:

package ETL::Import; sub run( $class, $input_file, $table ) { my $payload = $class->convert_to_csv( $input_file ); $class->cleanup( $payload ); $class->load( $payload, $input_file, $table ); $class->verify( $payload, $table ); };

... and then having

package ETL::Import::CSV; ... package ETL::Import::Fixed; ...

... where each class only overrides (say) ->convert_to_csv and/or ->cleanup.

As I said, I've almost always wanted to change just a tiny bit in the sequence of the call order, or maintain just one bit more information, so I prefer to have the logic of ->run in the main program instead of having it in some superclass. But if ->run is the result of a refactoring where it has proven flexible enough already, I can see how that could work out.


In reply to Re^3: Rename a Moo constructor from "new" to "run" by Corion
in thread Rename a Moo constructor from "new" to "run" by nysus

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.