Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re^2: Minor API changes in 10-year-old module

by wanna_code_perl (Friar)
on Sep 05, 2019 at 15:18 UTC ( #11105683=note: print w/replies, xml ) Need Help??

in reply to Re: Minor API changes in 10-year-old module
in thread Minor API changes in 10-year-old module

That's a good way to add a deprecation warning for this sort of situation, and a simple solution. Thanks! And I have no deadline for this, so it's no skin off my asterisk to release such a version now, wait six months or more, then release another. My only hesitation is that it'd also be nice to give users a way to "opt in" to the changes ahead of time, and I was originally thinking of doing that in the code itself, but I reckoned that could get ugly, multiply the unit test requirements, and add two more likely points to introduce regressions. But you've got me thinking. Maybe append your warning with "For new code, use development version USERNAME/Module-Unknown-2.00_01.tar.gz" or something to that effect, with a blurb in the docs on how to fetch a dev build. Or is there an even cleverer way? :-)

  • Comment on Re^2: Minor API changes in 10-year-old module

Replies are listed 'Best First'.
Re^3: Minor API changes in 10-year-old module
by holli (Abbot) on Sep 05, 2019 at 16:24 UTC
    Well, you can. It's more work but you could make this first new version behave like the old version, with aformentioned warnings, but also support the fixed API when they use it with use Module qw(:always-die); or use Module qw(:newapi); or whatever. Then your next version can switch to new api and silently ignore that flag.


    You can lead your users to water, but alas, you cannot drown them.

      If the new API is (clearly) better, I'd reverse that and add use Some::Module qw( API2009 ); and have a few wrapper functions that are backward compatible. The docs can then say that this possibility will be removed in version x.yy or from 2020-09-10 forward.

      As a side note: there is absolutely no need for a return immediately following a croak. The croak will exit the current scope immediately causing the return to never execute. Code like that is misleading and wrong.

      Enjoy, Have FUN! H.Merijn

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11105683]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2021-10-23 08:15 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (87 votes). Check out past polls.