Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: How do you do multi-version modules?

by CountZero (Bishop)
on Oct 14, 2012 at 15:45 UTC ( #998957=note: print w/replies, xml ) Need Help??


in reply to How do you do multi-version modules?

Not having a version number is a bad idea. It will lead to all kinds of misunderstandings. How can anyone tell you what "version" they have installed if there is no version number?

If you ask me, I'd have no less than 3 modules: one with API1, one with API2 and one with all common code to API1 and API2.

Another solution is, depending on your code, to have the API modules contain only your public interface. Then all "working" code is in the third module. That will make it easier to maintain the whole by separating the concerns "interface" and "working code".

Or the API1 module could contain some routines that "translate" API1 calls into their API2 version and then handover execution to API2 which calls upon its own routines. You could do without a third module in this case.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics
  • Comment on Re: How do you do multi-version modules?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://998957]
help
Chatterbox?
[Corion]: Dumu: Yes, but switching needs to be done with caution, as you might read half an UTF-8 character in binary mode, and then switch to utf8 mode...
[Corion]: Personally, I would do the decoding of data in the program and not in the filehandle
[Corion]: ambrus: Maybe a record-based file where some data is strings encoded as utf8
[Corion]: But again, I would read all data as binary and then decode from utf8
[ambrus]: Corion: that wouldn't be my guess, but I'll wait for Dumu
[Corion]: Meh. I'm now on Firefox 57 ("Quantum") and again have to remove Pocket, and reinstall the adblocker, uMatrix (because NoScript doesn't work) and silence the about:blank page to not download crap from the internet
[Corion]: Maybe I shouldn't update software ...
[ambrus]: Corion: my guess is to first read the start of the file to check what format it is out of two or more possibilities, then rewind it and handle it differently depending on the program
[ambrus]: s/program/format/
[Dumu]: ambrus: it's about testing a file for being multiple possible file formats

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (12)
As of 2017-11-20 17:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (290 votes). Check out past polls.

    Notices?