One way you could do this is to never use other modules directly, but to have intermediate modules in between.

Something like this:

YourCode.pl--YourInterfaceModule.pm--ChangingModule.pm

So you create a stable interface towards your code, and when the interface breaks to the foreign modules, you've got one place to change the code, in YourInterfaceModule.pm.

Maybe there could be some kind of naming convention, so that when you want e.g. the functionality of Mail::POP3Client.pm (which according to the docs will change in that it will enforce named parameters in the future), you actually use your own module "MyInterfaces::Mail::POP3Client.pm", and then that module soaks up any interface changes.

update: I just realised that somebody with the right knowledge could create a generic module with:

This could work something like this:
package MyInterfaceTo::The::Real::Module use InterfaceModule ("The::Real::Module"); # InterfaceModule will handle method calls that fall # through, i.e. a bit like Class::MethodMaker # That would be all coding needed, as long as there # are no interface changes. When something changes, just # drop in a sub: sub get_some_data { # Changed from param list to named params my $self = shift; my %param; $param{'shoe_size'} = shift; $param{'shoe_color'} = shift; $param{'shoe_type'} = shift; $self->object_slot->get_some_data(%param); } 1;

update II: After looking at TheOtherGuy's reply it became clear that the problem the fancy generic-interface-module I suggested above tried to solve, can be solved with less effort by just subclassing the module in question, of course (looking at the code now I realise: "Oh, I just reinvented inheritance!":-). However there was a deeper train of thought behind it: The generic-interface-module approach can be used to switch implementation (what module to use). If this is done at run time it would change it from an adapter to a factory, if I got the patterns in the Gamma book right.

/jeorgen


In reply to Re: Parse/Validate Code by jeorgen
in thread Parse/Validate Code by pos

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.