It looks to me like this module implements a version control system.
I suppose you could take that view, much as DBD::SQLLite implements an RDBMS. Anyway, there are many things that a VC system does that I have no intention of implementing for VCS::Lite. These include an audit trail, change history, development streams, access control, check-out locking and unlocking, labels (aggregation of specific revisions of multiple objects). I can see the potential for another module in the VCS:: namespace which does implement a full VCS, or perhaps a software layer sitting above CVS, P4, PVCS, etc.
Using an array as your base object seems really bizarre to me.
There is a reason for this. A source file is a list of lines of text. Diff, patch and merge operate at the level of lines. Thinking about this polymorphically, the concept is really an array, and if you take a look at Algorithm::Diff, you will see that this module works on arrays.
The naive user of the module who is working with text files, does not need to realise that the underlying object is an array. Thanks, Perrin for the feedback. I need to restructure the pod to make this clear - go through a simple worked example with text files; only afterwards deal with other types of array.
This approach overcomes the difficulty that traditional VC systems have with binary files. If the programmer can supply a representation of a binary file as an array, it should be possible to do merges on binary files, given the rules for combining changes.
| [reply] |
| [reply] |
| [reply] |
I guess my VMS background is showing here (the VMS concept of a file is a record stream, not a byte stream). Besides, the diamond <> operator works on lines unless you change $/.
In terms of binary files, I was thinking of RTF or word documents - something for which insertion and deletion could be valid operations.
You are right about binary files generally, as without insertion/deletion, Algorithm::Diff is not appropriate. However, there's no reason not to use the same API (objects, diff, patch, merge) to do in-situ comparison. This can be achieved by subclassing VCS::Lite and providing some new methods.
| [reply] |