Dealing with Multiple ONTAP/ONTAPI versions

I am by no means a programmer, but I manage to know enough Perl to use the NMSDK to make my life a little easier.  I suppose I have been lucky up to this point that most of my storage has been running the same or very similar versions of ONTAP (and therefore ONTAPI).  Differences between ONTAPI versions could usually be accomodated by using 'desired-attributes' when available.


But now I'm in a situation where I have clusters running 8.2, 8.3, and 9.1 and I'm struggling to support all of them with a single set of scripts.  I have been using NMSDK 5.4 as the basis for my scripts, but ONTAP 9.0 added enough new things that many do not work (due to the filer returning objects the NMSDK does not understand, "missing typedef".)  Additionally, trying to use NMSDK 5.7 with my 8.2 and 8.3 clusters doesn't work because parts of the API were obsoleted and removed (NMSDK expects something the filer then doesn't return).


I don't know if this is a general programming type issue or if its specific to Perl (and my use of the Perl bindings).  Is there some way to make the latest NMSDK reliably work with older ONTAP releases?  Is there some means for Perl to select the appropriate NMSDK version when loading modules?